From: Nick Alcock Date: Fri, 25 Apr 2025 20:48:22 +0000 (+0100) Subject: libctf: run_lookup_test: support per-test options X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0ad8ddc8b49d8312cfea2b663a7bf86a20a006fd;p=thirdparty%2Fbinutils-gdb.git libctf: run_lookup_test: support per-test options 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. --- diff --git a/libctf/testsuite/lib/ctf-lib.exp b/libctf/testsuite/lib/ctf-lib.exp index 64d2a40ad9f..6adfd78d08d 100644 --- a/libctf/testsuite/lib/ctf-lib.exp +++ b/libctf/testsuite/lib/ctf-lib.exp @@ -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 } {