1 # Copyright 2001 Free Software Foundation, Inc.
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 2 of the License, or
6 # (at your option) any later version.
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.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-dejagnu@prep.ai.mit.edu
20 # Written by DJ Delorie <dj@redhat.com>
22 if {![istarget "i*86-*-*"]} {
26 if {![info exists WINDRES]} then {
30 if {[which $WINDRES] == 0} then {
34 set wr "$WINDRES --include-dir $srcdir/$subdir"
36 if [file exists "$srcdir/../../winsup/w32api/include"] {
37 set wr "$wr --include-dir $srcdir/../../winsup/w32api/include"
39 send_log "\nWarning: Assuming windres can find the win32 headers\n\n"
42 set res_list [lsort [glob -nocomplain $srcdir/$subdir/*.rc]]
44 proc oneline { file } {
46 if { [gets $file line] == -1 } {
49 if [regexp "^ \[0-9a-z\]\[0-9a-z\]* " $line] {
55 foreach res $res_list {
56 set sroot [file rootname $res]
57 set broot [file tail $sroot]
61 while { [gets $rc line] != -1 } {
62 if ![regexp "^(//|/\*|#)" $line] {
65 if [regexp "\[xp\]fail *(\[^ \]*)" $line junk sys] {
71 verbose "$wr -I rc -O res $res tmpdir/$broot.res" 1
72 catch "exec $wr -I rc -O res $res tmpdir/$broot.res" err
74 if ![string match "" $err] then {
77 fail "windres/$broot (parse)"
80 pass "windres/$broot (parse)"
83 while { [gets $rc line] != -1 } {
84 if ![regexp "^(//|/\*|#)" $line] {
87 if [regexp "parse-only" $line] {
88 file delete "tmpdir/$broot.res"
92 if [regexp "\[xc\]fail *(\[^ \]*)" $line junk sys] {
101 verbose "$OBJDUMP -b binary -s tmpdir/$broot.res > tmpdir/$broot.dump" 1
102 catch "exec $OBJDUMP -b binary -s tmpdir/$broot.res > tmpdir/$broot.dump" err
104 if ![string match "" $err] then {
107 fail "windres/$broot (compare)"
111 set pat [open "$sroot.rsd"]
112 set out [open "tmpdir/$broot.dump"]
115 while { ![string match $patline ""] } {
116 set patline [oneline $pat]
117 set outline [oneline $out]
119 if ![string match $patline $outline] {
120 send_log "< $patline\n";
121 send_log "> $outline\n";
122 fail "windres/$broot (compare)";
128 pass "windres/$broot (compare)"
129 file delete "tmpdir/$broot.res"
130 file delete "tmpdir/$broot.dump"