Add support for marking tests long-running
Tests such as vcpu_state.concurrent_save_restore run for a long
period of time in the hope that they will catch an issue which does
not manifest deterministically. This patch adds a property to the
hftest JSON indicating that the test requires a longer time limit.
To aid development, hftest.py will skip such tests when the
environment contains HAFNIUM_SKIP_LONG_RUNNING_TESTS=true (default for
local builds). 'SKIP <test_name>' is printed to inform the user that
a test was skipped.
Change-Id: I2f1b8c36f5aa7df30ac964d6c1bc11f0d82e727d
diff --git a/test/hftest/inc/hftest.h b/test/hftest/inc/hftest.h
index f8d388a..af581e1 100644
--- a/test/hftest/inc/hftest.h
+++ b/test/hftest/inc/hftest.h
@@ -35,7 +35,12 @@
/*
* Define a test as part of a test suite.
*/
-#define TEST(suite, test) HFTEST_TEST(suite, test)
+#define TEST(suite, test) HFTEST_TEST(suite, test, false)
+
+/*
+ * Define a test as part of a test suite and mark it long-running.
+ */
+#define TEST_LONG_RUNNING(suite, test) HFTEST_TEST(suite, test, true)
/*
* Define a test service.
diff --git a/test/hftest/inc/hftest_impl.h b/test/hftest/inc/hftest_impl.h
index 9598b12..f3c9ffa 100644
--- a/test/hftest/inc/hftest_impl.h
+++ b/test/hftest/inc/hftest_impl.h
@@ -103,7 +103,7 @@
} \
static void HFTEST_TEAR_DOWN_FN(suite_name)(void)
-#define HFTEST_TEST(suite_name, test_name) \
+#define HFTEST_TEST(suite_name, test_name, long_running) \
static void HFTEST_TEST_FN(suite_name, test_name)(void); \
const struct hftest_test __attribute__((used)) __attribute__( \
(section(HFTEST_TEST_SECTION(suite_name, test_name)))) \
@@ -111,6 +111,7 @@
.suite = #suite_name, \
.kind = HFTEST_KIND_TEST, \
.name = #test_name, \
+ .is_long_running = long_running, \
.fn = HFTEST_TEST_FN(suite_name, test_name), \
}; \
static void __attribute__((constructor)) \
@@ -166,6 +167,7 @@
const char *suite;
enum hftest_kind kind;
const char *name;
+ bool is_long_running;
hftest_test_fn fn;
};