summaryrefslogtreecommitdiff
path: root/lib/tests/igt_subtest_group.c
AgeCommit message (Collapse)Author
2019-05-10lib/tests/igt_subtest_group: Operate within defined behaviorArkadiusz Hiler
Quoting lib/igt_core.c: * - Code blocks with magic control flow are implemented with setjmp() and * longjmp(). This applies to #igt_fixture and #igt_subtest blocks and all the * three variants to finish test: igt_success(), igt_skip() and igt_fail(). * Mostly this is of no concern, except when such a control block changes * stack variables defined in the same function as the control block resides. * Any store/load behaviour after a longjmp() is ill-defined for these * variables. Avoid such code. * * Quoting the man page for longjmp(): * * "The values of automatic variables are unspecified after a call to * longjmp() if they meet all the following criteria:" * - "they are local to the function that made the corresponding setjmp() call; * - "their values are changed between the calls to setjmp() and longjmp(); and * - "they are not declared as volatile." igt_subtest_group test uses two local variables for tracking the state of execution, making sure that skips are working correctly. We can just make them volatile to be back on the defined grounds. v2: comment on the volatiles as suggested by Simon Ser Cc: Simon Ser <simon.ser@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Simon Ser <simon.ser@intel.com>
2019-02-20lib/tests: Add header for common helpersDaniel Vetter
Start with internal_assert, more will follow. While at it, use internal_assert everywhere (except where we check exit status, those will get dedicated assert checks). Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2016-03-19lib/tests: More igt_subtest_group checksDaniel Vetter
... for some cases discussed with Chris on irc. We seem to get them all right. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-03-19lib: Add igt_subtest_groupDaniel Vetter
Useful for creating common setup code in igt_fixture which is only needed by a subset of tests. And since I'm a good citizen it comes with a library testcase/example included. v2: Make testcase nastier to ensure a subtest group SKIPS when it's parent is skipping already. I accidentally got this right, but let's make sure. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>