aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/lib')
-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.exp20
4 files changed, 130 insertions, 20 deletions
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 2a3bdd2..ee4138a 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.
@@ -11018,9 +11018,9 @@ proc check_effective_target_apxf { } {
} "-mapxf" ]
}
-# Return 1 if avx10.2-256 instructions can be compiled.
-proc check_effective_target_avx10_2_256 { } {
- return [check_no_compiler_messages avx10.2-256 object {
+# Return 1 if avx10.2 instructions can be compiled.
+proc check_effective_target_avx10_2 { } {
+ return [check_no_compiler_messages avx10.2 object {
void
foo ()
{
@@ -11029,16 +11029,6 @@ proc check_effective_target_avx10_2_256 { } {
__asm__ volatile ("vaddbf16\t%ymm4, %ymm5, %ymm6");
__asm__ volatile ("vcvtph2ibs\t%ymm5, %ymm6");
__asm__ volatile ("vminmaxpd\t$123, %ymm4, %ymm5, %ymm6");
- }
- } "" ]
-}
-
-# Return 1 if avx10.2-512 instructions can be compiled.
-proc check_effective_target_avx10_2_512 { } {
- return [check_no_compiler_messages avx10.2-512 object {
- void
- foo ()
- {
__asm__ volatile ("vdpphps\t%zmm4, %zmm5, %zmm6");
__asm__ volatile ("vcvthf82ph\t%ymm5, %zmm6");
__asm__ volatile ("vaddbf16\t%zmm4, %zmm5, %zmm6");
@@ -13514,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" ]
}
}