2015-01-01 14:15:26 +00:00
|
|
|
# Copyright (C) 2001-2015 Free Software Foundation, Inc.
|
2001-07-18 23:56:41 +00:00
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-07-05 16:54:46 +00:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
2001-07-18 23:56:41 +00:00
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2005-05-08 14:17:41 +00:00
|
|
|
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
2001-07-18 23:56:41 +00:00
|
|
|
|
|
|
|
# Please email any bugs, comments, and/or additions to this file to:
|
|
|
|
# bug-dejagnu@prep.ai.mit.edu
|
|
|
|
|
|
|
|
# Written by DJ Delorie <dj@redhat.com>
|
|
|
|
|
2013-12-03 13:57:56 +00:00
|
|
|
if {![istarget "i*86-*-*"] && ![istarget "x86_64-*-mingw*"] && ![istarget "x86_64-*-cygwin"] } {
|
|
|
|
verbose "Not a Cygwin/Mingw target" 1
|
2001-07-18 23:56:41 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if {![info exists WINDRES]} then {
|
2013-12-03 13:57:56 +00:00
|
|
|
verbose "WINDRES not defined" 1
|
2001-07-18 23:56:41 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if {[which $WINDRES] == 0} then {
|
2013-12-03 13:57:56 +00:00
|
|
|
verbose "$WINDRES not found" 1
|
2001-07-18 23:56:41 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
set wr "$WINDRES --include-dir $srcdir/$subdir"
|
|
|
|
|
|
|
|
if [file exists "$srcdir/../../winsup/w32api/include"] {
|
|
|
|
set wr "$wr --include-dir $srcdir/../../winsup/w32api/include"
|
|
|
|
} else {
|
|
|
|
send_log "\nWarning: Assuming windres can find the win32 headers\n\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
set res_list [lsort [glob -nocomplain $srcdir/$subdir/*.rc]]
|
|
|
|
|
|
|
|
proc oneline { file } {
|
|
|
|
while { 1 } {
|
|
|
|
if { [gets $file line] == -1 } {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
if [regexp "^ \[0-9a-z\]\[0-9a-z\]* " $line] {
|
|
|
|
return $line
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach res $res_list {
|
|
|
|
set sroot [file rootname $res]
|
|
|
|
set broot [file tail $sroot]
|
|
|
|
set done 0
|
2011-04-13 07:50:15 +00:00
|
|
|
set cpp_opts ""
|
2001-07-18 23:56:41 +00:00
|
|
|
|
|
|
|
set rc [open $res]
|
|
|
|
while { [gets $rc line] != -1 } {
|
|
|
|
if ![regexp "^(//|/\*|#)" $line] {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
if [regexp "\[xp\]fail *(\[^ \]*)" $line junk sys] {
|
|
|
|
setup_xfail $sys
|
2004-05-12 03:28:46 +00:00
|
|
|
continue
|
2001-07-18 23:56:41 +00:00
|
|
|
}
|
2011-04-13 07:50:15 +00:00
|
|
|
if [regexp "cpparg *(\[^ \]*)" $line junk cppopt] {
|
|
|
|
set cpp_opts "--preprocessor-arg \"$cppopt\""
|
|
|
|
continue
|
|
|
|
}
|
2001-07-18 23:56:41 +00:00
|
|
|
}
|
|
|
|
|
2003-04-22 17:31:08 +00:00
|
|
|
verbose "$wr -J rc -O res $res tmpdir/$broot.res" 1
|
2011-04-13 07:50:15 +00:00
|
|
|
catch "exec $wr $cpp_opts -J rc -O res $res tmpdir/$broot.res" err
|
2001-07-18 23:56:41 +00:00
|
|
|
|
|
|
|
if ![string match "" $err] then {
|
|
|
|
send_log "$err\n"
|
|
|
|
verbose "$err" 1
|
2007-08-09 11:43:03 +00:00
|
|
|
if [string match "*windows.h: No such file*" $err] then {
|
|
|
|
unsupported "windres/$broot (parse)"
|
|
|
|
} else {
|
|
|
|
fail "windres/$broot (parse)"
|
|
|
|
}
|
2004-05-12 03:28:46 +00:00
|
|
|
continue
|
2001-07-18 23:56:41 +00:00
|
|
|
}
|
|
|
|
pass "windres/$broot (parse)"
|
|
|
|
|
|
|
|
set rc [open $res]
|
|
|
|
while { [gets $rc line] != -1 } {
|
|
|
|
if ![regexp "^(//|/\*|#)" $line] {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
if [regexp "parse-only" $line] {
|
|
|
|
file delete "tmpdir/$broot.res"
|
|
|
|
set done 1
|
2004-05-12 03:28:46 +00:00
|
|
|
break
|
2001-07-18 23:56:41 +00:00
|
|
|
}
|
|
|
|
if [regexp "\[xc\]fail *(\[^ \]*)" $line junk sys] {
|
|
|
|
setup_xfail $sys
|
2004-05-12 03:28:46 +00:00
|
|
|
continue
|
2001-07-18 23:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if { $done != 0 } {
|
2004-05-12 03:28:46 +00:00
|
|
|
continue
|
2001-07-18 23:56:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
verbose "$OBJDUMP -b binary -s tmpdir/$broot.res > tmpdir/$broot.dump" 1
|
|
|
|
catch "exec $OBJDUMP -b binary -s tmpdir/$broot.res > tmpdir/$broot.dump" err
|
|
|
|
|
|
|
|
if ![string match "" $err] then {
|
|
|
|
send_log "$err\n"
|
|
|
|
verbose "$err" 1
|
|
|
|
fail "windres/$broot (compare)"
|
2004-05-12 03:28:46 +00:00
|
|
|
continue
|
2001-07-18 23:56:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set pat [open "$sroot.rsd"]
|
|
|
|
set out [open "tmpdir/$broot.dump"]
|
|
|
|
set patline "foo"
|
|
|
|
|
|
|
|
while { ![string match $patline ""] } {
|
|
|
|
set patline [oneline $pat]
|
|
|
|
set outline [oneline $out]
|
|
|
|
|
|
|
|
if ![string match $patline $outline] {
|
2004-05-12 03:28:46 +00:00
|
|
|
send_log "< $patline\n"
|
|
|
|
send_log "> $outline\n"
|
|
|
|
fail "windres/$broot (compare)"
|
2001-07-18 23:56:41 +00:00
|
|
|
set done 1
|
2004-05-12 03:28:46 +00:00
|
|
|
break
|
2001-07-18 23:56:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if { $done == 0 } {
|
|
|
|
pass "windres/$broot (compare)"
|
|
|
|
file delete "tmpdir/$broot.res"
|
|
|
|
file delete "tmpdir/$broot.dump"
|
|
|
|
}
|
|
|
|
}
|
2013-12-03 13:57:56 +00:00
|
|
|
|
|
|
|
# Test objdump -p
|
|
|
|
|
|
|
|
if {[which $OBJDUMP] == 0} then {
|
|
|
|
unsupported "objdump -p"
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
verbose "$wr $cpp_opts -J rc $srcdir/$subdir/version.rc tmpdir/version.o" 1
|
|
|
|
catch "exec $wr $cpp_opts -J rc $srcdir/$subdir/version.rc tmpdir/version.o" err
|
|
|
|
|
|
|
|
if ![string match "" $err] then {
|
|
|
|
send_log "$err\n"
|
|
|
|
verbose "$err" 1
|
|
|
|
if [string match "*windows.h: No such file*" $err] then {
|
|
|
|
unsupported "objdump -p (no header files found)"
|
|
|
|
} else {
|
|
|
|
fail "objdump -p (build)"
|
|
|
|
}
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -p tmpdir/version.o"]
|
|
|
|
|
|
|
|
# FIXME: We should extend this regexp to check for more information.
|
|
|
|
set want ".*The .rsrc Resource Directory section.*Type Table:.*Entry: ID:.*Name Table:.*Entry: ID:.*Language Table:.*Entry: ID:.*"
|
|
|
|
|
|
|
|
if ![regexp $want $got] then {
|
|
|
|
fail "objdump -p"
|
|
|
|
} else {
|
|
|
|
pass "objdump -p"
|
|
|
|
}
|
|
|
|
|
|
|
|
# file delete "tmpdir/version.o"
|