From 64e087274131340066589bd9a73fab5388bbaf8c Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Wed, 18 Jul 2001 23:56:41 +0000 Subject: [PATCH] * config/default.exp (WINDRES): Add. * binutils-all/windres/windres.exp: New. * binutils-all/windres/README: New. * binutils-all/windres/bmp1.bmp: New. * binutils-all/windres/bmpalign.rc: New. * binutils-all/windres/bmpalign.rsd: New. * binutils-all/windres/lang.rc: New. * binutils-all/windres/lang.rsd: New. * binutils-all/windres/msupdate: New. * binutils-all/windres/strtab1.rc: New. * binutils-all/windres/strtab1.rsd: New. --- binutils/testsuite/ChangeLog | 14 +++ binutils/testsuite/binutils-all/windres/README | 26 ++++ binutils/testsuite/binutils-all/windres/bmp1.bmp | Bin 0 -> 122 bytes .../testsuite/binutils-all/windres/bmpalign.rc | 9 ++ .../testsuite/binutils-all/windres/bmpalign.rsd | 38 ++++++ binutils/testsuite/binutils-all/windres/lang.rc | 15 +++ binutils/testsuite/binutils-all/windres/lang.rsd | 10 ++ binutils/testsuite/binutils-all/windres/msupdate | 40 +++++++ binutils/testsuite/binutils-all/windres/strtab1.rc | 8 ++ .../testsuite/binutils-all/windres/strtab1.rsd | 8 ++ .../testsuite/binutils-all/windres/windres.exp | 132 +++++++++++++++++++++ binutils/testsuite/config/default.exp | 4 + 12 files changed, 304 insertions(+) create mode 100644 binutils/testsuite/binutils-all/windres/README create mode 100644 binutils/testsuite/binutils-all/windres/bmp1.bmp create mode 100644 binutils/testsuite/binutils-all/windres/bmpalign.rc create mode 100644 binutils/testsuite/binutils-all/windres/bmpalign.rsd create mode 100644 binutils/testsuite/binutils-all/windres/lang.rc create mode 100644 binutils/testsuite/binutils-all/windres/lang.rsd create mode 100755 binutils/testsuite/binutils-all/windres/msupdate create mode 100644 binutils/testsuite/binutils-all/windres/strtab1.rc create mode 100644 binutils/testsuite/binutils-all/windres/strtab1.rsd create mode 100644 binutils/testsuite/binutils-all/windres/windres.exp diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index d7630eb..0f0fef4 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2001-07-18 DJ Delorie + + * config/default.exp (WINDRES): Add. + * binutils-all/windres/windres.exp: New. + * binutils-all/windres/README: New. + * binutils-all/windres/bmp1.bmp: New. + * binutils-all/windres/bmpalign.rc: New. + * binutils-all/windres/bmpalign.rsd: New. + * binutils-all/windres/lang.rc: New. + * binutils-all/windres/lang.rsd: New. + * binutils-all/windres/msupdate: New. + * binutils-all/windres/strtab1.rc: New. + * binutils-all/windres/strtab1.rsd: New. + 2001-07-05 Ben Elliston * lib/utils-lib.exp (target_assemble): Remove duplicate copy. diff --git a/binutils/testsuite/binutils-all/windres/README b/binutils/testsuite/binutils-all/windres/README new file mode 100644 index 0000000..f990349 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/README @@ -0,0 +1,26 @@ +Instructions for adding tests: + +The files *.rc are hand-edited or copied from elsewhere. + +The script msupdate is used to generate the *.rsd files, which are +dumps of the RES formatted output of MSVC's RC utility. + +Within the *.rc file, the first N lines beginning with a special +comment can control the test. Comments are // /* or # (// is +recommended, as both rc and windres support those). Each line +contains one command: + + // parse-only + // xfail *-*-* + +parse-only must preceed any xfail commands, and indicates that a +comparison with the *.rsd file will not happen. xfail indicates when +a failure is expected. This should only be used for when you are +adding a new test that is known to fail because of a bug in windres, +and it should be removed when the bug is fixed. + +You can use pfail or cfail instead of xfail to indicate that only the +parsing or comparing should be xfailed. + +The windres tests only run for ix86 targets, because the +MSVC-generated *.rsd files are generated for that. diff --git a/binutils/testsuite/binutils-all/windres/bmp1.bmp b/binutils/testsuite/binutils-all/windres/bmp1.bmp new file mode 100644 index 0000000000000000000000000000000000000000..208a8aa28d7a47d17b2096e91a53560dbd314bce GIT binary patch literal 122 zcmZ?rtzv+HG9aY^#Efvv0+xV~U?v*Tz`y`R3=Its3P=K(3 + +# Run this on a machine with Cygwin and Microsoft Visual C to create +# the RES files we match against. + +RC="rc" +if test x"$1" != x"" +then + RC="$1" +fi + +for i in *.rc +do + o=`echo $i | sed s/.rc/.res/` + d=`echo $i | sed s/.rc/.rsd/` + echo "$i -> $o -> $d" + $RC /fo$o $i + objdump -b binary -s $o | sed -n '/^ [0-9a-f][0-9a-f]* /p' > $d + rm $o +done diff --git a/binutils/testsuite/binutils-all/windres/strtab1.rc b/binutils/testsuite/binutils-all/windres/strtab1.rc new file mode 100644 index 0000000..a1a246d --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/strtab1.rc @@ -0,0 +1,8 @@ +#include "windows.h" + +LANGUAGE 0, 0 + +STRINGTABLE MOVEABLE PURE DISCARDABLE +BEGIN + 1 "hello, world" +END diff --git a/binutils/testsuite/binutils-all/windres/strtab1.rsd b/binutils/testsuite/binutils-all/windres/strtab1.rsd new file mode 100644 index 0000000..4d61073 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/strtab1.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 38000000 20000000 ffff0600 ffff0100 8... ........... + 0030 00000000 30100000 00000000 00000000 ....0........... + 0040 00000c00 68006500 6c006c00 6f002c00 ....h.e.l.l.o.,. + 0050 20007700 6f007200 6c006400 00000000 .w.o.r.l.d..... + 0060 00000000 00000000 00000000 00000000 ................ + 0070 00000000 00000000 ........ diff --git a/binutils/testsuite/binutils-all/windres/windres.exp b/binutils/testsuite/binutils-all/windres/windres.exp new file mode 100644 index 0000000..3578835 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/windres.exp @@ -0,0 +1,132 @@ +# Copyright 2001 Free Software Foundation, Inc. + +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (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 +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# Written by DJ Delorie + +if {![istarget "i*86-*-*"]} { + return +} + +if {![info exists WINDRES]} then { + return +} + +if {[which $WINDRES] == 0} then { + 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 + + set rc [open $res] + while { [gets $rc line] != -1 } { + if ![regexp "^(//|/\*|#)" $line] { + break + } + if [regexp "\[xp\]fail *(\[^ \]*)" $line junk sys] { + setup_xfail $sys + continue; + } + } + + verbose "$wr -I rc -O res $res tmpdir/$broot.res" 1 + catch "exec $wr -I rc -O res $res tmpdir/$broot.res" err + + if ![string match "" $err] then { + send_log "$err\n" + verbose "$err" 1 + fail "windres/$broot (parse)" + continue; + } + 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 + break; + } + if [regexp "\[xc\]fail *(\[^ \]*)" $line junk sys] { + setup_xfail $sys + continue; + } + } + if { $done != 0 } { + continue; + } + + 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)" + continue; + } + + 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] { + send_log "< $patline\n"; + send_log "> $outline\n"; + fail "windres/$broot (compare)"; + set done 1 + break; + } + } + if { $done == 0 } { + pass "windres/$broot (compare)" + file delete "tmpdir/$broot.res" + file delete "tmpdir/$broot.dump" + } +} diff --git a/binutils/testsuite/config/default.exp b/binutils/testsuite/config/default.exp index 56acd95..227fd78 100644 --- a/binutils/testsuite/config/default.exp +++ b/binutils/testsuite/config/default.exp @@ -69,6 +69,10 @@ if ![info exists READELFFLAGS] then { set READELFFLAGS "" } +if ![info exists WINDRES] then { + set WINDRES [findfile $base_dir/windres] +} + if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status} # Make a symlink from tmpdir/gas/as and tmpdir/gas/ld to the assembler -- 2.7.4