From 2d7309f6ec752d0c5269d2a728911d33a48895b8 Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Tue, 10 Nov 2020 21:16:51 -0600 Subject: Abstract linking test items in launcher testsuite --- ChangeLog | 7 +++++++ testsuite/launcher.all/command.exp | 16 ++++++---------- testsuite/lib/launcher.exp | 8 ++++++++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index f0a81c1..0a1c445 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-11-10 Jacob Bachmeyer + + * testsuite/lib/launcher.exp (link_dejagnu_launcher_test_item): + New procedure to collect existing repeated testsuite code. + * testsuite/launcher.all/command.exp: Establish testing + environment using link_dejagnu_launcher_test_item procedure. + 2020-11-09 Jacob Bachmeyer * aclocal.m4: Regenerate. diff --git a/testsuite/launcher.all/command.exp b/testsuite/launcher.all/command.exp index 9e21237..6c400f0 100644 --- a/testsuite/launcher.all/command.exp +++ b/testsuite/launcher.all/command.exp @@ -178,17 +178,13 @@ set tests { # This must be done at run-time in the build directory because symbolic # links are not allowed in GNU source tarballs. -catch { - file link -symbolic \ - [testsuite file -object -test command share dejagnu commands] \ - [testsuite file -source -test command commands] -} +link_dejagnu_launcher_test_item \ + [testsuite file -object -test command share dejagnu commands] \ + [testsuite file -source -test command commands] foreach alias_item $tests { - catch { - file link -symbolic \ - [testsuite file -object -test command bin [lindex $alias_item 0]] \ - $LAUNCHER - } + link_dejagnu_launcher_test_item \ + [testsuite file -object -test command bin [lindex $alias_item 0]] \ + $LAUNCHER } if { ![file exists \ [testsuite file -object -test command share dejagnu commands]] } { diff --git a/testsuite/lib/launcher.exp b/testsuite/lib/launcher.exp index 42dc144..84a392f 100644 --- a/testsuite/lib/launcher.exp +++ b/testsuite/lib/launcher.exp @@ -75,6 +75,14 @@ proc try_dejagnu_launcher { launcher test } { } } +proc link_dejagnu_launcher_test_item {link target} { + verbose -log "linking $link" + verbose -log " to $target" + if {[catch {file link -symbolic $link $target} err]} { + perror $err 0 + } +} + proc run_dejagnu_launcher_tests { launcher tests } { foreach test $tests { if { [lindex $test 0] == "#" } { -- cgit v1.1