All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>,
	Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t 1/1] Rename dynamic subtest blocks
Date: Mon, 18 Nov 2019 13:09:36 +0200	[thread overview]
Message-ID: <20191118110936.4725-1-petri.latvala@intel.com> (raw)

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>
---

NOTE!

The commit message is worded as being the final decision, but it's of
course just a suggestion for the final naming and won't be used
without acks, especially the people who have pointed out the awfulness
of the naming. With luck I might have succeeded in CCing all of them
and people otherwise involved in reviewing dynamic subtests.

These names meet the requirements laid out in words on the mailing
list:

* makes it clear that the subtest that can have dynamic runtime parts
  is a subtest more than an igt_subtest_group
* don't completely destroy ickle's keyboard


lib/igt_core.c                   |  4 +--
 lib/igt_core.h                   | 46 ++++++++++++++++----------------
 lib/tests/igt_describe.c         |  4 +--
 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();
-- 
2.19.1

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

             reply	other threads:[~2019-11-18 11:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18 11:09 Petri Latvala [this message]
2019-11-18 11:16 ` [igt-dev] [PATCH i-g-t 1/1] Rename dynamic subtest blocks Chris Wilson
2019-11-18 11:50 ` Tvrtko Ursulin
2019-11-18 12:40 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/1] " Patchwork
2019-11-18 13:02 ` [igt-dev] [PATCH i-g-t 1/1] " Arkadiusz Hiler
2019-11-18 16:50 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/1] " Patchwork
2019-11-19 11:53   ` Petri Latvala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191118110936.4725-1-petri.latvala@intel.com \
    --to=petri.latvala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=tvrtko.ursulin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.