]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
libctf: run_lookup_test: support per-test options
authorNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 20:48:22 +0000 (21:48 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 20:48:22 +0000 (21:48 +0100)
This lets you say e.g.

    run_lookup_test [file rootname $ctf_test ] {link: on}

to turn on the {link: on} option for all tests, as if specified in every
test file.

libctf/testsuite/lib/ctf-lib.exp

index 64d2a40ad9f219b1956451714a4690c151fe316f..6adfd78d08d50780b83c10051333488355609b11 100644 (file)
@@ -118,11 +118,14 @@ proc compile_link_one_host_cc { src output additional_args } {
 #
 # Each option may occur at most once unless otherwise mentioned.
 #
+# Boolean options may also be passed as arguments to run_lookup_test:
+# one option per word: options with a trailing colon are turned off.
+#
 # After the option lines come regexp lines.  run_lookup_test calls
 # regexp_diff to compare the output of the lookup program against the
 # regexps in FILE.d.
 #
-proc run_lookup_test { name } {
+proc run_lookup_test { name args } {
     global CC_FOR_TARGET CFLAGS_FOR_TARGET LIBS TEST_CROSS
     global copyfile env runtests srcdir subdir verbose
 
@@ -175,6 +178,13 @@ proc run_lookup_test { name } {
        set opts($opt_name) [concat $opts($opt_name) $opt_val]
     }
 
+    foreach arg $args {
+       set opt_name [lindex [split $arg ":"] 0]
+       set opt_value [lindex [split $arg ":"] 1]
+
+       set opts($opt_name) [concat $opts($opt_name) $opt_val]
+    }
+
     if { [llength $opts(no_cross)] != 0
         && "$TEST_CROSS" eq "yes" } {
        untested "$file4log not tested when cross-compiling"
@@ -217,7 +227,7 @@ proc run_lookup_test { name } {
        return 0
     }
 
-    # Compile the inputs and posibly link them together.
+    # Compile the inputs and possibly link them together.
 
     set lookup_output ""
     if { [llength $opts(source)] > 0 } {