This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

patch: new windres testsuite



OK, enough of the incompatible windres output ;-)

The idea of this testsuite is to compare windres's output with MSVC's
output.  It only runs the tests on ix86 targets that have built
windres, which does limit it, but we're comparing target-endian
binaries so we can't compare on machines with different sized words or
different endians.

Before I commit this, does anyone see anything that might cause
problems on other platforms?  There were no regressions on Cygwin or
Linux.

Index: testsuite/config/default.exp
===================================================================
RCS file: /cvs/src/src/binutils/testsuite/config/default.exp,v
retrieving revision 1.3
diff -p -3 -r1.3 default.exp
*** default.exp	2001/03/13 06:43:59	1.3
--- default.exp	2001/07/17 03:22:10
*************** if ![info exists READELFFLAGS] then {
*** 69,74 ****
--- 69,78 ----
      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


diff -p2N empty/README testsuite/binutils-all/windres/README
*** empty/README	Wed Dec 31 19:00:00 1969
--- testsuite/binutils-all/windres/README	Mon Jul 16 20:00:49 2001
***************
*** 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.
Binary files empty/bmp1.bmp and testsuite/binutils-all/windres/bmp1.bmp differ
diff -p2N empty/bmpalign.rc testsuite/binutils-all/windres/bmpalign.rc
*** empty/bmpalign.rc	Wed Dec 31 19:00:00 1969
--- testsuite/binutils-all/windres/bmpalign.rc	Mon Jul 16 22:37:22 2001
***************
*** 0 ****
--- 1,9 ----
+ LANGUAGE 0, 0
+  
+ A BITMAP MOVEABLE PURE DISCARDABLE "bmp1.bmp"
+  
+ AB BITMAP MOVEABLE PURE DISCARDABLE "bmp1.bmp"
+  
+ ABC BITMAP MOVEABLE PURE DISCARDABLE "bmp1.bmp"
+ 
+ ABCD BITMAP MOVEABLE PURE DISCARDABLE "bmp1.bmp"
diff -p2N empty/bmpalign.rsd testsuite/binutils-all/windres/bmpalign.rsd
*** empty/bmpalign.rsd	Wed Dec 31 19:00:00 1969
--- testsuite/binutils-all/windres/bmpalign.rsd	Mon Jul 16 22:37:29 2001
***************
*** 0 ****
--- 1,38 ----
+  0000 00000000 20000000 ffff0000 ffff0000  .... ...........
+  0010 00000000 00000000 00000000 00000000  ................
+  0020 6c000000 20000000 ffff0200 41000000  l... .......A...
+  0030 00000000 30100000 00000000 00000000  ....0...........
+  0040 28000000 01000000 01000000 01000400  (...............
+  0050 00000000 04000000 00000000 00000000  ................
+  0060 00000000 00000000 00000000 00008000  ................
+  0070 00800000 00808000 80000000 80008000  ................
+  0080 80800000 c0c0c000 80808000 0000ff00  ................
+  0090 00ff0000 00ffff00 ff000000 ff00ff00  ................
+  00a0 ffff0000 ffffff00 90000000 6c000000  ............l...
+  00b0 24000000 ffff0200 41004200 00000000  $.......A.B.....
+  00c0 00000000 30100000 00000000 00000000  ....0...........
+  00d0 28000000 01000000 01000000 01000400  (...............
+  00e0 00000000 04000000 00000000 00000000  ................
+  00f0 00000000 00000000 00000000 00008000  ................
+  0100 00800000 00808000 80000000 80008000  ................
+  0110 80800000 c0c0c000 80808000 0000ff00  ................
+  0120 00ff0000 00ffff00 ff000000 ff00ff00  ................
+  0130 ffff0000 ffffff00 90000000 6c000000  ............l...
+  0140 24000000 ffff0200 41004200 43000000  $.......A.B.C...
+  0150 00000000 30100000 00000000 00000000  ....0...........
+  0160 28000000 01000000 01000000 01000400  (...............
+  0170 00000000 04000000 00000000 00000000  ................
+  0180 00000000 00000000 00000000 00008000  ................
+  0190 00800000 00808000 80000000 80008000  ................
+  01a0 80800000 c0c0c000 80808000 0000ff00  ................
+  01b0 00ff0000 00ffff00 ff000000 ff00ff00  ................
+  01c0 ffff0000 ffffff00 90000000 6c000000  ............l...
+  01d0 28000000 ffff0200 41004200 43004400  (.......A.B.C.D.
+  01e0 00000000 00000000 30100000 00000000  ........0.......
+  01f0 00000000 28000000 01000000 01000000  ....(...........
+  0200 01000400 00000000 04000000 00000000  ................
+  0210 00000000 00000000 00000000 00000000  ................
+  0220 00008000 00800000 00808000 80000000  ................
+  0230 80008000 80800000 c0c0c000 80808000  ................
+  0240 0000ff00 00ff0000 00ffff00 ff000000  ................
+  0250 ff00ff00 ffff0000 ffffff00 90000000  ................
diff -p2N empty/foo testsuite/binutils-all/windres/foo
*** empty/foo	Wed Dec 31 19:00:00 1969
--- testsuite/binutils-all/windres/foo	Mon Jul 16 20:28:47 2001
***************
*** 0 ****
--- 1,25 ----
+ // Time stamp: 995329727
+ 
+ // Type: menu
+ // Time stamp: 995329727
+ 
+ // Name: 1
+ // Time stamp: 995329727
+ LANGUAGE 7, 4
+ 
+ 1 MENU MOVEABLE PURE DISCARDABLE
+ BEGIN
+   POPUP "&Datei"
+   BEGIN
+     MENUITEM "foo", 1
+   END
+ END
+ LANGUAGE 9, 4
+ 
+ 1 MENU MOVEABLE PURE DISCARDABLE
+ BEGIN
+   POPUP "&File"
+   BEGIN
+     MENUITEM "foo", 1
+   END
+ END
diff -p2N empty/lang.rc testsuite/binutils-all/windres/lang.rc
*** empty/lang.rc	Wed Dec 31 19:00:00 1969
--- testsuite/binutils-all/windres/lang.rc	Mon Jul 16 20:28:59 2001
***************
*** 0 ****
--- 1,15 ----
+ #include "windows.h"
+ 
+ LANGUAGE 0, 0
+ 
+ 1 MENU MOVEABLE PURE DISCARDABLE
+ LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
+ BEGIN
+ 	POPUP "&Datei" { MENUITEM "foo", 1 }
+ END
+ 
+ 1 MENU MOVEABLE PURE DISCARDABLE
+ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+ BEGIN
+ 	POPUP "&File" { MENUITEM "foo", 1 }
+ END
diff -p2N empty/lang.rsd testsuite/binutils-all/windres/lang.rsd
*** empty/lang.rsd	Wed Dec 31 19:00:00 1969
--- testsuite/binutils-all/windres/lang.rsd	Mon Jul 16 22:37:30 2001
***************
*** 0 ****
--- 1,10 ----
+  0000 00000000 20000000 ffff0000 ffff0000  .... ...........
+  0010 00000000 00000000 00000000 00000000  ................
+  0020 20000000 20000000 ffff0400 ffff0100   ... ...........
+  0030 00000000 30100704 00000000 00000000  ....0...........
+  0040 00000000 90002600 44006100 74006500  ......&.D.a.t.e.
+  0050 69000000 80000100 66006f00 6f000000  i.......f.o.o...
+  0060 1e000000 20000000 ffff0400 ffff0100  .... ...........
+  0070 00000000 30100904 00000000 00000000  ....0...........
+  0080 00000000 90002600 46006900 6c006500  ......&.F.i.l.e.
+  0090 00008000 01006600 6f006f00 00000000  ......f.o.o.....
diff -p2N empty/msupdate testsuite/binutils-all/windres/msupdate
*** empty/msupdate	Wed Dec 31 19:00:00 1969
--- testsuite/binutils-all/windres/msupdate	Mon Jul 16 19:59:02 2001
***************
*** 0 ****
--- 1,40 ----
+ #!/bin/sh
+ # 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 <dj@redhat.com>
+ 
+ # 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 -p2N empty/strtab1.rc testsuite/binutils-all/windres/strtab1.rc
*** empty/strtab1.rc	Wed Dec 31 19:00:00 1969
--- testsuite/binutils-all/windres/strtab1.rc	Mon Jul 16 20:10:50 2001
***************
*** 0 ****
--- 1,8 ----
+ #include "windows.h"
+ 
+ LANGUAGE 0, 0
+ 
+ STRINGTABLE MOVEABLE PURE DISCARDABLE
+ BEGIN
+   1 "hello, world"
+ END
diff -p2N empty/strtab1.rsd testsuite/binutils-all/windres/strtab1.rsd
*** empty/strtab1.rsd	Wed Dec 31 19:00:00 1969
--- testsuite/binutils-all/windres/strtab1.rsd	Mon Jul 16 22:37:31 2001
***************
*** 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 -p2N empty/windres.exp testsuite/binutils-all/windres/windres.exp
*** empty/windres.exp	Wed Dec 31 19:00:00 1969
--- testsuite/binutils-all/windres/windres.exp	Mon Jul 16 21:54:46 2001
***************
*** 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 <dj@redhat.com>
+ 
+ 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"
+     }
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]