Skip to content

Commit b9aaa61

Browse files
powerboat9P-E-P
authored andcommitted
nr2.0: Improve test script
gcc/testsuite/ChangeLog: * rust/compile/nr2/compile.exp: Avoid absolute paths in output, adjust phrasing of output, and avoid false XPASS output when tests are run in parallel. Signed-off-by: Owen Avery <[email protected]>
1 parent ea91cee commit b9aaa61

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

gcc/testsuite/rust/compile/nr2/compile.exp

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,22 @@ namespace eval rust-nr2-ns {
4747
set tests_expect_ok ""
4848
set tests_expect_err ""
4949

50+
set compile_dir [list {*}[file split $srcdir] {*}[file split $subdir]]
51+
set compile_dir [lreplace $compile_dir end end]
52+
5053
foreach test_dir $test_dirs {
51-
set directory [list {*}[file split $srcdir] {*}[file split $subdir]]
52-
set directory [lreplace $directory end end]
53-
set directory [list {*}$directory {*}$test_dir]
54-
foreach test [lsort [glob -nocomplain -tails -directory [file join {*}$directory] *.rs]] {
54+
foreach test [lsort [glob -nocomplain -tails -directory [file join {*}$compile_dir {*}$test_dir] *.rs]] {
5555
# use '/' as the path seperator for entries in the exclude file
5656
set test_lbl [join [list {*}$test_dir $test] "/"]
5757
set idx [lsearch -exact -sorted $exclude $test_lbl]
5858
if {$idx == -1} {
59-
lappend tests_expect_ok [file join {*}$directory $test]
59+
if {[runtest_file_p $runtests [file join {*}$compile_dir {*}$test_dir $test]]} {
60+
lappend tests_expect_ok [list {*}$test_dir $test]
61+
}
6062
} else {
61-
lappend tests_expect_err [file join {*}$directory $test]
63+
if {[runtest_file_p $runtests [file join {*}$compile_dir {*}$test_dir $test]]} {
64+
lappend tests_expect_err [list {*}$test_dir $test]
65+
}
6266
set exclude [lreplace $exclude $idx $idx]
6367
}
6468
}
@@ -83,10 +87,10 @@ namespace eval rust-nr2-ns {
8387
variable record_test_out
8488
switch $type {
8589
FAIL {
86-
lappend record_test_out "$type: $msg"
90+
lappend record_test_out [list $type $msg]
8791
}
8892
XPASS {
89-
lappend record_test_out "$type: $msg"
93+
lappend record_test_out [list $type $msg]
9094
}
9195
}
9296
}
@@ -109,23 +113,23 @@ namespace eval rust-nr2-ns {
109113

110114
# check for unexpected failures
111115
foreach test $tests_expect_ok {
112-
set fails [try_test $test]
116+
set fails [try_test [file join {*}$compile_dir {*}$test]]
113117
if {[llength $fails] != 0} {
114118
foreach ent $fails {
115-
record_test FAIL "$test: nr2 failure: $ent"
119+
record_test [lindex $ent 0] "on nr2: [lindex $ent 1]"
116120
}
117121
} else {
118-
record_test PASS "$test: nr2 success"
122+
record_test PASS "[file join {*}$test] on nr2"
119123
}
120124
}
121125

122126
#check for unexpected successes
123127
foreach test $tests_expect_err {
124-
set fails [try_test $test]
128+
set fails [try_test [file join {*}$compile_dir {*}$test]]
125129
if {[llength $fails] == 0} {
126-
record_test XPASS "$test: nr2 unexpectedly passed"
130+
record_test XPASS "[file join {*}$test] on nr2"
127131
} else {
128-
record_test XFAIL "$test: nr2 was rightfully excluded"
132+
record_test XFAIL "[file join {*}$test] on nr2 was rightfully excluded"
129133
}
130134
}
131135
}

0 commit comments

Comments
 (0)