All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/1] lib: Help static analyzers figure out the execution flow
@ 2018-10-30 14:15 Petri Latvala
  2018-10-30 15:29 ` Daniel Vetter
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Petri Latvala @ 2018-10-30 14:15 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

When running any kind of static analysis on IGT, one tends to drown in
warnings about using uninitialized variables in subtests, because
static analysis is unable to figure out that igt_fixture blocks are
always entered if a subtest block is entered. Aid the discovery of
correct execution flow by making static analysis always enter all
igt_fixture blocks and all subtest blocks.

Automatic discovery of static analyzers is done for Clang, Coverity
and Klocwork, using macros found by quick googling. For explicit
control on possible other analyzers, defining STATIC_ANALYSIS_BUILD=1
manually will activate this hack.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
---
lib/igt_core.h | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/lib/igt_core.h b/lib/igt_core.h
index b80e1702..0f643f6b 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -46,6 +46,14 @@
 #endif
 
 
+#ifndef STATIC_ANALYSIS_BUILD
+#if defined(__clang_analyzer__) || defined(__COVERITY__) || defined(__KLOCWORK__)
+#define STATIC_ANALYSIS_BUILD 1
+#else
+#define STATIC_ANALYSIS_BUILD 0
+#endif
+#endif
+
 extern const char* __igt_test_description __attribute__((weak));
 extern bool __igt_plain_output;
 extern char *igt_frame_dump_path;
@@ -109,9 +117,10 @@ void __igt_fixture_end(void) __attribute__((noreturn));
  * blocks should be annotated with igt_fixture.
  */
 #define igt_fixture for (volatile int igt_tokencat(__tmpint,__LINE__) = 0; \
+                         STATIC_ANALYSIS_BUILD || ( \
 			 igt_tokencat(__tmpint,__LINE__) < 1 && \
 			 __igt_fixture() && \
-			 (sigsetjmp(igt_subtest_jmpbuf, 1) == 0); \
+			 (sigsetjmp(igt_subtest_jmpbuf, 1) == 0)); \
 			 igt_tokencat(__tmpint,__LINE__) ++, \
 			 __igt_fixture_complete())
 
@@ -169,15 +178,17 @@ bool __igt_run_subtest(const char *subtest_name);
  *
  * This is a simpler version of igt_subtest_f()
  */
-#define igt_subtest(name) for (; __igt_run_subtest((name)) && \
-				   (sigsetjmp(igt_subtest_jmpbuf, 1) == 0); \
-				   igt_success())
+#define igt_subtest(name) for (; STATIC_ANALYSIS_BUILD ||		\
+				       (__igt_run_subtest((name)) &&	\
+					(sigsetjmp(igt_subtest_jmpbuf, 1) == 0)); \
+                                  igt_success())
 #define __igt_subtest_f(tmp, format...) \
 	for (char tmp [256]; \
-	     snprintf( tmp , sizeof( tmp ), \
+	     STATIC_ANALYSIS_BUILD || \
+	     ((snprintf( tmp , sizeof( tmp ), \
 		      format), \
-	     __igt_run_subtest( tmp ) && \
-	     (sigsetjmp(igt_subtest_jmpbuf, 1) == 0); \
+	       __igt_run_subtest( tmp )) && \
+	      (sigsetjmp(igt_subtest_jmpbuf, 1) == 0)); \
 	     igt_success())
 
 /**
-- 
2.18.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/1] lib: Help static analyzers figure out the execution flow
  2018-10-30 14:15 [igt-dev] [PATCH i-g-t 1/1] lib: Help static analyzers figure out the execution flow Petri Latvala
@ 2018-10-30 15:29 ` Daniel Vetter
  2018-10-30 15:38 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/1] " Patchwork
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2018-10-30 15:29 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev

On Tue, Oct 30, 2018 at 04:15:08PM +0200, Petri Latvala wrote:
> When running any kind of static analysis on IGT, one tends to drown in
> warnings about using uninitialized variables in subtests, because
> static analysis is unable to figure out that igt_fixture blocks are
> always entered if a subtest block is entered. Aid the discovery of
> correct execution flow by making static analysis always enter all
> igt_fixture blocks and all subtest blocks.
> 
> Automatic discovery of static analyzers is done for Clang, Coverity
> and Klocwork, using macros found by quick googling. For explicit
> control on possible other analyzers, defining STATIC_ANALYSIS_BUILD=1
> manually will activate this hack.
> 
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>

I guess if it helps, this makes sense.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
> lib/igt_core.h | 25 ++++++++++++++++++-------
>  1 file changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index b80e1702..0f643f6b 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -46,6 +46,14 @@
>  #endif
>  
>  
> +#ifndef STATIC_ANALYSIS_BUILD
> +#if defined(__clang_analyzer__) || defined(__COVERITY__) || defined(__KLOCWORK__)
> +#define STATIC_ANALYSIS_BUILD 1
> +#else
> +#define STATIC_ANALYSIS_BUILD 0
> +#endif
> +#endif
> +
>  extern const char* __igt_test_description __attribute__((weak));
>  extern bool __igt_plain_output;
>  extern char *igt_frame_dump_path;
> @@ -109,9 +117,10 @@ void __igt_fixture_end(void) __attribute__((noreturn));
>   * blocks should be annotated with igt_fixture.
>   */
>  #define igt_fixture for (volatile int igt_tokencat(__tmpint,__LINE__) = 0; \
> +                         STATIC_ANALYSIS_BUILD || ( \
>  			 igt_tokencat(__tmpint,__LINE__) < 1 && \
>  			 __igt_fixture() && \
> -			 (sigsetjmp(igt_subtest_jmpbuf, 1) == 0); \
> +			 (sigsetjmp(igt_subtest_jmpbuf, 1) == 0)); \
>  			 igt_tokencat(__tmpint,__LINE__) ++, \
>  			 __igt_fixture_complete())
>  
> @@ -169,15 +178,17 @@ bool __igt_run_subtest(const char *subtest_name);
>   *
>   * This is a simpler version of igt_subtest_f()
>   */
> -#define igt_subtest(name) for (; __igt_run_subtest((name)) && \
> -				   (sigsetjmp(igt_subtest_jmpbuf, 1) == 0); \
> -				   igt_success())
> +#define igt_subtest(name) for (; STATIC_ANALYSIS_BUILD ||		\
> +				       (__igt_run_subtest((name)) &&	\
> +					(sigsetjmp(igt_subtest_jmpbuf, 1) == 0)); \
> +                                  igt_success())
>  #define __igt_subtest_f(tmp, format...) \
>  	for (char tmp [256]; \
> -	     snprintf( tmp , sizeof( tmp ), \
> +	     STATIC_ANALYSIS_BUILD || \
> +	     ((snprintf( tmp , sizeof( tmp ), \
>  		      format), \
> -	     __igt_run_subtest( tmp ) && \
> -	     (sigsetjmp(igt_subtest_jmpbuf, 1) == 0); \
> +	       __igt_run_subtest( tmp )) && \
> +	      (sigsetjmp(igt_subtest_jmpbuf, 1) == 0)); \
>  	     igt_success())
>  
>  /**
> -- 
> 2.18.0
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/1] lib: Help static analyzers figure out the execution flow
  2018-10-30 14:15 [igt-dev] [PATCH i-g-t 1/1] lib: Help static analyzers figure out the execution flow Petri Latvala
  2018-10-30 15:29 ` Daniel Vetter
@ 2018-10-30 15:38 ` Patchwork
  2018-10-30 19:26 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-10-30 15:38 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/1] lib: Help static analyzers figure out the execution flow
URL   : https://patchwork.freedesktop.org/series/51760/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5054 -> IGTPW_2019 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/51760/revisions/1/mbox/

== Known issues ==

  Here are the changes found in IGTPW_2019 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_module_reload@basic-reload:
      fi-blb-e6850:       PASS -> INCOMPLETE (fdo#107718)

    igt@drv_selftest@live_hangcheck:
      fi-icl-u2:          PASS -> INCOMPLETE (fdo#108315)

    igt@kms_flip@basic-flip-vs-modeset:
      fi-skl-6700hq:      PASS -> DMESG-WARN (fdo#105998) +1

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-cfl-8109u:       PASS -> DMESG-WARN (fdo#107345)

    
    ==== Possible fixes ====

    igt@gem_ctx_create@basic-files:
      fi-icl-u2:          DMESG-WARN (fdo#107724) -> PASS

    igt@kms_frontbuffer_tracking@basic:
      fi-byt-clapper:     FAIL (fdo#103167) -> PASS

    
    ==== Warnings ====

    igt@drv_selftest@live_contexts:
      fi-icl-u2:          DMESG-FAIL (fdo#108569) -> INCOMPLETE (fdo#108315)

    
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#105998 https://bugs.freedesktop.org/show_bug.cgi?id=105998
  fdo#107345 https://bugs.freedesktop.org/show_bug.cgi?id=107345
  fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
  fdo#107724 https://bugs.freedesktop.org/show_bug.cgi?id=107724
  fdo#108315 https://bugs.freedesktop.org/show_bug.cgi?id=108315
  fdo#108569 https://bugs.freedesktop.org/show_bug.cgi?id=108569


== Participating hosts (46 -> 42) ==

  Additional (2): fi-skl-iommu fi-pnv-d510 
  Missing    (6): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-u 


== Build changes ==

    * IGT: IGT_4699 -> IGTPW_2019

  CI_DRM_5054: dfa9e5c2b4b958e77c1109477b94c5c8615e25cc @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2019: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2019/
  IGT_4699: 1270ec553741ac20c45178d2b26f9a9562ea565f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2019/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/1] lib: Help static analyzers figure out the execution flow
  2018-10-30 14:15 [igt-dev] [PATCH i-g-t 1/1] lib: Help static analyzers figure out the execution flow Petri Latvala
  2018-10-30 15:29 ` Daniel Vetter
  2018-10-30 15:38 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/1] " Patchwork
@ 2018-10-30 19:26 ` Patchwork
  2018-10-31 11:30 ` [igt-dev] [PATCH i-g-t v2 1/1] " Petri Latvala
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-10-30 19:26 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/1] lib: Help static analyzers figure out the execution flow
URL   : https://patchwork.freedesktop.org/series/51760/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4699_full -> IGTPW_2019_full =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_2019_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_2019_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/51760/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_2019_full:

  === IGT changes ===

    ==== Warnings ====

    igt@pm_rc6_residency@rc6-accuracy:
      shard-snb:          SKIP -> PASS

    
== Known issues ==

  Here are the changes found in IGTPW_2019_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-c:
      shard-apl:          NOTRUN -> DMESG-WARN (fdo#107956)

    igt@kms_ccs@pipe-a-crc-sprite-planes-basic:
      shard-glk:          PASS -> FAIL (fdo#108145)

    igt@kms_color@pipe-a-ctm-max:
      shard-apl:          PASS -> FAIL (fdo#108147)

    igt@kms_color@pipe-a-legacy-gamma:
      shard-apl:          PASS -> FAIL (fdo#104782, fdo#108145)

    igt@kms_cursor_crc@cursor-128x128-onscreen:
      shard-kbl:          PASS -> FAIL (fdo#103232) +3

    igt@kms_cursor_crc@cursor-256x256-dpms:
      shard-glk:          PASS -> FAIL (fdo#103232) +4

    igt@kms_cursor_crc@cursor-256x85-sliding:
      shard-apl:          PASS -> FAIL (fdo#103232) +9

    igt@kms_cursor_crc@cursor-64x64-suspend:
      shard-apl:          PASS -> FAIL (fdo#103191, fdo#103232) +1

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-onoff:
      shard-apl:          PASS -> FAIL (fdo#103167) +3
      shard-kbl:          PASS -> FAIL (fdo#103167)

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-indfb-draw-mmap-gtt:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-shrfb-draw-render:
      shard-glk:          PASS -> FAIL (fdo#103167) +1

    igt@kms_plane@plane-position-covered-pipe-c-planes:
      shard-apl:          PASS -> FAIL (fdo#103166) +3

    igt@kms_plane_alpha_blend@pipe-c-alpha-opaque-fb:
      shard-apl:          NOTRUN -> FAIL (fdo#108145)

    igt@kms_plane_multiple@atomic-pipe-b-tiling-x:
      shard-kbl:          PASS -> FAIL (fdo#103166)

    igt@kms_rotation_crc@primary-rotation-180:
      shard-snb:          PASS -> FAIL (fdo#103925)

    igt@kms_universal_plane@universal-plane-pipe-c-functional:
      shard-glk:          PASS -> FAIL (fdo#103166) +3

    
    ==== Possible fixes ====

    igt@gem_exec_blt@normal-min:
      shard-apl:          INCOMPLETE (fdo#103927) -> PASS

    igt@gem_userptr_blits@unsync-unmap:
      shard-glk:          DMESG-WARN (fdo#106538, fdo#105763) -> PASS

    igt@kms_available_modes_crc@available_mode_test_crc:
      shard-apl:          FAIL (fdo#106641) -> PASS

    igt@kms_cursor_crc@cursor-128x42-onscreen:
      shard-glk:          FAIL (fdo#103232) -> PASS +3

    igt@kms_cursor_crc@cursor-64x21-random:
      shard-apl:          FAIL (fdo#103232) -> PASS +2
      shard-kbl:          FAIL (fdo#103232) -> PASS +1

    igt@kms_draw_crc@draw-method-rgb565-pwrite-ytiled:
      shard-glk:          FAIL (fdo#103184) -> PASS +1

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu:
      shard-kbl:          FAIL (fdo#103167) -> PASS +1

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
      shard-apl:          FAIL (fdo#103167) -> PASS

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-move:
      shard-glk:          FAIL (fdo#103167) -> PASS +6

    igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-spr-indfb-onoff:
      shard-glk:          DMESG-FAIL (fdo#106538, fdo#103167) -> PASS

    igt@kms_plane@plane-position-covered-pipe-a-planes:
      shard-glk:          FAIL (fdo#103166) -> PASS +1

    igt@kms_plane_alpha_blend@pipe-b-alpha-opaque-fb:
      shard-glk:          FAIL (fdo#108145) -> PASS
      shard-apl:          FAIL (fdo#108145) -> PASS
      shard-kbl:          FAIL (fdo#108145) -> PASS

    igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
      shard-apl:          FAIL (fdo#103166) -> PASS
      shard-kbl:          FAIL (fdo#103166) -> PASS +1

    
    ==== Warnings ====

    igt@kms_content_protection@atomic:
      shard-apl:          DMESG-FAIL (fdo#108549) -> FAIL (fdo#108597) +1

    
  fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103184 https://bugs.freedesktop.org/show_bug.cgi?id=103184
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#104782 https://bugs.freedesktop.org/show_bug.cgi?id=104782
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
  fdo#106538 https://bugs.freedesktop.org/show_bug.cgi?id=106538
  fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
  fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
  fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
  fdo#108147 https://bugs.freedesktop.org/show_bug.cgi?id=108147
  fdo#108549 https://bugs.freedesktop.org/show_bug.cgi?id=108549
  fdo#108597 https://bugs.freedesktop.org/show_bug.cgi?id=108597


== Participating hosts (6 -> 5) ==

  Missing    (1): shard-skl 


== Build changes ==

    * IGT: IGT_4699 -> IGTPW_2019
    * Linux: CI_DRM_5044 -> CI_DRM_5054

  CI_DRM_5044: c4487dca27970879bf67f331614142c749984d65 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_5054: dfa9e5c2b4b958e77c1109477b94c5c8615e25cc @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2019: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2019/
  IGT_4699: 1270ec553741ac20c45178d2b26f9a9562ea565f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2019/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [igt-dev] [PATCH i-g-t v2 1/1] lib: Help static analyzers figure out the execution flow
  2018-10-30 14:15 [igt-dev] [PATCH i-g-t 1/1] lib: Help static analyzers figure out the execution flow Petri Latvala
                   ` (2 preceding siblings ...)
  2018-10-30 19:26 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2018-10-31 11:30 ` Petri Latvala
  2018-10-31 11:32   ` [igt-dev] [PATCH i-g-t v3 " Petri Latvala
  2018-10-31 15:38 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v3,1/1] lib: Help static analyzers figure out the execution flow (rev3) Patchwork
  2018-10-31 21:25 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  5 siblings, 1 reply; 8+ messages in thread
From: Petri Latvala @ 2018-10-31 11:30 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

When running any kind of static analysis on IGT, one tends to drown in
warnings about using uninitialized variables in subtests, because
static analysis is unable to figure out that igt_fixture blocks are
always entered if a subtest block is entered. Aid the discovery of
correct execution flow by making static analysis always enter all
igt_fixture blocks and all subtest blocks.

Automatic discovery of static analyzers is done for Clang, Coverity
and Klocwork, using macros found by quick googling. For explicit
control on possible other analyzers, defining STATIC_ANALYSIS_BUILD=1
manually will activate this hack.

v2:
 - Hack not needed for igt_subtest()
 - Make sure igt_fixture is entered once instead of an infinite loop

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> # v1
---
 lib/igt_core.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/igt_core.h b/lib/igt_core.h
index b80e1702..c9815a36 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -46,6 +46,14 @@
 #endif
 
 
+#ifndef STATIC_ANALYSIS_BUILD
+#if defined(__clang_analyzer__) || defined(__COVERITY__) || defined(__KLOCWORK__)
+#define STATIC_ANALYSIS_BUILD 1
+#else
+#define STATIC_ANALYSIS_BUILD 0
+#endif
+#endif
+
 extern const char* __igt_test_description __attribute__((weak));
 extern bool __igt_plain_output;
 extern char *igt_frame_dump_path;
@@ -110,8 +118,9 @@ void __igt_fixture_end(void) __attribute__((noreturn));
  */
 #define igt_fixture for (volatile int igt_tokencat(__tmpint,__LINE__) = 0; \
 			 igt_tokencat(__tmpint,__LINE__) < 1 && \
-			 __igt_fixture() && \
-			 (sigsetjmp(igt_subtest_jmpbuf, 1) == 0); \
+			 (STATIC_ANALYSIS_BUILD ||
+			 (__igt_fixture() && \
+			 (sigsetjmp(igt_subtest_jmpbuf, 1) == 0))); \
 			 igt_tokencat(__tmpint,__LINE__) ++, \
 			 __igt_fixture_complete())
 
-- 
2.18.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [igt-dev] [PATCH i-g-t v3 1/1] lib: Help static analyzers figure out the execution flow
  2018-10-31 11:30 ` [igt-dev] [PATCH i-g-t v2 1/1] " Petri Latvala
@ 2018-10-31 11:32   ` Petri Latvala
  0 siblings, 0 replies; 8+ messages in thread
From: Petri Latvala @ 2018-10-31 11:32 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

When running any kind of static analysis on IGT, one tends to drown in
warnings about using uninitialized variables in subtests, because
static analysis is unable to figure out that igt_fixture blocks are
always entered if a subtest block is entered. Aid the discovery of
correct execution flow by making static analysis always enter all
igt_fixture blocks and all subtest blocks.

Automatic discovery of static analyzers is done for Clang, Coverity
and Klocwork, using macros found by quick googling. For explicit
control on possible other analyzers, defining STATIC_ANALYSIS_BUILD=1
manually will activate this hack.

v2:
 - Hack not needed for igt_subtest()
 - Make sure igt_fixture is entered once instead of an infinite loop

v3:
 - Rebase properly...

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> # v1
---
 lib/igt_core.h | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/igt_core.h b/lib/igt_core.h
index b80e1702..6f8c3852 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -46,6 +46,14 @@
 #endif
 
 
+#ifndef STATIC_ANALYSIS_BUILD
+#if defined(__clang_analyzer__) || defined(__COVERITY__) || defined(__KLOCWORK__)
+#define STATIC_ANALYSIS_BUILD 1
+#else
+#define STATIC_ANALYSIS_BUILD 0
+#endif
+#endif
+
 extern const char* __igt_test_description __attribute__((weak));
 extern bool __igt_plain_output;
 extern char *igt_frame_dump_path;
@@ -110,8 +118,9 @@ void __igt_fixture_end(void) __attribute__((noreturn));
  */
 #define igt_fixture for (volatile int igt_tokencat(__tmpint,__LINE__) = 0; \
 			 igt_tokencat(__tmpint,__LINE__) < 1 && \
-			 __igt_fixture() && \
-			 (sigsetjmp(igt_subtest_jmpbuf, 1) == 0); \
+			 (STATIC_ANALYSIS_BUILD || \
+			 (__igt_fixture() && \
+			 (sigsetjmp(igt_subtest_jmpbuf, 1) == 0))); \
 			 igt_tokencat(__tmpint,__LINE__) ++, \
 			 __igt_fixture_complete())
 
-- 
2.18.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v3,1/1] lib: Help static analyzers figure out the execution flow (rev3)
  2018-10-30 14:15 [igt-dev] [PATCH i-g-t 1/1] lib: Help static analyzers figure out the execution flow Petri Latvala
                   ` (3 preceding siblings ...)
  2018-10-31 11:30 ` [igt-dev] [PATCH i-g-t v2 1/1] " Petri Latvala
@ 2018-10-31 15:38 ` Patchwork
  2018-10-31 21:25 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  5 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-10-31 15:38 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,v3,1/1] lib: Help static analyzers figure out the execution flow (rev3)
URL   : https://patchwork.freedesktop.org/series/51760/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_5060 -> IGTPW_2022 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/51760/revisions/3/mbox/

== Known issues ==

  Here are the changes found in IGTPW_2022 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_contexts:
      fi-icl-u:           NOTRUN -> DMESG-FAIL (fdo#108569)

    igt@kms_flip@basic-flip-vs-modeset:
      fi-skl-6700hq:      PASS -> DMESG-WARN (fdo#105998) +1

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a:
      fi-byt-clapper:     PASS -> FAIL (fdo#107362)

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
      fi-byt-clapper:     PASS -> FAIL (fdo#103191, fdo#107362)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-blb-e6850:       PASS -> INCOMPLETE (fdo#107718)

    
    ==== Possible fixes ====

    igt@gem_ctx_switch@basic-default:
      fi-icl-u:           DMESG-FAIL (fdo#108535) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-byt-clapper:     FAIL (fdo#103191, fdo#107362) -> PASS +1

    
    ==== Warnings ====

    igt@drv_selftest@live_contexts:
      fi-icl-u2:          DMESG-FAIL (fdo#108569) -> INCOMPLETE (fdo#108315)

    
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#105998 https://bugs.freedesktop.org/show_bug.cgi?id=105998
  fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
  fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
  fdo#108315 https://bugs.freedesktop.org/show_bug.cgi?id=108315
  fdo#108535 https://bugs.freedesktop.org/show_bug.cgi?id=108535
  fdo#108569 https://bugs.freedesktop.org/show_bug.cgi?id=108569


== Participating hosts (46 -> 43) ==

  Additional (3): fi-kbl-7560u fi-skl-iommu fi-apl-guc 
  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-cfl-8109u 


== Build changes ==

    * IGT: IGT_4702 -> IGTPW_2022

  CI_DRM_5060: 68732cb54bff70449aa3bc5a500a20b8629f53fa @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2022: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2022/
  IGT_4702: 6c68c30ef88187a08ec6dff2d77eb07f26eb48c8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2022/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,v3,1/1] lib: Help static analyzers figure out the execution flow (rev3)
  2018-10-30 14:15 [igt-dev] [PATCH i-g-t 1/1] lib: Help static analyzers figure out the execution flow Petri Latvala
                   ` (4 preceding siblings ...)
  2018-10-31 15:38 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v3,1/1] lib: Help static analyzers figure out the execution flow (rev3) Patchwork
@ 2018-10-31 21:25 ` Patchwork
  5 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-10-31 21:25 UTC (permalink / raw)
  To: Petri Latvala; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,v3,1/1] lib: Help static analyzers figure out the execution flow (rev3)
URL   : https://patchwork.freedesktop.org/series/51760/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4702_full -> IGTPW_2022_full =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_2022_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_2022_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/51760/revisions/3/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_2022_full:

  === IGT changes ===

    ==== Warnings ====

    igt@pm_rc6_residency@rc6-accuracy:
      shard-kbl:          PASS -> SKIP

    
== Known issues ==

  Here are the changes found in IGTPW_2022_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_ctx_isolation@vecs0-s3:
      shard-apl:          PASS -> INCOMPLETE (fdo#103927)

    igt@kms_available_modes_crc@available_mode_test_crc:
      shard-snb:          PASS -> FAIL (fdo#106641)

    igt@kms_busy@extended-modeset-hang-newfb-render-c:
      shard-apl:          NOTRUN -> DMESG-WARN (fdo#107956)

    igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-b:
      shard-snb:          NOTRUN -> DMESG-WARN (fdo#107956) +1

    igt@kms_cursor_crc@cursor-128x42-onscreen:
      shard-apl:          PASS -> FAIL (fdo#103232)

    igt@kms_flip@2x-flip-vs-modeset-interruptible:
      shard-glk:          PASS -> INCOMPLETE (fdo#103359, k.org#198133)

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
      shard-apl:          PASS -> FAIL (fdo#103167) +2

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render:
      shard-kbl:          PASS -> FAIL (fdo#103167) +1

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-onoff:
      shard-glk:          PASS -> FAIL (fdo#103167) +5

    igt@kms_plane_alpha_blend@pipe-a-constant-alpha-max:
      shard-apl:          NOTRUN -> FAIL (fdo#108145)

    igt@kms_plane_multiple@atomic-pipe-c-tiling-yf:
      shard-apl:          PASS -> FAIL (fdo#103166) +1

    igt@kms_rotation_crc@primary-rotation-180:
      shard-snb:          PASS -> FAIL (fdo#103925)

    igt@kms_setmode@basic:
      shard-apl:          PASS -> FAIL (fdo#99912)

    igt@perf@blocking:
      shard-hsw:          PASS -> FAIL (fdo#102252)

    
    ==== Possible fixes ====

    igt@gem_ppgtt@blt-vs-render-ctxn:
      shard-kbl:          INCOMPLETE (fdo#106023, fdo#106887, fdo#103665) -> PASS

    igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-a:
      shard-glk:          DMESG-WARN (fdo#107956) -> PASS

    igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-c:
      shard-apl:          DMESG-WARN (fdo#107956) -> PASS

    igt@kms_color@pipe-c-degamma:
      shard-apl:          FAIL (fdo#104782) -> PASS

    igt@kms_cursor_crc@cursor-128x128-onscreen:
      shard-kbl:          FAIL (fdo#103232) -> PASS

    igt@kms_cursor_crc@cursor-128x128-suspend:
      shard-apl:          FAIL (fdo#103232, fdo#103191) -> PASS +1

    igt@kms_cursor_crc@cursor-256x256-sliding:
      shard-glk:          FAIL (fdo#103232) -> PASS +4

    igt@kms_cursor_crc@cursor-64x21-random:
      shard-apl:          FAIL (fdo#103232) -> PASS +7

    igt@kms_fbcon_fbt@fbc-suspend:
      shard-apl:          INCOMPLETE (fdo#103927) -> PASS

    igt@kms_flip@flip-vs-panning-interruptible:
      shard-glk:          INCOMPLETE (fdo#103359, k.org#198133) -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-mmap-wc:
      shard-kbl:          FAIL (fdo#103167) -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu:
      shard-apl:          FAIL (fdo#103167) -> PASS +3

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-mmap-cpu:
      shard-glk:          FAIL (fdo#103167) -> PASS +3

    igt@kms_plane_multiple@atomic-pipe-a-tiling-yf:
      shard-apl:          FAIL (fdo#103166) -> PASS +1

    igt@kms_plane_multiple@atomic-pipe-b-tiling-y:
      shard-glk:          FAIL (fdo#103166) -> PASS +2

    igt@kms_setmode@basic:
      shard-kbl:          FAIL (fdo#99912) -> PASS

    
  fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
  fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#104782 https://bugs.freedesktop.org/show_bug.cgi?id=104782
  fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
  fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
  fdo#106887 https://bugs.freedesktop.org/show_bug.cgi?id=106887
  fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
  fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
  k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133


== Participating hosts (6 -> 5) ==

  Missing    (1): shard-skl 


== Build changes ==

    * IGT: IGT_4702 -> IGTPW_2022
    * Linux: CI_DRM_5059 -> CI_DRM_5060

  CI_DRM_5059: ca3747e473d592e64dab2e82e33a874015179ce5 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_5060: 68732cb54bff70449aa3bc5a500a20b8629f53fa @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2022: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2022/
  IGT_4702: 6c68c30ef88187a08ec6dff2d77eb07f26eb48c8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2022/shards.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-10-31 21:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30 14:15 [igt-dev] [PATCH i-g-t 1/1] lib: Help static analyzers figure out the execution flow Petri Latvala
2018-10-30 15:29 ` Daniel Vetter
2018-10-30 15:38 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/1] " Patchwork
2018-10-30 19:26 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-10-31 11:30 ` [igt-dev] [PATCH i-g-t v2 1/1] " Petri Latvala
2018-10-31 11:32   ` [igt-dev] [PATCH i-g-t v3 " Petri Latvala
2018-10-31 15:38 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v3,1/1] lib: Help static analyzers figure out the execution flow (rev3) Patchwork
2018-10-31 21:25 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.