OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [lib/] [dg-pch.exp] - Blame information for rev 701

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 701 jeremybenn
# Copyright (C) 2003, 2007, 2008, 2010 Free Software Foundation, Inc.
2
 
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 3 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with GCC; see the file COPYING3.  If not see
15
# .
16
 
17
load_lib copy-file.exp
18
 
19
proc dg-flags-pch { subdir test otherflags options suffix } {
20
    global runtests dg-do-what-default
21
 
22
    # If we're only testing specific files and this isn't one of them, skip it.
23
    if ![runtest_file_p $runtests $test] {
24
        return
25
    }
26
    set nshort "$subdir/[file tail $test]"
27
    set bname "[file rootname [file tail $nshort]]"
28
 
29
    catch { file_on_host delete "$bname$suffix.gch" }
30
    catch { file_on_host delete "$bname.s" }
31
    catch { file_on_host delete "$bname.s-gch" }
32
 
33
    # We don't try to use the loop-optimizing options, since they are highly
34
    # unlikely to make any difference to PCH.
35
    foreach flags $options {
36
        verbose "Testing $nshort, $otherflags $flags" 1
37
 
38
        # For the header files, the default is to precompile.
39
        set dg-do-what-default precompile
40
        catch { file_on_host delete "$bname$suffix" }
41
        gcc_copy_files "[file rootname $test]${suffix}s" "$bname$suffix"
42
        dg-test -keep-output "./$bname$suffix" "$otherflags $flags" ""
43
 
44
        # For the rest, the default is to compile to .s.
45
        set dg-do-what-default compile
46
 
47
        set have_errs [llength [grep $test "{\[ \t\]\+dg-error\[ \t\]\+.*\[ \t\]\+}"]]
48
 
49
        if { [ file_on_host exists "$bname$suffix.gch" ] } {
50
            # Ensure that the PCH file is used, not the original header.
51
            file_on_host delete "$bname$suffix"
52
 
53
            dg-test -keep-output $test "$otherflags $flags -I." ""
54
            file_on_host delete "$bname$suffix.gch"
55
            if { !$have_errs } {
56
                if { [ file_on_host exists "$bname.s" ] } {
57
                    remote_upload host "$bname.s" "$bname.s-gch"
58
                    remote_download host "$bname.s-gch"
59
                    gcc_copy_files "[file rootname $test]${suffix}s" "$bname$suffix"
60
                    dg-test -keep-output $test "$otherflags $flags -I." ""
61
                    remote_upload host "$bname.s"
62
                    set tmp [ diff "$bname.s" "$bname.s-gch" ]
63
                    if { $tmp == 0 } {
64
                        verbose -log "assembly file '$bname.s', '$bname.s-gch' comparison error"
65
                        fail "$nshort $otherflags $flags assembly comparison"
66
                    } elseif { $tmp == 1 } {
67
                        pass "$nshort $otherflags $flags assembly comparison"
68
                    } else {
69
                        fail "$nshort $otherflags $flags assembly comparison"
70
                    }
71
                    file_on_host delete "$bname$suffix"
72
                    file_on_host delete "$bname.s"
73
                    file_on_host delete "$bname.s-gch"
74
                } else {
75
                    verbose -log "assembly file '$bname.s' missing"
76
                    fail "$nshort $flags assembly comparison"
77
                }
78
            }
79
        } else {
80
            verbose -log "pch file '$bname$suffix.gch' missing"
81
            fail "$nshort $flags"
82
            if { !$have_errs } {
83
                verbose -log "assembly file '$bname.s' missing" 1
84
                fail "$nshort $flags assembly comparison"
85
            }
86
        }
87
    }
88
}
89
 
90
proc dg-pch { subdir test options suffix } {
91
  return [dg-flags-pch $subdir $test "" $options $suffix]
92
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.