summaryrefslogtreecommitdiff
path: root/src/libstrongswan/tests/test_runner.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2016-07-16 15:19:53 +0200
committerYves-Alexis Perez <corsac@debian.org>2016-07-16 15:19:53 +0200
commitbf372706c469764d59e9f29c39e3ecbebd72b8d2 (patch)
tree0f0e296e2d50e4a7faf99ae6fa428d2681e81ea1 /src/libstrongswan/tests/test_runner.c
parent518dd33c94e041db0444c7d1f33da363bb8e3faf (diff)
downloadvyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.tar.gz
vyos-strongswan-bf372706c469764d59e9f29c39e3ecbebd72b8d2.zip
Imported Upstream version 5.5.0
Diffstat (limited to 'src/libstrongswan/tests/test_runner.c')
-rw-r--r--src/libstrongswan/tests/test_runner.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/libstrongswan/tests/test_runner.c b/src/libstrongswan/tests/test_runner.c
index 66d0e612d..ed77b3c86 100644
--- a/src/libstrongswan/tests/test_runner.c
+++ b/src/libstrongswan/tests/test_runner.c
@@ -90,6 +90,28 @@ static void apply_filter(array_t *loaded, char *filter, bool exclude)
}
/**
+ * Check if the given string is contained in the filter string.
+ */
+static bool is_in_filter(const char *find, char *filter)
+{
+ enumerator_t *names;
+ bool found = FALSE;
+ char *name;
+
+ names = enumerator_create_token(filter, ",", " ");
+ while (names->enumerate(names, &name))
+ {
+ if (streq(name, find))
+ {
+ found = TRUE;
+ break;
+ }
+ }
+ names->destroy(names);
+ return found;
+}
+
+/**
* Removes and destroys test suites that are not selected or
* explicitly excluded.
*/
@@ -524,11 +546,17 @@ int test_runner_run(const char *name, test_configuration_t configs[],
enumerator_t *enumerator;
int passed = 0, result;
level_t level = LEVEL_SILENT;
- char *cfg, *verbosity;
+ char *cfg, *runners, *verbosity;
/* redirect all output to stderr (to redirect make's stdout to /dev/null) */
dup2(2, 1);
+ runners = getenv("TESTS_RUNNERS");
+ if (runners && !is_in_filter(name, runners))
+ {
+ return EXIT_SUCCESS;
+ }
+
cfg = getenv("TESTS_STRONGSWAN_CONF");
suites = load_suites(configs, init, cfg);