From 982c6f2665bad6c8fec6ee75ffb3c5af60a285a6 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 21 Jul 2016 09:36:37 +0930 Subject: [PATCH] Use variable args in run_ld_link_exec_tests If the last parameter of a tcl function is "args" then it can take zero or more arguments. Make use of this language feature in run_ld_link_exec_tests. * testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Replace "targets_to_xfail" parameter with "args". * testsuite/ld-elf/compress.exp: Remove empty list of xfails on all calls to run_ld_link_exec_tests. * testsuite/ld-elf/dwarf.exp: Likewise. * testsuite/ld-elf/indirect.exp: Likewise. * testsuite/ld-elf/wrap.exp: Likewise. * testsuite/ld-i386/i386.exp: Likewise. * testsuite/ld-i386/no-plt.exp: Likewise. * testsuite/ld-i386/tls.exp: Likewise. * testsuite/ld-ifunc/ifunc.exp: Likewise. * testsuite/ld-pie/pie.exp: Likewise. * testsuite/ld-plugin/lto.exp: Likewise. * testsuite/ld-size/size.exp: Likewise. * testsuite/ld-x86-64/mpx.exp: Likewise. * testsuite/ld-x86-64/no-plt.exp: Likewise. * testsuite/ld-x86-64/tls.exp: Likewise. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-elf/elf.exp: Likewise. Reorder args when providing xfails and simplify lists. * testsuite/ld-elf/shared.exp: Likewise. --- ld/ChangeLog | 24 ++++++++++++++++++++++++ ld/testsuite/ld-elf/compress.exp | 2 +- ld/testsuite/ld-elf/dwarf.exp | 2 +- ld/testsuite/ld-elf/elf.exp | 12 ++++++------ ld/testsuite/ld-elf/indirect.exp | 2 +- ld/testsuite/ld-elf/shared.exp | 8 ++++---- ld/testsuite/ld-elf/wrap.exp | 2 +- ld/testsuite/ld-i386/i386.exp | 6 +++--- ld/testsuite/ld-i386/no-plt.exp | 4 ++-- ld/testsuite/ld-i386/tls.exp | 2 +- ld/testsuite/ld-ifunc/ifunc.exp | 6 +++--- ld/testsuite/ld-pie/pie.exp | 2 +- ld/testsuite/ld-plugin/lto.exp | 4 ++-- ld/testsuite/ld-size/size.exp | 2 +- ld/testsuite/ld-x86-64/mpx.exp | 2 +- ld/testsuite/ld-x86-64/no-plt.exp | 4 ++-- ld/testsuite/ld-x86-64/tls.exp | 2 +- ld/testsuite/ld-x86-64/x86-64.exp | 6 +++--- ld/testsuite/lib/ld-lib.exp | 6 +++--- 19 files changed, 61 insertions(+), 37 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index ad26f620156..291e6bda7e0 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,27 @@ +2016-07-21 Alan Modra + + * testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Replace + "targets_to_xfail" parameter with "args". + * testsuite/ld-elf/compress.exp: Remove empty list of xfails on + all calls to run_ld_link_exec_tests. + * testsuite/ld-elf/dwarf.exp: Likewise. + * testsuite/ld-elf/indirect.exp: Likewise. + * testsuite/ld-elf/wrap.exp: Likewise. + * testsuite/ld-i386/i386.exp: Likewise. + * testsuite/ld-i386/no-plt.exp: Likewise. + * testsuite/ld-i386/tls.exp: Likewise. + * testsuite/ld-ifunc/ifunc.exp: Likewise. + * testsuite/ld-pie/pie.exp: Likewise. + * testsuite/ld-plugin/lto.exp: Likewise. + * testsuite/ld-size/size.exp: Likewise. + * testsuite/ld-x86-64/mpx.exp: Likewise. + * testsuite/ld-x86-64/no-plt.exp: Likewise. + * testsuite/ld-x86-64/tls.exp: Likewise. + * testsuite/ld-x86-64/x86-64.exp: Likewise. + * testsuite/ld-elf/elf.exp: Likewise. Reorder args when providing + xfails and simplify lists. + * testsuite/ld-elf/shared.exp: Likewise. + 2016-07-21 Alan Modra * testsuite/lib/ld-lib.exp (run_ld_link_tests): Add optional diff --git a/ld/testsuite/ld-elf/compress.exp b/ld/testsuite/ld-elf/compress.exp index af1a76d0e6c..3d2378bbe72 100644 --- a/ld/testsuite/ld-elf/compress.exp +++ b/ld/testsuite/ld-elf/compress.exp @@ -112,7 +112,7 @@ set run_tests { } run_cc_link_tests $build_tests -run_ld_link_exec_tests [] $run_tests +run_ld_link_exec_tests $run_tests set test_name "Link with zlib-gabi compressed debug input" send_log "cmp tmpdir/libfoo.so tmpdir/libfoozlib.so\n" diff --git a/ld/testsuite/ld-elf/dwarf.exp b/ld/testsuite/ld-elf/dwarf.exp index 32a49230036..17a69237369 100644 --- a/ld/testsuite/ld-elf/dwarf.exp +++ b/ld/testsuite/ld-elf/dwarf.exp @@ -62,7 +62,7 @@ set run_tests { } run_cc_link_tests $build_tests -run_ld_link_exec_tests [] $run_tests +run_ld_link_exec_tests $run_tests proc strip_test {} { global ld diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp index b67105fa441..872e7f14f52 100644 --- a/ld/testsuite/ld-elf/elf.exp +++ b/ld/testsuite/ld-elf/elf.exp @@ -240,22 +240,22 @@ set array_tests_static { } # NetBSD ELF systems do not currently support the .*_array sections. -set xfails [list "*-*-netbsdelf*"] -run_ld_link_exec_tests $xfails $array_tests +set xfails "*-*-netbsdelf*" +run_ld_link_exec_tests $array_tests $xfails if { [istarget *-*-linux*] || [istarget *-*-nacl*] || [istarget *-*-gnu*] } { - run_ld_link_exec_tests $xfails $array_tests_pie + run_ld_link_exec_tests $array_tests_pie $xfails } +# # Be cautious to not XFAIL for *-*-linux-gnu*, *-*-kfreebsd-gnu*, etc. switch -regexp $target_triplet { ^\[^-\]*-\[^-\]*-gnu.*$ { - # - lappend xfails "*-*-*" + set xfails "*-*-*" } } -run_ld_link_exec_tests $xfails $array_tests_static +run_ld_link_exec_tests $array_tests_static $xfails catch "exec rm -f tmpdir/preinit tmpdir/init tmpdir/fini tmpdir/init-mixed" status diff --git a/ld/testsuite/ld-elf/indirect.exp b/ld/testsuite/ld-elf/indirect.exp index 1a012796541..b4766fd8f87 100644 --- a/ld/testsuite/ld-elf/indirect.exp +++ b/ld/testsuite/ld-elf/indirect.exp @@ -179,4 +179,4 @@ set run_tests { {pr19553a.c} "pr19553d" "pr19553d.out"} } -run_ld_link_exec_tests [] $run_tests +run_ld_link_exec_tests $run_tests diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index ac782f8b081..f3b6f18a09c 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -435,7 +435,7 @@ set run_tests { } # NetBSD ELF systems do not currently support the .*_array sections. -run_ld_link_exec_tests [list "*-*-netbsdelf*"] $run_tests +run_ld_link_exec_tests $run_tests "*-*-netbsdelf*" # Check --no-add-needed and --no-copy-dt-needed-entries set testname "--no-add-needed" @@ -510,7 +510,7 @@ set run_cxx_tests { } run_cc_link_tests $build_cxx_tests -run_ld_link_exec_tests [] $run_cxx_tests +run_ld_link_exec_tests $run_cxx_tests if { [istarget *-*-linux*] || [istarget *-*-nacl*] @@ -540,7 +540,7 @@ if { [istarget *-*-linux*] "libpr19579.so" \ ] \ ] - run_ld_link_exec_tests [] [list \ + run_ld_link_exec_tests [list \ [list \ "Run pr2404 with PIE" \ "-pie tmpdir/pr2404b.o tmpdir/libpr2404a.so" \ @@ -638,7 +638,7 @@ proc mix_pic_and_non_pic {xfails cflags ldflags exe} { send_log "cp tmpdir/libpr19719b.so tmpdir/libpr19719.so\n" exec cp tmpdir/libpr19719b.so tmpdir/libpr19719.so - run_ld_link_exec_tests [] [list \ + run_ld_link_exec_tests [list \ [list \ "Run $exe fun defined" \ "$ldflags tmpdir/libpr19719b.o tmpdir/libpr19719.so -rpath tmpdir" \ diff --git a/ld/testsuite/ld-elf/wrap.exp b/ld/testsuite/ld-elf/wrap.exp index ea4e1d1ec58..55dcf3e4b8c 100644 --- a/ld/testsuite/ld-elf/wrap.exp +++ b/ld/testsuite/ld-elf/wrap.exp @@ -54,4 +54,4 @@ set run_tests { } run_cc_link_tests $build_tests -run_ld_link_exec_tests [] $run_tests +run_ld_link_exec_tests $run_tests diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 9efe406b9b5..2ba0f054d9c 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -468,7 +468,7 @@ proc undefined_weak {cflags ldflags} { exec cp tmpdir/libpr19704a.so tmpdir/libpr19704.so - run_ld_link_exec_tests [] [list \ + run_ld_link_exec_tests [list \ [list \ "Run pr19704" \ "$ldflags tmpdir/libpr19704.so -R tmpdir" \ @@ -734,7 +734,7 @@ if { [isnative] ] \ ] - run_ld_link_exec_tests [] [list \ + run_ld_link_exec_tests [list \ [list \ "Run plt-main" \ "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ @@ -833,7 +833,7 @@ if { [isnative] ] \ ] - run_ld_link_exec_tests [] [list \ + run_ld_link_exec_tests [list \ [list \ "Run ifunc-1a" \ "tmpdir/ifunc-1a.o tmpdir/ifunc-1b.o \ diff --git a/ld/testsuite/ld-i386/no-plt.exp b/ld/testsuite/ld-i386/no-plt.exp index 377253ce3b4..1a7fe7e37ea 100644 --- a/ld/testsuite/ld-i386/no-plt.exp +++ b/ld/testsuite/ld-i386/no-plt.exp @@ -163,7 +163,7 @@ run_cc_link_tests [list \ ] \ ] -run_ld_link_exec_tests [] [list \ +run_ld_link_exec_tests [list \ [list \ "No PLT (dynamic 1a)" \ "tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \ @@ -288,7 +288,7 @@ if { [check_ifunc_available] } { ] \ ] - run_ld_link_exec_tests [] [list \ + run_ld_link_exec_tests [list \ [list \ "Run pr20244-3a" \ "tmpdir/pr20244-3a.o tmpdir/pr20244-3b.o \ diff --git a/ld/testsuite/ld-i386/tls.exp b/ld/testsuite/ld-i386/tls.exp index 593c0e80164..4c14a937419 100644 --- a/ld/testsuite/ld-i386/tls.exp +++ b/ld/testsuite/ld-i386/tls.exp @@ -67,7 +67,7 @@ run_cc_link_tests [list \ ] \ ] -run_ld_link_exec_tests [] [list \ +run_ld_link_exec_tests [list \ [list \ "TLS GD/LD -> LE transition without PLT (dynamic)" \ "tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \ diff --git a/ld/testsuite/ld-ifunc/ifunc.exp b/ld/testsuite/ld-ifunc/ifunc.exp index e860f36d87c..c3c9379cc48 100644 --- a/ld/testsuite/ld-ifunc/ifunc.exp +++ b/ld/testsuite/ld-ifunc/ifunc.exp @@ -386,7 +386,7 @@ run_cc_link_tests [list \ ] \ ] -run_ld_link_exec_tests [] [list \ +run_ld_link_exec_tests [list \ [list \ "Common symbol override ifunc test 1a" \ "-static" \ @@ -430,7 +430,7 @@ run_cc_link_tests [list \ ] \ ] -run_ld_link_exec_tests [] [list \ +run_ld_link_exec_tests [list \ [list \ "Run pr16467" \ "tmpdir/pr16467c.o tmpdir/libpr16467b.so tmpdir/libpr16467a.so" \ @@ -531,7 +531,7 @@ run_cc_link_tests [list \ ] \ ] -run_ld_link_exec_tests [] [list \ +run_ld_link_exec_tests [list \ [list \ "Run pr18808" \ "tmpdir/pr18808a.o tmpdir/libpr18808.so" \ diff --git a/ld/testsuite/ld-pie/pie.exp b/ld/testsuite/ld-pie/pie.exp index 834d5ee76ad..3495da50343 100644 --- a/ld/testsuite/ld-pie/pie.exp +++ b/ld/testsuite/ld-pie/pie.exp @@ -41,7 +41,7 @@ set array_tests { {"weak undefined data" "-pie" "" {weakundef-data.c} "weakundef-data" "weakundef.out" "-fPIC"} } -run_ld_link_exec_tests [] $array_tests +run_ld_link_exec_tests $array_tests set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] foreach t $test_list { diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index 4ed163ea466..29f211712e6 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -481,10 +481,10 @@ if ![isnative] { return } -run_ld_link_exec_tests [] $lto_run_tests +run_ld_link_exec_tests $lto_run_tests if { [is_elf_format] } { - run_ld_link_exec_tests [] $lto_run_elf_tests + run_ld_link_exec_tests $lto_run_elf_tests } proc pr20103 {cflags libs} { diff --git a/ld/testsuite/ld-size/size.exp b/ld/testsuite/ld-size/size.exp index 949f563885b..cc21a3f7b5c 100644 --- a/ld/testsuite/ld-size/size.exp +++ b/ld/testsuite/ld-size/size.exp @@ -176,7 +176,7 @@ if { [regexp_diff "tmpdir/dump.out" "$srcdir/$subdir/size-7.out" ] } then { } # Run-time size relocation tests. -run_ld_link_exec_tests [] [list \ +run_ld_link_exec_tests [list \ [list \ "Run size-1" \ "tmpdir/libsize-1.so" \ diff --git a/ld/testsuite/ld-x86-64/mpx.exp b/ld/testsuite/ld-x86-64/mpx.exp index 72be4af82c6..493e7a6afcb 100644 --- a/ld/testsuite/ld-x86-64/mpx.exp +++ b/ld/testsuite/ld-x86-64/mpx.exp @@ -120,7 +120,7 @@ run_ld_link_tests { {mpx4a.s} {{objdump -dw mpx4.dd}} "mpx4"} } -run_ld_link_exec_tests [] $run_tests +run_ld_link_exec_tests $run_tests run_dump_test "bnd-branch-1" run_dump_test "bnd-ifunc-1" diff --git a/ld/testsuite/ld-x86-64/no-plt.exp b/ld/testsuite/ld-x86-64/no-plt.exp index bdf1843d52f..e7ab81339d8 100644 --- a/ld/testsuite/ld-x86-64/no-plt.exp +++ b/ld/testsuite/ld-x86-64/no-plt.exp @@ -134,7 +134,7 @@ run_cc_link_tests [list \ ] \ ] -run_ld_link_exec_tests [] [list \ +run_ld_link_exec_tests [list \ [list \ "No PLT (dynamic 1a)" \ "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \ @@ -220,7 +220,7 @@ if { [check_ifunc_available] } { ] \ ] - run_ld_link_exec_tests [] [list \ + run_ld_link_exec_tests [list \ [list \ "Run pr20253-2a" \ "tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \ diff --git a/ld/testsuite/ld-x86-64/tls.exp b/ld/testsuite/ld-x86-64/tls.exp index c5a70dc03c7..0988179d10e 100644 --- a/ld/testsuite/ld-x86-64/tls.exp +++ b/ld/testsuite/ld-x86-64/tls.exp @@ -67,7 +67,7 @@ run_cc_link_tests [list \ ] \ ] -run_ld_link_exec_tests [] [list \ +run_ld_link_exec_tests [list \ [list \ "TLS GD/LD -> LE transition without PLT (dynamic)" \ "tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \ diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index f6f89e2aadb..5fa4c9f2da9 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -559,7 +559,7 @@ proc undefined_weak {cflags ldflags} { exec cp tmpdir/libpr19704a.so tmpdir/libpr19704.so - run_ld_link_exec_tests [] [list \ + run_ld_link_exec_tests [list \ [list \ "Run pr19704" \ "$ldflags tmpdir/libpr19704.so -R tmpdir" \ @@ -824,7 +824,7 @@ if { [isnative] && [which $CC] != 0 } { ] \ ] - run_ld_link_exec_tests [] [list \ + run_ld_link_exec_tests [list \ [list \ "Run plt-main" \ "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ @@ -918,7 +918,7 @@ if { [isnative] && [which $CC] != 0 } { ] \ ] - run_ld_link_exec_tests [] [list \ + run_ld_link_exec_tests [list \ [list \ "Run plt-main with -z bndplt" \ "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \ diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 9cd1959fa1e..cd9e930cab9 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -1367,7 +1367,6 @@ if ![string length [info proc prune_warnings]] { } } -# targets_to_xfail is a list of target triplets to be xfailed. # ldtests contains test-items with 3 items followed by 1 lists, 2 items # and 3 optional items: # 0:name @@ -1379,8 +1378,9 @@ if ![string length [info proc prune_warnings]] { # 6:compiler flags (optional) # 7:language (optional) # 8:linker warning (optional) +# args is an optional list of target triplets to be xfailed. -proc run_ld_link_exec_tests { targets_to_xfail ldtests } { +proc run_ld_link_exec_tests { ldtests args } { global ld global as global srcdir @@ -1394,7 +1394,7 @@ proc run_ld_link_exec_tests { targets_to_xfail ldtests } { global exec_output foreach testitem $ldtests { - foreach target $targets_to_xfail { + foreach target $args { setup_xfail $target } set testname [lindex $testitem 0] -- 2.30.2