Re: [igt-dev] [PATCH v3] runner: add --list-all and --blacklist

Petri Latvala
2019-06-18T08:11:32Z

On Mon, Jun 17, 2019 at 04:41:33PM +0300, Oleg Vasilev wrote:
> Currently, runner already collects all subtest names into job_list.
> --list-all allows to output it to stdout.
>
> --blacklist option takes a filename as an argument and adds all regexes
> from that file to the exclusion list.
>
> v2:
> - Update exclude/include regex matches for tests without
> subtests to be matched with pigtit-like name (Petri)
> - Replace relative paths with those formatted with testdatadir (Petri)
> - Minor codestyle changes
>
> v3:
> - Print test names in lowercase (Petri)
>
> Cc: Petri Latvala <petri.latvala@intel.com>
> Signed-off-by: Oleg Vasilev <oleg.vasilev@intel.com>
> ---
> runner/job_list.c | 36 ++++++++-
> runner/job_list.h | 1 +
> runner/runner.c | 5 ++
> runner/runner_tests.c | 18 ++++-
> runner/settings.c | 117 +++++++++++++++++++++++-----
> runner/settings.h | 1 +
> runner/testdata/meson.build | 5 ++
> runner/testdata/test-blacklist.txt | 2 +
> runner/testdata/test-blacklist2.txt | 2 +
> 9 files changed, 163 insertions(+), 24 deletions(-)
> create mode 100644 runner/testdata/test-blacklist.txt
> create mode 100644 runner/testdata/test-blacklist2.txt
>
> diff --git a/runner/job_list.c b/runner/job_list.c
> index 4a16742f..8e5233f5 100644
> --- a/runner/job_list.c
> +++ b/runner/job_list.c
> @@ -111,11 +111,16 @@ static void add_subtests(struct job_list *job_list, struct settings *settings,
> fprintf(stderr, "popen error when executing %s: %s\n", binary, strerror(errno));
> } else if (WIFEXITED(s)) {
> if (WEXITSTATUS(s) == IGT_EXIT_INVALID) {
> + char piglitname[256];
> + generate_piglit_name(binary, NULL,
> + piglitname, sizeof(piglitname));
> +
> /* No subtests on this one */
> - if (exclude && exclude->size && matches_any(binary, exclude)) {
> + if (exclude && exclude->size &&
> + matches_any(piglitname, exclude)) {
> return;
> }
> - if (!include || !include->size || matches_any(binary, include)) {
> + if (!include || !include->size || matches_any(piglitname, include)) {
> add_job_list_entry(job_list, strdup(binary), NULL, 0);
> return;
> }
> @@ -291,6 +296,33 @@ static bool job_list_from_test_list(struct job_list *job_list,
> return any;
> }
>
> +void str_to_lower(char* str)
> +{
> + for (int i = 0; str[i]; i++) {
> + str[i] = tolower(str[i]);
> + }
> +}
> +
> +void list_all_tests(struct job_list* lst)
> +{
> + for (size_t test_idx = 0; test_idx < lst->size; ++test_idx){
> + struct job_list_entry* current_entry = lst->entries+test_idx;
> + str_to_lower(current_entry->binary);
> + if (current_entry->subtest_count==0) {
> + printf("igt@%s\n", current_entry->binary);
> + continue;
> + }
> + for (size_t subtest_idx = 0;
> + subtest_idx < current_entry->subtest_count;
> + ++subtest_idx) {
> + char *subtest_name = current_entry->subtests[subtest_idx];
> + str_to_lower(subtest_name);
> + printf("igt@%s@%s\n", current_entry->binary, subtest_name);
> + }
> + }
> +}
> +
> +
> static char *lowercase(const char *str)
> {

There's a lowercasing helper function already, right here.

--
Petri Latvala