winetest: move to resources

Ferenc Wagner wferi at afavant.elte.hu
Mon May 3 06:49:13 CDT 2004


Hi Alexandre,

It's almost a resend of my previous patch which seems MIA.
The only difference is that I removed the possible sequence
point screwups in the hope they were the reason for the drop.

New files: programs/winetest/README
           programs/winetest/resource.h

ChangeLog:
- Build info et al. is given by files instead of env. vars.
- Store that information in resources.

Index: programs/winetest/Makefile.in
===================================================================
RCS file: /home/wine/wine/programs/winetest/Makefile.in,v
retrieving revision 1.25
diff -u -r1.25 Makefile.in
--- programs/winetest/Makefile.in	20 Apr 2004 04:00:07 -0000	1.25
+++ programs/winetest/Makefile.in	3 May 2004 11:43:28 -0000
@@ -43,13 +43,25 @@
 
 TESTBINS = $(TESTS:%=%_test.exe$(DLLEXT))
 
-winetest.rc: maketest Makefile.in
-	$(SRCDIR)/maketest $(TOPSRCDIR) $(TESTBINS) > $@ || ( $(RM) $@ && exit 1 )
+# Order does matter here!
+PARAMFILES = build.id build.ind tests.url
+
+build.id: $(TOPSRCDIR)/ChangeLog
+	date -u +%Y%m%d%H%M.auto > $@
+
+build.ind: build.nfo
+	( while read; do echo "    $$REPLY"; done < $< > $@ ) || ( $(RM) $@ && exit 1 )
+
+build.nfo tests.url:
+	echo "-" > $@
+
+winetest.rc: maketest Makefile.in $(PARAMFILES)
+	$(SRCDIR)/maketest $(TOPSRCDIR) $(PARAMFILES) $(TESTBINS) > $@ || ( $(RM) $@ && exit 1 )
 
 gui.res: winetest.rc $(TESTBINS)
 
 clean::
-	$(RM) winetest.rc $(TESTBINS)
+	$(RM) winetest.rc build.ind $(TESTBINS)
 
 depend: winetest.rc
 
Index: programs/winetest/README
===================================================================
RCS file: programs/winetest/README
diff -N programs/winetest/README
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ programs/winetest/README	3 May 2004 11:43:28 -0000
@@ -0,0 +1,25 @@
+                           Wine Test Shell
+                           ~~~~~~~~~~~~~~~
+
+Winetest is a single-executable version of all the DLL conformance
+test programs suitable for unattended testing and report submitting.
+People assigned to build winetest must take care of the following
+files in the build directory:
+
+* build.id
+
+Contains a single (either CR or CR-LF) terminated line providing the
+build identification.
+
+* tests.url
+
+Also contains a single terminated line providing the archive URL of
+the testing suite being built.
+
+* build.nfo
+
+Contains a block of terminated lines providing miscellaneous
+information about the build, like eg. the tools being used.
+
+
+Ferenc Wagner <wferi at afavant.elte.hu>, Sat, 24 Apr 2004 02:29:52 +0200
Index: programs/winetest/main.c
===================================================================
RCS file: /home/wine/wine/programs/winetest/main.c,v
retrieving revision 1.16
diff -u -r1.16 main.c
--- programs/winetest/main.c	23 Apr 2004 23:30:11 -0000	1.16
+++ programs/winetest/main.c	3 May 2004 11:43:28 -0000
@@ -36,8 +36,7 @@
 #include <windows.h>
 
 #include "winetest.h"
-
-#define TESTRESOURCE "USERDATA"
+#include "resource.h"
 
 struct wine_test
 {
@@ -185,18 +184,18 @@
     }
 }
 
-void* extract_rcdata (int id, DWORD* size)
+void* extract_rcdata (int id, int type, DWORD* size)
 {
     HRSRC rsrc;
     HGLOBAL hdl;
     LPVOID addr = NULL;
     
-    if (!(rsrc = FindResource (0, (LPTSTR)id, TESTRESOURCE)) ||
+    if (!(rsrc = FindResource (NULL, (LPTSTR)id, MAKEINTRESOURCE(type))) ||
         !(*size = SizeofResource (0, rsrc)) ||
         !(hdl = LoadResource (0, rsrc)) ||
         !(addr = LockResource (hdl)))
-        report (R_FATAL, "Can't extract test file of id %d: %d",
-                id, GetLastError ());
+        report (R_FATAL, "Can't find resource of type %x, id %d: %d",
+                type, id, GetLastError ());
     return addr;
 }
 
@@ -210,7 +209,7 @@
     int strlen, bufflen = 128;
     char *exepos;
 
-    code = extract_rcdata (id, &size);
+    code = extract_rcdata (id, TESTRES, &size);
     test->name = xmalloc (bufflen);
     while ((strlen = LoadStringA (NULL, id, test->name, bufflen))
            == bufflen - 1) {
@@ -405,7 +404,8 @@
     int nr_of_files = 0, nr_of_tests = 0, i;
     char *tempdir;
     FILE *logfile;
-    char build_tag[128];
+    char *strres;
+    DWORD strsize;
 
     SetErrorMode (SEM_NOGPFAULTERRORBOX);
 
@@ -429,22 +429,19 @@
     fclose (logfile);
 
     xprintf ("Version 3\n");
-    i = LoadStringA (GetModuleHandle (NULL), 0,
-                     build_tag, sizeof build_tag);
-    if (i == 0) report (R_FATAL, "Build descriptor not found: %d",
-                        GetLastError ());
-    if (i >= sizeof build_tag)
-        report (R_FATAL, "Build descriptor too long.");
-    xprintf ("Tests from build %s\n", build_tag);
-    xprintf ("Archive: %s\n", url?url:"");
+    strres = extract_rcdata (WINE_BUILD, STRINGRES, &strsize);
+    xprintf ("Tests from build %.*s", strsize, strres);
+    strres = extract_rcdata (TESTS_URL, STRINGRES, &strsize);
+    xprintf ("Archive: %.*s", strsize, strres);
     xprintf ("Tag: %s\n", tag?tag:"");
-    xprintf ("Build info:\n");
+    strres = extract_rcdata (BUILD_INFO, STRINGRES, &strsize);
+    xprintf ("Build info:\n%.*s", strsize, strres);
     xprintf ("Operating system version:\n");
     print_version ();
     xprintf ("Test output:\n" );
 
     report (R_STATUS, "Counting tests");
-    if (!EnumResourceNames (NULL, TESTRESOURCE,
+    if (!EnumResourceNames (NULL, MAKEINTRESOURCE(TESTRES),
                             EnumTestFileProc, (LPARAM)&nr_of_files))
         report (R_FATAL, "Can't enumerate test files: %d",
                 GetLastError ());
@@ -453,7 +450,7 @@
     report (R_STATUS, "Extracting tests");
     report (R_PROGRESS, 0, nr_of_files);
     for (i = 0; i < nr_of_files; i++) {
-        get_subtests (tempdir, wine_tests+i, i+1);
+        get_subtests (tempdir, wine_tests+i, i);
         nr_of_tests += wine_tests[i].subtest_count;
     }
     report (R_DELTA, 0, "Extracting: Done");
Index: programs/winetest/maketest
===================================================================
RCS file: /home/wine/wine/programs/winetest/maketest,v
retrieving revision 1.5
diff -u -r1.5 maketest
--- programs/winetest/maketest	24 Mar 2004 23:40:06 -0000	1.5
+++ programs/winetest/maketest	3 May 2004 11:43:28 -0000
@@ -1,22 +1,20 @@
 #!/bin/sh
 
-if [ -z "$WINE_BUILD" ]; then
-    WINE_BUILD="`date +%Y%m%d.%H%M-auto`"
-    echo "warning: using automatically generated BUILD tag: $WINE_BUILD" 1>&2
-fi
-
 TOPSRCDIR="$1"
-shift
 
 echo "/* Automatically generated -- do not edit! */"
+echo "#include \"resource.h\""
+echo "WINE_BUILD STRINGRES \"$2\""
+echo "BUILD_INFO STRINGRES \"$3\""
+echo "TESTS_URL  STRINGRES \"$4\""
 echo "STRINGTABLE {"
-echo "0 \"$WINE_BUILD\""
+shift 4
 
 i=0
 for test
 do
-    i=`expr $i + 1`
     echo "$i \"$test\""
+    i=`expr $i + 1`
 done
 
 i=30000
@@ -34,6 +32,6 @@
 i=0
 for test
 do
+    echo "$i TESTRES \"$test\""
     i=`expr $i + 1`
-    echo "$i USERDATA \"$test\""
 done
Index: programs/winetest/resource.h
===================================================================
RCS file: programs/winetest/resource.h
diff -N programs/winetest/resource.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ programs/winetest/resource.h	3 May 2004 11:43:28 -0000
@@ -0,0 +1,10 @@
+/* Resource types */
+
+#define TESTRES   1000
+#define STRINGRES 1001
+
+/* String resources */
+
+#define WINE_BUILD 10000
+#define BUILD_INFO 10001
+#define TESTS_URL  10002



More information about the wine-patches mailing list