diff options
author | Marius Bakke <marius@devup.no> | 2020-08-01 18:02:21 +0200 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2021-01-07 19:44:20 -0800 |
commit | b5683f45d9f4a640c120b579f05b2ee024790f56 (patch) | |
tree | c3c8cd3c18b592f6b7a4cd3dd1e98d5ba53ab029 /testsuite | |
parent | 1ccfe994287119cc6cef37a7ca4c529d89de4b95 (diff) | |
download | kmod-b5683f45d9f4a640c120b579f05b2ee024790f56.tar.gz kmod-b5683f45d9f4a640c120b579f05b2ee024790f56.tar.bz2 kmod-b5683f45d9f4a640c120b579f05b2ee024790f56.zip |
testsuite: Add facility to skip tests.
The Makefile helpfully warns that some tests will fail when
--sysconfdir != /etc, but there are no provisions to easily disable
those. This commit provides an escape hatch.
[ Lucas: add comment detailing the purpose of the field ]
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/testsuite.c | 9 | ||||
-rw-r--r-- | testsuite/testsuite.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c index e46f3d8..05df553 100644 --- a/testsuite/testsuite.c +++ b/testsuite/testsuite.c @@ -37,6 +37,7 @@ #include "testsuite.h" static const char *ANSI_HIGHLIGHT_GREEN_ON = "\x1B[1;32m"; +static const char *ANSI_HIGHLIGHT_YELLOW_ON = "\x1B[1;33m"; static const char *ANSI_HIGHLIGHT_RED_ON = "\x1B[1;31m"; static const char *ANSI_HIGHLIGHT_OFF = "\x1B[0m"; @@ -948,6 +949,14 @@ static inline int test_run_parent(const struct test *t, int fdout[2], int err; bool matchout, match_modules; + if (t->skip) { + LOG("%sSKIPPED%s: %s\n", + ANSI_HIGHLIGHT_YELLOW_ON, ANSI_HIGHLIGHT_OFF, + t->name); + err = EXIT_SUCCESS; + goto exit; + } + /* Close write-fds */ if (t->output.out != NULL) close(fdout[1]); diff --git a/testsuite/testsuite.h b/testsuite/testsuite.h index f190249..c74b648 100644 --- a/testsuite/testsuite.h +++ b/testsuite/testsuite.h @@ -109,6 +109,8 @@ struct test { const struct keyval *env_vars; bool need_spawn; bool expected_fail; + /* allow to skip tests that don't meet compile-time dependencies */ + bool skip; bool print_outputs; } __attribute__((aligned(8))); |