diff options
author | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2019-05-08 08:59:30 +0300 |
---|---|---|
committer | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2019-05-10 10:58:54 +0300 |
commit | a269c21fc3d52ab502aa5cf98e47aca6520e5a37 (patch) | |
tree | ef3b86c4db2e695dcf356d2dffda0f474f76aba4 /m4 | |
parent | 615c7566c9753722d9b5fe0422e8e188ad91f2ba (diff) |
lib/tests/igt_subtest_group: Operate within defined behavior
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>
Diffstat (limited to 'm4')
0 files changed, 0 insertions, 0 deletions