diff options
Diffstat (limited to 'gcc/testsuite/lib/scantree.exp')
-rw-r--r-- | gcc/testsuite/lib/scantree.exp | 63 |
1 files changed, 58 insertions, 5 deletions
diff --git a/gcc/testsuite/lib/scantree.exp b/gcc/testsuite/lib/scantree.exp index 76d1a59fb60..085faa92f57 100644 --- a/gcc/testsuite/lib/scantree.exp +++ b/gcc/testsuite/lib/scantree.exp @@ -19,6 +19,54 @@ # # This is largely borrowed from scanasm.exp. +# APPLE LOCAL begin lno +# Utility for diffing compiler result against an expected output file. +# Invoked via dg-final. Call pass if there are no differences between +# the output of the compiler and the expected output file, otherwise +# fail. The expected output file has the same name as the output +# file, and is stored in the same directory as the testcase. +# +# Argument 0 is the suffix for the tree dump file +# Argument 1 handles expected failures and the like +proc diff-tree-dumps { args } { + if { [llength $args] < 1 } { + error "diff-tree-dumps: too few arguments" + return + } + if { [llength $args] > 2 } { + error "diff-tree-dumps:: too many arguments" + return + } + if { [llength $args] >= 2 } { + switch [dg-process-target [lindex $args 1]] { + "S" { } + "N" { return } + "F" { setup_xfail "*-*-*" } + "P" { } + } + } + + # This assumes that we are two frames down from dg-test, and that + # it still stores the filename of the testcase in a local variable "name". + # A cleaner solution would require a new dejagnu release. + upvar 2 prog testcase + + # This must match the rule in gcc-dg.exp. + # APPLE LOCAL <rdar://problem/3837835> Selective inlining of functions that use Altivec + set new_file "[glob [file tail $testcase].\[ti\]??.[lindex $args 0]]" + set reference_file "[glob $testcase.[lindex $args 0]]" + + set test_result [diff $reference_file $new_file] + + if { $test_result == 1 } { + pass "$testcase diff-tree-dumps [lindex $args 0]" + } else { + fail "$testcase diff-tree-dumps [lindex $args 0]" + local_exec (diff $reference_file $new_file 0); + } +} +# APPLE LOCAL end lno + # Utility for scanning compiler result, invoked via dg-final. # Call pass if pattern is present, otherwise fail. # @@ -49,7 +97,8 @@ proc scan-tree-dump { args } { upvar 2 name testcase # This must match the rule in gcc-dg.exp. - set output_file "[glob [file tail $testcase].t??.[lindex $args 1]]" + # APPLE LOCAL <rdar://problem/3837835> Selective inlining of functions that use Altivec + set output_file "[glob [file tail $testcase].\[ti\]??.[lindex $args 1]]" set fd [open $output_file r] set text [read $fd] @@ -91,7 +140,8 @@ proc scan-tree-dump-times { args } { upvar 2 name testcase # This must match the rule in gcc-dg.exp. - set output_file "[glob [file tail $testcase].t??.[lindex $args 2]]" + # APPLE LOCAL <rdar://problem/3837835> Selective inlining of functions that use Altivec + set output_file "[glob [file tail $testcase].\[ti\]??.[lindex $args 2]]" set fd [open $output_file r] set text [read $fd] @@ -128,7 +178,8 @@ proc scan-tree-dump-not { args } { } upvar 2 name testcase - set output_file "[glob [file tail $testcase].t??.[lindex $args 1]]" + # APPLE LOCAL <rdar://problem/3837835> Selective inlining of functions that use Altivec + set output_file "[glob [file tail $testcase].\[ti\]??.[lindex $args 1]]" set fd [open $output_file r] set text [read $fd] @@ -179,7 +230,8 @@ proc scan-tree-dump-dem { args } { } upvar 2 name testcase - set output_file "[glob [file tail $testcase].t??.[lindex $args 1]]" + # APPLE LOCAL <rdar://problem/3837835> Selective inlining of functions that use Altivec + set output_file "[glob [file tail $testcase].\[ti\]??.[lindex $args 1]]" set fd [open "| $cxxfilt < $output_file" r] set text [read $fd] @@ -229,7 +281,8 @@ proc scan-tree-dump-dem-not { args } { } upvar 2 name testcase - set output_file "[glob [file tail $testcase].t??.[lindex $args 1]]" + # APPLE LOCAL <rdar://problem/3837835> Selective inlining of functions that use Altivec + set output_file "[glob [file tail $testcase].\[ti\]??.[lindex $args 1]]" set fd [open "| $cxxfilt < $output_file" r] set text [read $fd] |