test-abidiff-exit: Fix the command line passed to abidiff
authorDodji Seketeli <dodji@redhat.com>
Wed, 26 Apr 2023 10:37:30 +0000 (12:37 +0200)
committerDodji Seketeli <dodji@redhat.com>
Wed, 26 Apr 2023 10:37:30 +0000 (12:37 +0200)
I noticed that the command line passed to abidiff in the
test-abidiff-exit.cc is getting bigger and bigger as the test runs.
This is because in the main loop that calls abidiff on each test, we
forget to reset the "headers directories" part of the command line
passed to abidiff.

Fixed thus.

* tests/test-abidiff-exit.cc (main): Reset the headers directories
passed to abidiff at each iteration.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
tests/test-abidiff-exit.cc

index dafd003621caf186b8036b0e1b16ba0e2c96d883..f7f1b0f99041459a0ad7c6058cd437b4b6d8ae04 100644 (file)
@@ -934,10 +934,19 @@ main()
        in_elfv1_path = source_dir_prefix + s->in_elfv1_path;
        in_elfv0_debug_dir = source_dir_prefix + s->in_elfv0_debug_dir;
        in_elfv1_debug_dir = source_dir_prefix + s->in_elfv1_debug_dir;
-       split_string(s->in_elfv0_headers_dirs, ",", in_elfv0_headers_dirs);
-       split_string(s->in_elfv1_headers_dirs, ",", in_elfv1_headers_dirs);
-       do_prefix_strings(in_elfv0_headers_dirs, source_dir_prefix);
-       do_prefix_strings(in_elfv1_headers_dirs, source_dir_prefix);
+       in_elfv0_headers_dirs.clear();
+       in_elfv1_headers_dirs.clear();
+       if (s->in_elfv0_headers_dirs && strcmp(s->in_elfv0_headers_dirs, ""))
+         {
+           split_string(s->in_elfv0_headers_dirs, ",", in_elfv0_headers_dirs);
+           do_prefix_strings(in_elfv0_headers_dirs, source_dir_prefix);
+         }
+
+       if (s->in_elfv1_headers_dirs && strcmp(s->in_elfv1_headers_dirs, ""))
+         {
+           split_string(s->in_elfv1_headers_dirs, ",", in_elfv1_headers_dirs);
+           do_prefix_strings(in_elfv1_headers_dirs, source_dir_prefix);
+         }
 
        if (s->in_suppr_path && strcmp(s->in_suppr_path, ""))
          in_suppression_path = source_dir_prefix + s->in_suppr_path;