1 From 49956f65bb53ea2a2c1b394e5e59ffdfcdcc490f Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= <anibal.limon@linaro.org>
3 Date: Wed, 25 Apr 2018 11:55:03 -0500
4 Subject: [PATCH 6/7] main.c: Add option (-e) to exclude certain tests for
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 You can specify a set of ptests to be excluded, it will not fail
11 if some ptest excluded isn't found in the list of execution.
13 $ ./ptest-runner -e "hang glibc" -d tests/data
15 Signed-off-by: Aníbal Limón <anibal.limon@linaro.org>
17 main.c | 38 +++++++++++++++++++++++++++++++++++---
19 2 files changed, 36 insertions(+), 3 deletions(-)
21 diff --git a/main.c b/main.c
22 index 593aff1a1956..83600b7d1b31 100644
26 * Aníbal Limón <anibal.limon@intel.com>
35 print_usage(FILE *stream, char *progname)
37 - fprintf(stream, "Usage: %s [-d directory] [-l list] [-t timeout] [-x xml-filename]"
38 - " [-h] [ptest1 ptest2 ...]\n", progname);
39 + fprintf(stream, "Usage: %s [-d directory] [-e exclude] [-l list] [-t timeout]"
40 + " [-x xml-filename] [-h] [ptest1 ptest2 ...]\n", progname);
44 @@ -53,6 +54,8 @@ main(int argc, char *argv[])
48 + int ptest_exclude_num = 0;
53 @@ -62,18 +65,44 @@ main(int argc, char *argv[])
54 struct ptest_options opts;
56 opts.directory = strdup(DEFAULT_DIRECTORY);
57 + opts.exclude = NULL;
59 opts.timeout = DEFAULT_TIMEOUT;
61 opts.xml_filename = NULL;
63 - while ((opt = getopt(argc, argv, "d:lt:x:h")) != -1) {
64 + while ((opt = getopt(argc, argv, "d:e:lt:x:h")) != -1) {
68 opts.directory = realpath(optarg, NULL);
69 CHECK_ALLOCATION(opts.directory, 1, 1);
73 + ptest_exclude_num = 1;
77 + ptest_exclude_num++;
82 + opts.exclude = malloc(ptest_exclude_num * sizeof(char));
83 + CHECK_ALLOCATION(opts.exclude, 1, 1);
86 + tok = strtok_r(optarg, " ", &c);
87 + opts.exclude[i] = strdup(tok);
88 + CHECK_ALLOCATION(opts.exclude[i], 1, 1);
90 + while ((tok = strtok_r(NULL, " ", &c)) != NULL) {
91 + opts.exclude[i] = strdup(tok);
92 + CHECK_ALLOCATION(opts.exclude[i], 1, 1);
99 @@ -134,6 +163,9 @@ main(int argc, char *argv[])
100 ptest_list_free_all(head);
103 + for (i = 0; i < ptest_exclude_num; i++)
104 + ptest_list_remove(run, opts.exclude[i], 1);
106 rc = run_ptests(run, opts, argv[0], stdout, stderr);
108 ptest_list_free_all(run);
109 diff --git a/utils.h b/utils.h
110 index 8fa20a8bf621..ee85163ddfff 100644
115 struct ptest_options {