aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/lib')
-rw-r--r--gcc/testsuite/lib/cobol.exp29
-rw-r--r--gcc/testsuite/lib/gcov.exp118
-rw-r--r--gcc/testsuite/lib/gfortran-dg.exp8
-rw-r--r--gcc/testsuite/lib/multiline.exp4
-rw-r--r--gcc/testsuite/lib/target-supports.exp16
5 files changed, 148 insertions, 27 deletions
diff --git a/gcc/testsuite/lib/cobol.exp b/gcc/testsuite/lib/cobol.exp
index cd88bcb..723989e 100644
--- a/gcc/testsuite/lib/cobol.exp
+++ b/gcc/testsuite/lib/cobol.exp
@@ -107,8 +107,11 @@ proc cobol_link_flags { paths } {
}
if { $gccpath != "" } {
+ if [file exists "${gccpath}/libgcobol/libgcobol.spec"] {
+ append flags "-B${gccpath}/libgcobol "
+ }
if [file exists "${gccpath}/libgcobol/libgcobol.a"] {
- append flags "-L${gccpath}/libgcobol"
+ append flags "-L${gccpath}/libgcobol "
}
if { [file exists "${gccpath}/libgcobol/.libs/libgcobol.a"] ||
[file exists "${gccpath}/libgobol/.libs/libgcobol.${shlib_ext}"] } {
@@ -119,6 +122,15 @@ proc cobol_link_flags { paths } {
}
append ld_library_path ":${gccpath}/libgcobol/.libs"
}
+ if { [file exists "${gccpath}/libquadmath/.libs/libquadmath.a"] ||
+ [file exists "${gccpath}/libquadmath/.libs/libquadmath.${shlib_ext}"] } {
+ if { $target_wants_B_option } {
+ append flags "-B${gccpath}/libquadmath/.libs "
+ } else {
+ append flags "-L${gccpath}/libquadmath/.libs "
+ }
+ append ld_library_path ":${gccpath}/libquadmath/.libs"
+ }
if { [file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"] ||
[file exists "${gccpath}/libstdc++-v3/src/.libs/libstdc++.${shlib_ext}"] } {
if { $target_wants_B_option } {
@@ -160,7 +172,6 @@ proc cobol_init { args } {
global gcc_warning_prefix
global gcc_error_prefix
global TEST_ALWAYS_FLAGS
- global cobol_init_set_COBOL_UNDER_TEST
# We set LC_ALL and LANG to C so that we get the same error messages as expected.
setenv LC_ALL C
@@ -176,24 +187,14 @@ proc cobol_init { args } {
setenv LANG C.ASCII
}
- # COBOL_UNDER_TEST as set below contains $specpath, which depends on
- # the used multilib config. Thus, its value may need to be reset;
- # that's tracked via gfortran_init_set_COBOL_UNDER_TEST.
- if { ![info exists COBOL_UNDER_TEST]
- || [info exists cobol_init_set_COBOL_UNDER_TEST] } then {
+ if ![info exists COBOL_UNDER_TEST] then {
if [info exists TOOL_EXECUTABLE] {
set COBOL_UNDER_TEST $TOOL_EXECUTABLE
} else {
if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } {
set COBOL_UNDER_TEST [transform gcobol]
} else {
- if [info exists TOOL_OPTIONS] {
- set specpath [get_multilibs ${TOOL_OPTIONS}]
- } else {
- set specpath [get_multilibs]
- }
- set cobol_init_set_COBOL_UNDER_TEST 1
- set COBOL_UNDER_TEST [findfile $base_dir/../../gcobol "$base_dir/../../gcobol -B$base_dir/../../ -B$specpath/libgcobol/.libs" [findfile $base_dir/gcobol "$base_dir/gcobol -B$base_dir/" [transform gcobol]]]
+ set COBOL_UNDER_TEST [findfile $base_dir/../../gcobol "$base_dir/../../gcobol -B$base_dir/../../" [findfile $base_dir/gcobol "$base_dir/gcobol -B$base_dir/" [transform gcobol]]]
}
}
}
diff --git a/gcc/testsuite/lib/gcov.exp b/gcc/testsuite/lib/gcov.exp
index c1aceec..ae42c39 100644
--- a/gcc/testsuite/lib/gcov.exp
+++ b/gcc/testsuite/lib/gcov.exp
@@ -537,6 +537,112 @@ proc verify-filters { testname testcase file expected unexpected } {
return [expr [llength $ex] + [llength $unex]]
}
+proc verify-prime-paths { testname testcase file } {
+ set failed 0
+ set fd [open $file r]
+
+ set expected_n -1
+ set expected_m -1
+ set recording 0
+ set expected ""
+
+ while { [gets $fd line] >= 0 } {
+ regexp "^\[^:\]+: *(\[0-9\]+):" "$line" all lineno
+ set prefix "$testname line $lineno"
+
+ if {[regexp "BEGIN *paths" $line]} {
+ set recording 1
+ set expected ""
+ set expected_covered ""
+ set expected_n -1
+ set expected_m -1
+ set seen ""
+ continue
+ }
+
+ if { $recording != 1 } {
+ continue
+ }
+
+ if [regexp {summary: *(\d+)/(\d+)} $line _ n m] {
+ set expected_n $n
+ set expected_m $m
+ }
+
+ if [regexp "expect: *(.*)" $line all ln] {
+ set cases ""
+ set ln [regsub -all {\s+} $ln " "]
+ foreach case [split $ln " "] {
+ lappend cases $case
+ }
+ lappend expected $cases
+ }
+
+ if [regexp "expect covered: *(.*)" $line all ln] {
+ set cases ""
+ set ln [regsub -all {\s+} $ln " "]
+ foreach case [split $ln " "] {
+ lappend cases $case
+ }
+ lappend expected_covered $cases
+ }
+
+ if [regexp "END" $line] {
+ if {$recording != 1} {
+ incr failed
+ fail "unexpected END at line $lineno, missing BEGIN"
+
+ # Abort the test if there is a mismatch, to avoid creating
+ # unecessary errors. At this point the test itself is broken.
+ break
+ }
+ set recording 0
+
+ if {[llength $expected] > 0} {
+ incr failed
+ fail "expected: '$expected'"
+ }
+
+ if {[llength $expected_covered] > 0} {
+ incr failed
+ fail "expected covered: '$expected_covered'"
+ }
+ }
+
+ if [regexp {paths covered (\d+) of (\d+)} $line _ n m] {
+ if { $n ne $expected_n || $m ne $expected_m } {
+ incr failed
+ fail "$prefix: expected $expected_n/$expected_m covered paths, was $n/$m"
+ }
+ }
+
+ if [regexp {path *\d+ not covered: lines (.*)} $line _ path] {
+ set pathl ""
+ foreach ln [split $path " "] {
+ if [regexp {\s*(.*)\s*} $ln _ key] {
+ lappend pathl $key
+ }
+ }
+ set i [lsearch $expected $pathl]
+ set expected [lreplace $expected $i $i]
+ }
+
+ if [regexp {path *\d+ covered: lines (.*)} $line _ path] {
+ set pathl ""
+ foreach ln [split $path " "] {
+ if [regexp {\s*(.*)\s*} $ln _ key] {
+ lappend pathl $key
+ }
+ }
+ set i [lsearch $expected_covered $pathl]
+ set expected_covered [lreplace $expected_covered $i $i]
+ }
+ }
+
+ close $fd
+ return $failed
+}
+
proc gcov-pytest-format-line { args } {
global subdir
@@ -610,6 +716,7 @@ proc run-gcov { args } {
set gcov_verify_calls 0
set gcov_verify_branches 0
set gcov_verify_conditions 0
+ set gcov_verify_prime_paths 0
set gcov_verify_lines 1
set gcov_verify_intermediate 0
set gcov_verify_filters 0
@@ -627,6 +734,8 @@ proc run-gcov { args } {
set gcov_verify_filters 1
set verify_filters_expected [lindex $a 1]
set verify_filters_unexpected [lindex $a 2]
+ } elseif { $a == "prime-paths" } {
+ set gcov_verify_prime_paths 1
} elseif { $a == "intermediate" } {
set gcov_verify_intermediate 1
set gcov_verify_calls 0
@@ -707,6 +816,11 @@ proc run-gcov { args } {
} else {
set cdfailed 0
}
+ if { $gcov_verify_prime_paths } {
+ set ppfailed [verify-prime-paths $testname $testcase $testcase.gcov]
+ } else {
+ set ppfailed 0
+ }
if { $gcov_verify_calls } {
set cfailed [verify-calls $testname $testcase $testcase.gcov]
} else {
@@ -726,12 +840,12 @@ proc run-gcov { args } {
# Report whether the gcov test passed or failed. If there were
# multiple failures then the message is a summary.
- set tfailed [expr $lfailed + $bfailed + $cdfailed + $cfailed + $ifailed + $ffailed]
+ set tfailed [expr $lfailed + $bfailed + $cdfailed + $ppfailed + $cfailed + $ifailed + $ffailed]
if { $xfailed } {
setup_xfail "*-*-*"
}
if { $tfailed > 0 } {
- fail "$testname gcov: $lfailed failures in line counts, $bfailed in branch percentages, $cdfailed in condition/decision, $cfailed in return percentages, $ifailed in intermediate format, $ffailed failed in filters"
+ fail "$testname gcov: $lfailed failures in line counts, $bfailed in branch percentages, $cdfailed in condition/decision, $ppfailed in prime-paths, $cfailed in return percentages, $ifailed in intermediate format, $ffailed failed in filters"
if { $xfailed } {
clean-gcov $testcase
}
diff --git a/gcc/testsuite/lib/gfortran-dg.exp b/gcc/testsuite/lib/gfortran-dg.exp
index a516bab..4abf2fe 100644
--- a/gcc/testsuite/lib/gfortran-dg.exp
+++ b/gcc/testsuite/lib/gfortran-dg.exp
@@ -149,7 +149,13 @@ proc gfortran-dg-runtest { testcases flags default-extra-flags } {
# look if this is dg-do run test, in which case
# we cycle through the option list, otherwise we don't
if [expr [search_for $test "dg-do run"]] {
- set option_list $torture_with_loops
+ if { [ expr [search_for $test "dg-options*\[ \t\"\{]-O"] ] \
+ || [ expr [search_for $test \
+ "dg-additional-options*\[ \t\"\{]-O"] ] } {
+ set option_list [list { -O } ]
+ } else {
+ set option_list $torture_with_loops
+ }
} else {
set option_list [list { -O } ]
}
diff --git a/gcc/testsuite/lib/multiline.exp b/gcc/testsuite/lib/multiline.exp
index 22b5e0e..08fd969 100644
--- a/gcc/testsuite/lib/multiline.exp
+++ b/gcc/testsuite/lib/multiline.exp
@@ -17,7 +17,7 @@
# Testing of multiline output
# We have pre-existing testcases like this:
-# |typedef struct _GMutex GMutex; // { dg-message "previously declared here"}
+# |typedef struct _GMutex GMutex; // { dg-message "previously declared here" }
# (using "|" here to indicate the start of a line),
# generating output like this:
# |gcc/testsuite/g++.dg/diagnostic/wrong-tag-1.C:4:16: note: 'struct _GMutex' was previously declared here
@@ -27,7 +27,7 @@
# To handle rich error-reporting, we want to be able to verify that we
# get output like this:
# |gcc/testsuite/g++.dg/diagnostic/wrong-tag-1.C:4:16: note: 'struct _GMutex' was previously declared here
-# | typedef struct _GMutex GMutex; // { dg-message "previously declared here"}
+# | typedef struct _GMutex GMutex; // { dg-message "previously declared here" }
# | ^~~~~~~
# where the compiler's first line of output is as before, but in
# which it then echoes the source lines, adding annotations.
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index e875e35..a62f459 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2078,7 +2078,7 @@ proc check_effective_target_riscv_zvfh { } {
# Return 1 if the target arch supports half float, 0 otherwise.
# Note, this differs from the test performed by
-# /* dg-skip-if "" { *-*-* } { "*" } { "-march=rv*zfh*" } */
+# /* { dg-skip-if "" { *-*-* } { "*" } { "-march=rv*zfh*" } } */
# in that it takes default behaviour into account.
# Cache the result.
@@ -13489,11 +13489,11 @@ proc check_effective_target_arm_v8_3a_bkey_directive { } {
# Return 1 if the target supports executing the Armv8.1-M Mainline Low
# Overhead Loop, 0 otherwise. The test is valid for ARM.
-proc check_effective_target_arm_v8_1_lob_ok { } {
+proc check_effective_target_arm_v8_1m_lob_hw { } {
if { ![check_effective_target_arm_cortex_m] } {
return 0;
} else {
- return [check_runtime arm_v8_1_lob_hw_available {
+ return [check_runtime arm_v8_1m_lob_hw_available {
int
main (void)
{ int i = 0;
@@ -13504,7 +13504,7 @@ proc check_effective_target_arm_v8_1_lob_ok { } {
asm goto ("le lr, %l0" : : : "lr" : loop);
return i != 10;
}
- } "-mcpu=unset -mcpu=unset -march=armv8.1-m.main -mthumb" ]
+ } "-mcpu=unset -march=armv8.1-m.main -mthumb" ]
}
}
@@ -13513,9 +13513,9 @@ proc check_effective_target_arm_v8_1_lob_ok { } {
# the Armv8.1-M Mainline Low Overhead Loop, 0 otherwise. The test is
# valid for ARM.
-proc check_effective_target_arm_thumb2_no_arm_v8_1_lob { } {
+proc check_effective_target_arm_thumb2_no_arm_v8_1m_lob { } {
if { [check_effective_target_arm_thumb2]
- && ![check_effective_target_arm_v8_1_lob_ok] } {
+ && ![check_effective_target_arm_v8_1m_lob_hw] } {
return 1
}
return 0
@@ -13525,9 +13525,9 @@ proc check_effective_target_arm_thumb2_no_arm_v8_1_lob { } {
# used and the target does not support executing the Armv8.1-M
# Mainline Low Overhead Loop, 0 otherwise. The test is valid for ARM.
-proc check_effective_target_arm_thumb2_ok_no_arm_v8_1_lob { } {
+proc check_effective_target_arm_thumb2_ok_no_arm_v8_1m_lob { } {
if { [check_effective_target_arm_thumb2_ok]
- && ![check_effective_target_arm_v8_1_lob_ok] } {
+ && ![check_effective_target_arm_v8_1m_lob_hw] } {
return 1
}
return 0