diff options
author | Petri Latvala <petri.latvala@intel.com> | 2019-11-18 13:09:36 +0200 |
---|---|---|
committer | Petri Latvala <petri.latvala@intel.com> | 2019-11-19 13:51:05 +0200 |
commit | 9211e4794e40135d797e6d056d6d8d40076acb92 (patch) | |
tree | ee22310b26fb3a4ac96d88802225c850141fb145 | |
parent | a70013186d3060cfd15d9640fd9a4c360d477c08 (diff) |
Rename dynamic subtest blocks
The final naming for the magic block identifiers is:
igt_subtest_with_dynamic("do-stuff-on-things") {
for_each_thing(x) {
igt_dynamic_f("%s", x->name) {
do_stuff(x);
}
}
}
Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Katarzyna Dec <katarzyna.dec@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
-rw-r--r-- | lib/igt_core.c | 4 | ||||
-rw-r--r-- | lib/igt_core.h | 46 | ||||
-rw-r--r-- | lib/tests/igt_describe.c | 4 | ||||
-rw-r--r-- | lib/tests/igt_dynamic_subtests.c | 18 |
4 files changed, 36 insertions, 36 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c index a0c673d1..99aa0bee 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -127,7 +127,7 @@ * * - Code blocks with magic control flow are implemented with setjmp() * and longjmp(). This applies to #igt_fixture, #igt_subtest, - * #igt_subtest_with_dynamic_subsubtests and #igt_dynamic_subsubtest + * #igt_subtest_with_dynamic and #igt_dynamic * 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 @@ -1281,7 +1281,7 @@ static void exit_subtest(const char *result) const char *subtest_text = in_dynamic_subtest ? "Dynamic subtest" : "Subtest"; const char **subtest_name = in_dynamic_subtest ? &in_dynamic_subtest : &in_subtest; struct timespec *thentime = in_dynamic_subtest ? &dynamic_subtest_time : &subtest_time; - jmp_buf *jmptarget = in_dynamic_subtest ? &igt_dynamic_subsubtest_jmpbuf : &igt_subtest_jmpbuf; + jmp_buf *jmptarget = in_dynamic_subtest ? &igt_dynamic_jmpbuf : &igt_subtest_jmpbuf; igt_gettime(&now); diff --git a/lib/igt_core.h b/lib/igt_core.h index 86bc1b41..c17a7ba8 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -146,7 +146,7 @@ void __igt_fixture_end(void) __attribute__((noreturn)); /* subtest infrastructure */ jmp_buf igt_subtest_jmpbuf; -jmp_buf igt_dynamic_subsubtest_jmpbuf; +jmp_buf igt_dynamic_jmpbuf; typedef int (*igt_opt_handler_t)(int opt, int opt_index, void *data); #define IGT_OPT_HANDLER_SUCCESS 0 #define IGT_OPT_HANDLER_ERROR -2 @@ -230,7 +230,7 @@ bool __igt_run_dynamic_subtest(const char *dynamic_subtest_name); __igt_subtest_f(igt_tokencat(__tmpchar, __LINE__), f) /** - * igt_subtest_with_dynamic_subsubtests: + * igt_subtest_with_dynamic: * @name: name of the subtest * * This is a magic control flow block which denotes a subtest code @@ -238,13 +238,13 @@ bool __igt_run_dynamic_subtest(const char *dynamic_subtest_name); * printf format string, which is useful for constructing * combinatorial tests. * - * See igt_subtest_with_dynamic_subsubtests_f() for documentation. + * See igt_subtest_with_dynamic_f() for documentation. */ -#define igt_subtest_with_dynamic_subsubtests(name) for (; __igt_run_subtest((name), __FILE__, __LINE__) && \ +#define igt_subtest_with_dynamic(name) for (; __igt_run_subtest((name), __FILE__, __LINE__) && \ __igt_enter_dynamic_container() && \ (sigsetjmp(igt_subtest_jmpbuf, 1) == 0); \ igt_success()) -#define __igt_subtest_with_dynamic_subsubtests_f(tmp, format...) \ +#define __igt_subtest_with_dynamic_f(tmp, format...) \ for (char tmp [256]; \ snprintf( tmp , sizeof( tmp ), \ format), \ @@ -254,7 +254,7 @@ bool __igt_run_dynamic_subtest(const char *dynamic_subtest_name); igt_success()) /** - * igt_subtest_with_dynamic_subsubtests_f: + * igt_subtest_with_dynamic_f: * @...: format string and optional arguments * * This is a magic control flow block which denotes a subtest code @@ -275,12 +275,12 @@ bool __igt_run_dynamic_subtest(const char *dynamic_subtest_name); * subsubtest for each pipe and performs the operation for that pipe * in there. * - * The result of a subtest igt_subtest_with_dynamic_subsubtests will be + * The result of a subtest igt_subtest_with_dynamic will be * * SKIP, if no dynamic subsubtests are entered * * PASS, if _all_ dynamic subsubtests PASS * * FAIL, if _any_ dynamic subsubtests FAIL * - * Within a igt_subtest_with_dynamic_subsubtests block, explicit + * Within a igt_subtest_with_dynamic block, explicit * failure (e.g. igt_assert) is not allowed, only dynamic subsubtests * themselves will produce test results. igt_skip()/igt_require() is * allowed. Example: @@ -288,7 +288,7 @@ bool __igt_run_dynamic_subtest(const char *dynamic_subtest_name); * |[<!-- language="C" --> * igt_main * { - * igt_subtest_with_dynamic_subsubtests("engine-tests") { + * igt_subtest_with_dynamic("engine-tests") { * igt_require(is_awesome(fd)); // requires ok here * * for_each_engine(fd, e) { @@ -300,14 +300,14 @@ bool __igt_run_dynamic_subtest(const char *dynamic_subtest_name); * } * ]| * - * Like igt_subtest_with_dynamic_subsubtests(), but also accepts a printf + * Like igt_subtest_with_dynamic(), but also accepts a printf * format string instead of a static string. */ -#define igt_subtest_with_dynamic_subsubtests_f(f...) \ - __igt_subtest_with_dynamic_subsubtests_f(igt_tokencat(__tmpchar, __LINE__), f) +#define igt_subtest_with_dynamic_f(f...) \ + __igt_subtest_with_dynamic_f(igt_tokencat(__tmpchar, __LINE__), f) /** - * igt_dynamic_subsubtest: + * igt_dynamic: * @name: name of the dynamic subtest * * This is a magic control flow block which denotes a dynamic @@ -316,22 +316,22 @@ bool __igt_run_dynamic_subtest(const char *dynamic_subtest_name); * variant accepts a printf format string, which is useful for * constructing combinatorial tests. * - * See igt_subtest_with_dynamic_subsubtests_f() for documentation on + * See igt_subtest_with_dynamic_f() for documentation on * dynamic subsubtests. */ -#define igt_dynamic_subsubtest(name) for (; __igt_run_dynamic_subtest((name)) && \ - (sigsetjmp(igt_dynamic_subsubtest_jmpbuf, 1) == 0); \ +#define igt_dynamic(name) for (; __igt_run_dynamic_subtest((name)) && \ + (sigsetjmp(igt_dynamic_jmpbuf, 1) == 0); \ igt_success()) -#define __igt_dynamic_subsubtest_f(tmp, format...) \ +#define __igt_dynamic_f(tmp, format...) \ for (char tmp [256]; \ snprintf( tmp , sizeof( tmp ), \ format), \ __igt_run_dynamic_subtest( tmp ) && \ - (sigsetjmp(igt_dynamic_subsubtest_jmpbuf, 1) == 0); \ + (sigsetjmp(igt_dynamic_jmpbuf, 1) == 0); \ igt_success()) /** - * igt_dynamic_subsubtest_f: + * igt_dynamic_f: * @...: format string and optional arguments * * This is a magic control flow block which denotes a dynamic @@ -340,14 +340,14 @@ bool __igt_run_dynamic_subtest(const char *dynamic_subtest_name); * variant accepts a printf format string, which is useful for * constructing combinatorial tests. * - * See igt_subtest_with_dynamic_subsubtests_f() for documentation on + * See igt_subtest_with_dynamic_f() for documentation on * dynamic subsubtests. * - * Like igt_dynamic_subsubtest(), but also accepts a printf format string + * Like igt_dynamic(), but also accepts a printf format string * instead of a static string. */ -#define igt_dynamic_subsubtest_f(f...) \ - __igt_dynamic_subsubtest_f(igt_tokencat(__tmpchar, __LINE__), f) +#define igt_dynamic_f(f...) \ + __igt_dynamic_f(igt_tokencat(__tmpchar, __LINE__), f) const char *igt_subtest_name(void); bool igt_only_list_subtests(void); diff --git a/lib/tests/igt_describe.c b/lib/tests/igt_describe.c index 7ea3b961..6f3a4319 100644 --- a/lib/tests/igt_describe.c +++ b/lib/tests/igt_describe.c @@ -88,10 +88,10 @@ static void fake_main(int argc, char **argv) { ; igt_describe("Subtest with dynamic subsubtests"); - igt_subtest_with_dynamic_subsubtests("G") { + igt_subtest_with_dynamic("G") { printf("should not be executed!\n"); igt_describe("should assert on execution"); - igt_dynamic_subsubtest("should-not-list") + igt_dynamic("should-not-list") printf("should not be executed!\n"); } diff --git a/lib/tests/igt_dynamic_subtests.c b/lib/tests/igt_dynamic_subtests.c index 82d80a77..606104c5 100644 --- a/lib/tests/igt_dynamic_subtests.c +++ b/lib/tests/igt_dynamic_subtests.c @@ -56,7 +56,7 @@ static void dynamic_subtest_in_normal_subtest(void) igt_subtest_init(fake_argc, fake_argv); igt_subtest("normal-subtest") { - igt_dynamic_subsubtest("dynamic") { + igt_dynamic("dynamic") { igt_info("Dynamic subtest in normal subtest\n"); } } @@ -72,8 +72,8 @@ static void invalid_dynamic_subtest_name(void) igt_subtest_init(fake_argc, fake_argv); - igt_subtest_with_dynamic_subsubtests("subtest") { - igt_dynamic_subsubtest("# invalid name !") { + igt_subtest_with_dynamic("subtest") { + igt_dynamic("# invalid name !") { igt_info("Invalid dynamic subtest name test\n"); } } @@ -89,7 +89,7 @@ static void dynamic_subtest_in_toplevel(void) igt_subtest_init(fake_argc, fake_argv); - igt_dynamic_subsubtest("dynamic-subtest-in-toplevel") { + igt_dynamic("dynamic-subtest-in-toplevel") { igt_info("Dynamic subtests need to be in a subtest\n"); } @@ -104,7 +104,7 @@ static void subtest_itself_failing(void) igt_subtest_init(fake_argc, fake_argv); - igt_subtest_with_dynamic_subsubtests("subtest") { + igt_subtest_with_dynamic("subtest") { igt_assert(false); } @@ -119,7 +119,7 @@ static void subtest_itself_skipping(void) igt_subtest_init(fake_argc, fake_argv); - igt_subtest_with_dynamic_subsubtests("subtest") { + igt_subtest_with_dynamic("subtest") { igt_skip("Skipping\n"); } @@ -134,8 +134,8 @@ static void dynamic_subtest_failure_leads_to_fail(void) igt_subtest_init(fake_argc, fake_argv); - igt_subtest_with_dynamic_subsubtests("subtest") { - igt_dynamic_subsubtest("dynamic") { + igt_subtest_with_dynamic("subtest") { + igt_dynamic("dynamic") { igt_assert(false); } } @@ -151,7 +151,7 @@ static void no_dynamic_subtests_entered_leads_to_skip(void) igt_subtest_init(fake_argc, fake_argv); - igt_subtest_with_dynamic_subsubtests("subtest") { + igt_subtest_with_dynamic("subtest") { } igt_exit(); |