aboutsummaryrefslogtreecommitdiff
path: root/libctf/testsuite
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2024-04-26 18:16:49 +0100
committerNick Alcock <nick.alcock@oracle.com>2024-05-17 12:58:18 +0100
commit8c59ec70063f697e2088ac58ba350fa6ea8d8680 (patch)
tree7f96f2703fca5863547bae7c2fcd91e67528c193 /libctf/testsuite
parente449709833b862c14b5665093b3d4cbd4cd275eb (diff)
downloadbinutils-8c59ec70063f697e2088ac58ba350fa6ea8d8680.zip
binutils-8c59ec70063f697e2088ac58ba350fa6ea8d8680.tar.gz
binutils-8c59ec70063f697e2088ac58ba350fa6ea8d8680.tar.bz2
libctf: test: add wrapper
This .lk option lets you run the lookup program via a wrapper executable. For example, to run under valgrind and check for leaks (albeit noisily because of the libtool shell script wrapper): libctf/ * testsuite/lib/ctf-lib.exp (run_lookup_test): Add wrapper.
Diffstat (limited to 'libctf/testsuite')
-rw-r--r--libctf/testsuite/lib/ctf-lib.exp13
1 files changed, 11 insertions, 2 deletions
diff --git a/libctf/testsuite/lib/ctf-lib.exp b/libctf/testsuite/lib/ctf-lib.exp
index c31573e..eb2b738 100644
--- a/libctf/testsuite/lib/ctf-lib.exp
+++ b/libctf/testsuite/lib/ctf-lib.exp
@@ -112,6 +112,10 @@ proc compile_link_one_host_cc { src output additional_args } {
# host:
# If set, only run this test on hosts matching the given glob.
#
+# wrapper:
+# Wrap invocations of LOOKUP in this command. (Useful for valgrind
+# invocations, etc.)
+#
# Each option may occur at most once unless otherwise mentioned.
#
# After the option lines come regexp lines. run_lookup_test calls
@@ -151,6 +155,7 @@ proc run_lookup_test { name } {
set opts(xfail) {}
set opts(no_cross) {}
set opts(host) {}
+ set opts(wrapper) {}
foreach i $opt_array {
set opt_name [lindex $i 0]
@@ -257,9 +262,13 @@ proc run_lookup_test { name } {
}
}
- # Invoke the lookup program on the outputs.
+ # Invoke the lookup program on the outputs, possibly through the wrapper.
- set results [run_host_cmd tmpdir/lookup $lookup_output]
+ if { [llength $opts(wrapper)] == 0 } {
+ set results [run_host_cmd tmpdir/lookup $lookup_output]
+ } else {
+ set results [run_host_cmd "$opts(wrapper) tmpdir/lookup" $lookup_output]
+ }
set f [open "tmpdir/lookup.out" "w"]
puts $f $results