Hi

I have been working on creating tests for the 16 bit implementation of wine, and now I have come so far that I would like some comments on the way I have chosen to do it.

16 bit programs require a compiler that is able to create the old style address method in order to be able to test those parts of wine. I have been told by Dmitry Timoshkov that I should use OpenWatcom for that. So that is what I have done. OpenWatcom also supports building DOS32 (using a number of extenders) and WIN 3.x programs.

Since the DOS program can't run in the current test enviroment, because that is new style 32 bit address method, I am using a wrapper program which start the old style program from the 32 bit environment. The wrapper also makes it possible to do a skip message in case the needed DOS program is missing (due to no OpenWatcom compiler).

In order to be able to create a stand-alone DOS program I have modified the wine/test.h file so that certain parts got omitted, while others were added. This means that writing a DOS test will be the same as writing normal 32 bit tests, except that you include a different test include file. The current version uses the define __WINE_WINE_DOS16_TEST_H from the include file that defines the DOS environment, since I haven't been able to find a better name. Suggestions for a better name are most welcome.

The DOS test it self, is only a very simple one because I consider this more a proof of concept than a full test. Also a full test will require a number of changes in the current 16 bit tree to move a number of definitions from .c files to .h files so the test can reference them. Once this have been commited work can start towards making more complete test of the 16 bit environment.

I hope that the naming will make Wine Testbot able to detect changes to the test suite.

As can be seen above the OpenWatcom compiler is needed to build the DOS 16 bit programs.
Currently only Linux 32 bit platform is supported.
The compiler can't be built on 64 bit yet, this includes Mac.
The easiest way to install the compiler is to download the binary installer from:
   http://www.openwatcom.org/index.php/Download

Select one of the mirrors and download the file: open-watcom-c-linux-1.9
Ignore the fact that the main download page points to other places to get the linux version.

This is a binary program that you have to run.
It will ask you were to install OpenWatcom and all files will be installed under that tree. After that you must add a definition of WATCOM to your shell profile, pointing it to the directory you selected. After that change PATH to search in $WATCOM/binl as the LAST thing. Watcom includes programs that are called the same as some wine programs (wrc for one), so be sure you don't find these by searching OpenWatcom last.

As a note I can tell that Debian have rejected the Sybase license (under which OpenWatcom is released) as not being free, and therefore there will be no official debian packages of OpenWatcom.

Best Regards
Morten Rønne













>From e0639e554fea7264de3b8b7b6f6932c747d21198 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Morten=20R=C3=B8nne?= <morten.roe...@tdcadsl.dk>
Date: Mon, 23 Aug 2010 21:59:27 +0200
Subject: [PATCH 1/6] Add build extensions used by DOS programs.

Added .dos16.c and .exe to the list of known suffixes so that automatic rules
can be created which creates exe files from .dos16.c sources.
---
 Make.rules.in |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Make.rules.in b/Make.rules.in
index 3f5d18e..b6b842e 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -136,7 +136,7 @@ filter: dummy
 
 # Implicit rules
 
-.SUFFIXES: .mc .rc .mc.rc .res .idl .tlb .h .y .l .tab.c .tab.h .yy.c .ok 
.man.in .man _c.c _i.c _p.c _s.c .cross.o @MAINTAINER_MODE@ .sfd .ttf .svg .ico 
.bmp
+.SUFFIXES: .mc .rc .mc.rc .res .idl .tlb .h .y .l .tab.c .tab.h .yy.c .ok 
.man.in .man _c.c _i.c _p.c _s.c .cross.o .dos16.c .exe @MAINTAINER_MODE@ .sfd 
.ttf .svg .ico .bmp
 
 .c.o:
        $(CC) -c $(ALLCFLAGS) -o $@ $<
-- 
1.7.0.4

>From 7385fa2d73e13e94988da8c5eb17ecd7fd590c4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Morten=20R=C3=B8nne?= <morten.roe...@tdcadsl.dk>
Date: Mon, 23 Aug 2010 22:00:36 +0200
Subject: [PATCH 2/6] Update configure.ac to detect OpenWatcom.

Added some checks for the wcc and wlink command expected to be in the
OpenWatcom package. The commands need to be in PATH to be found.
If wcc is found the flags needed for DOS building is defined.
---
 configure.ac |   54 ++++++++++++++++--------------------------------------
 1 files changed, 16 insertions(+), 38 deletions(-)

diff --git a/configure.ac b/configure.ac
index b02c7aa..0d4fc04 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,8 +4,8 @@ dnl See ChangeLog file for detailed change history.
 
 m4_define(WINE_VERSION,regexp(m4_include(VERSION),[version 
\([-.0-9A-Za-z]+\)],[\1]))
 
-dnl autoconf versions before 2.62 don't handle source dir symlinks correctly
-AC_PREREQ(2.62)
+dnl autoconf versions before 2.59d don't handle multi-line subst variables 
correctly
+AC_PREREQ(2.59d)
 
AC_INIT([Wine],[WINE_VERSION],[wine-de...@winehq.org],[wine],[http://www.winehq.org])
 AC_CONFIG_SRCDIR(server/atom.c)
 AC_CONFIG_HEADERS(include/config.h)
@@ -55,8 +55,6 @@ AC_ARG_WITH(gnutls,    AS_HELP_STRING([--without-gnutls],[do 
not use GnuTLS (sch
 AC_ARG_WITH(gsm,       AS_HELP_STRING([--without-gsm],[do not use libgsm (GSM 
06.10 codec support)]),
             [if test "x$withval" = "xno"; then ac_cv_header_gsm_h=no; 
ac_cv_header_gsm_gsm_h=no; fi])
 AC_ARG_WITH(hal,       AS_HELP_STRING([--without-hal],[do not use HAL (dynamic 
device support)]))
-AC_ARG_WITH(icns,      AS_HELP_STRING([--without-icns],[do not use ICNS icon 
support]),
-            [if test "x$withval" = "xno"; then ac_cv_header_icns_h=no; fi])
 AC_ARG_WITH(jack,      AS_HELP_STRING([--without-jack],[do not use the Jack 
sound support]),
             [if test "x$withval" = "xno"; then ac_cv_header_jack_jack_h=no; 
fi])
 AC_ARG_WITH(jpeg,      AS_HELP_STRING([--without-jpeg],[do not use JPEG]),
@@ -290,6 +288,8 @@ AC_CHECK_PROGS(PKG_CONFIG, pkg-config, false)
 AC_CHECK_PROGS(RSVG, rsvg, false)
 AC_CHECK_PROGS(CONVERT, convert, false)
 AC_CHECK_PROGS(ICOTOOL, icotool, false)
+AC_CHECK_PROGS(WCC, wcc, false)
+AC_CHECK_PROGS(WLINK, wlink, false)
 
 if test "x$enable_maintainer_mode" != "xyes"
 then
@@ -350,6 +350,18 @@ else
 
 fi
 
+if test "x$enable_win16" = "xyes" -a "x$enable_tests" != "xno"
+then
+    case "$WCC" in
+    false)
+        WINE_NOTICE([OpenWatcom compiler not found. Unable to create DOS/Win 3 
programs for testing, so those tests will be skipped.])
+        ;;
+    *)
+        AC_SUBST(WCC_DOS_FLAGS, "-bt=DOS -ml -zq")
+        ;;
+    esac
+fi
+
 case $host_cpu in
   *i[[3456789]]86*)
     AC_PATH_PROG(PRELINK, prelink, false, [/sbin /usr/sbin $PATH])
@@ -398,7 +410,6 @@ AC_CHECK_HEADERS(\
        grp.h \
        gsm.h \
        gsm/gsm.h \
-       icns.h \
        ieeefp.h \
        inet/mib2.h \
        io.h \
@@ -1490,17 +1501,6 @@ fi
 WINE_NOTICE_WITH(gsm,[test "x$ac_cv_lib_soname_gsm" = "x"],
                  [libgsm ${notice_platform}development files not found, gsm 
06.10 codec won't be supported.])
 
-dnl **** Check for libicns ****
-if test "$ac_cv_header_icns_h" = "yes"
-then
-    WINE_CHECK_SONAME(icns,icns_write_family_to_file)
-fi
-case $host_os in
-  darwin*|macosx*)
-    WINE_NOTICE_WITH(icns,[test "x$ac_cv_lib_soname_icns" = "x"],
-                     [libicns ${notice_platform}development files not found, 
ICNS icons won't be supported.]) ;;
-esac
-
 dnl **** Check for libjpeg ****
 if test "$ac_cv_header_jpeglib_h" = "yes"
 then
@@ -2306,32 +2306,12 @@ WINE_CONFIG_DLL(d3d8,,[d3d8])
 WINE_CONFIG_TEST(dlls/d3d8/tests)
 WINE_CONFIG_DLL(d3d9,,[d3d9])
 WINE_CONFIG_TEST(dlls/d3d9/tests)
-WINE_CONFIG_DLL(d3dcompiler_33)
-WINE_CONFIG_DLL(d3dcompiler_34)
-WINE_CONFIG_DLL(d3dcompiler_35)
-WINE_CONFIG_DLL(d3dcompiler_36)
-WINE_CONFIG_DLL(d3dcompiler_37)
-WINE_CONFIG_DLL(d3dcompiler_38)
-WINE_CONFIG_DLL(d3dcompiler_39)
-WINE_CONFIG_DLL(d3dcompiler_40)
 WINE_CONFIG_DLL(d3dcompiler_41)
 WINE_CONFIG_DLL(d3dcompiler_42)
 WINE_CONFIG_DLL(d3dcompiler_43,,[d3dcompiler])
-WINE_CONFIG_TEST(dlls/d3dcompiler_43/tests)
 WINE_CONFIG_DLL(d3dim,,[d3dim])
 WINE_CONFIG_DLL(d3drm,,[d3drm])
 WINE_CONFIG_TEST(dlls/d3drm/tests)
-WINE_CONFIG_DLL(d3dx10_33)
-WINE_CONFIG_DLL(d3dx10_34)
-WINE_CONFIG_DLL(d3dx10_35)
-WINE_CONFIG_DLL(d3dx10_36)
-WINE_CONFIG_DLL(d3dx10_37)
-WINE_CONFIG_DLL(d3dx10_38)
-WINE_CONFIG_DLL(d3dx10_39)
-WINE_CONFIG_DLL(d3dx10_40)
-WINE_CONFIG_DLL(d3dx10_41)
-WINE_CONFIG_DLL(d3dx10_42)
-WINE_CONFIG_DLL(d3dx10_43)
 WINE_CONFIG_DLL(d3dx9_24)
 WINE_CONFIG_DLL(d3dx9_25)
 WINE_CONFIG_DLL(d3dx9_26)
@@ -2372,7 +2352,6 @@ WINE_CONFIG_DLL(display.drv16,enable_win16)
 WINE_CONFIG_DLL(dmband)
 WINE_CONFIG_DLL(dmcompos)
 WINE_CONFIG_DLL(dmime)
-WINE_CONFIG_TEST(dlls/dmime/tests)
 WINE_CONFIG_DLL(dmloader)
 WINE_CONFIG_TEST(dlls/dmloader/tests)
 WINE_CONFIG_DLL(dmscript)
@@ -2774,7 +2753,6 @@ WINE_CONFIG_PROGRAM(extrac32,install)
 WINE_CONFIG_PROGRAM(hh,install)
 WINE_CONFIG_PROGRAM(icinfo,install)
 WINE_CONFIG_PROGRAM(iexplore,install)
-WINE_CONFIG_PROGRAM(ipconfig,install)
 WINE_CONFIG_PROGRAM(lodctr,install)
 WINE_CONFIG_PROGRAM(mshta,install)
 WINE_CONFIG_PROGRAM(msiexec,installbin)
-- 
1.7.0.4

>From fc703956b56caec6a379236d8c8ef7999f98ff95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Morten=20R=C3=B8nne?= <morten.roe...@tdcadsl.dk>
Date: Mon, 23 Aug 2010 22:02:25 +0200
Subject: [PATCH 3/6] Added rules for DOS16 test program building.

Kernel32 tests/Makefile was updated with rules to build DOS 16 bit programs
needed to test krnl386.exe16 implementation.
---
 dlls/kernel32/tests/Makefile.in |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/dlls/kernel32/tests/Makefile.in b/dlls/kernel32/tests/Makefile.in
index 68cdbe4..8b3935f 100644
--- a/dlls/kernel32/tests/Makefile.in
+++ b/dlls/kernel32/tests/Makefile.in
@@ -5,6 +5,9 @@ VPATH     = @srcdir@
 TESTDLL   = kernel32.dll
 IMPORTS   = user32 advapi32
 
+DOS16_C_SRCS = \
+    dosbasic.dos16.c
+
 C_SRCS = \
        actctx.c \
        alloc.c \
@@ -38,8 +41,30 @@ C_SRCS = \
        toolhelp.c \
        version.c \
        virtual.c \
-       volume.c
+       volume.c \
+       $(DOS16_C_SRCS:.dos16.c=.c)
+
+EXTRA_SRCS = $(DOS16_C_SRCS)
+EXTRAINCL = -I../../krnl386.exe16
 
 RC_SRCS = resource.rc
 
 @MAKE_TEST_RULES@
+
+WCC = @WCC@
+
+ifdef WCC
+
+WLINK = @WLINK@
+
+WCC_DOS_FLAGS = @WCC_DOS_FLAGS@
+
+EXE_FILES = $(DOS16_C_SRCS:.dos16.c=.exe)
+
+$(TESTPROGRAM): $(EXE_FILES)
+
+.dos16.c.exe:
+       $(WCC) $(WCC_DOS_FLAGS) 
-I='$(TOPSRCDIR)/include;$(WATCOM)/h;../../krnl386.exe16' $<
+       $(WLINK) option quiet system dos name $@ file $(<:.c=.o) 
+
+endif
-- 
1.7.0.4

>From ef999168e2689347c25470a784c88bd71def7630 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Morten=20R=C3=B8nne?= <morten.roe...@tdcadsl.dk>
Date: Mon, 23 Aug 2010 22:05:41 +0200
Subject: [PATCH 4/6] Updated test include file for DOS test program building

Updated wine's main test include file, to omit/include changes needed to
build DOS 16 bit programs the same way 32 bit test program are build.
---
 include/wine/test.h |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/include/wine/test.h b/include/wine/test.h
index 1a98025..2026556 100644
--- a/include/wine/test.h
+++ b/include/wine/test.h
@@ -23,8 +23,10 @@
 
 #include <stdarg.h>
 #include <stdlib.h>
+#ifndef __WINE_WINE_DOS16_TEST_H
 #include <windef.h>
 #include <winbase.h>
+#endif
 
 #ifdef __WINE_CONFIG_H
 #error config.h should not be used in Wine tests
@@ -60,7 +62,9 @@ extern void winetest_start_todo( const char* platform );
 extern int winetest_loop_todo(void);
 extern void winetest_end_todo( const char* platform );
 extern int winetest_get_mainargs( char*** pargv );
+#ifndef __WINE_WINE_DOS16_TEST_H
 extern void winetest_wait_child_process( HANDLE process );
+#endif
 
 extern const char *wine_dbgstr_wn( const WCHAR *str, int n );
 static inline const char *wine_dbgstr_w( const WCHAR *s ) { return 
wine_dbgstr_wn( s, -1 ); }
@@ -228,6 +232,19 @@ typedef struct
 } tls_data;
 static DWORD tls_index;
 
+#ifdef __WINE_WINE_DOS16_TEST_H
+/* DOS doesn't run threaded, so we just keep one global tls_data */
+tls_data  dos_tls;
+static int tls_init = 0;
+static tls_data* get_tls_data(void)
+{
+    if(!tls_init) {
+        dos_tls.str_pos = dos_tls.strings;
+        tls_init = 1;
+    }
+    return &dos_tls;
+}   
+#else
 static tls_data* get_tls_data(void)
 {
     tls_data* data;
@@ -244,6 +261,7 @@ static tls_data* get_tls_data(void)
     SetLastError(last_error);
     return data;
 }
+#endif /* __WINE_WINE_DOS16_TEST_H */
 
 /* allocate some tmp space for a string */
 static char *get_temp_buffer( size_t n )
@@ -427,6 +445,7 @@ int winetest_get_mainargs( char*** pargv )
     return winetest_argc;
 }
 
+#ifndef __WINE_WINE_DOS16_TEST_H
 void winetest_wait_child_process( HANDLE process )
 {
     DWORD exit_code = 1;
@@ -452,6 +471,7 @@ void winetest_wait_child_process( HANDLE process )
         }
     }
 }
+#endif /* __WINE_WINE_DOS16_TEST_H */
 
 const char *wine_dbgstr_wn( const WCHAR *str, int n )
 {
@@ -557,7 +577,11 @@ static int run_test( const char *name )
 
     if (winetest_debug)
     {
+#ifndef __WINE_WINE_DOS16_TEST_H
         fprintf( stdout, "%s: %d tests executed (%d marked as todo, %d %s), %d 
skipped.\n",
+#else
+        fprintf( stdout, "%s: %ld tests executed (%ld marked as todo, %ld %s), 
%ld skipped.\n",
+#endif
                  test->name, successes + failures + todo_successes + 
todo_failures,
                  todo_successes, failures + todo_failures,
                  (failures + todo_failures != 1) ? "failures" : "failure",
@@ -576,6 +600,7 @@ static void usage( const char *argv0 )
     exit_process(1);
 }
 
+#ifndef __WINE_WINE_DOS16_TEST_H
 /* trap unhandled exceptions */
 static LONG CALLBACK exc_filter( EXCEPTION_POINTERS *ptrs )
 {
@@ -589,6 +614,7 @@ static LONG CALLBACK exc_filter( EXCEPTION_POINTERS *ptrs )
     fflush( stdout );
     return EXCEPTION_EXECUTE_HANDLER;
 }
+#endif /* __WINE_WINE_DOS16_TEST_H */
 
 void _fpreset(void) {} /* override the mingw fpu init code */
 
@@ -607,8 +633,10 @@ int main( int argc, char **argv )
     if (GetEnvironmentVariableA( "WINETEST_INTERACTIVE", p, sizeof(p) )) 
winetest_interactive = atoi(p);
     if (GetEnvironmentVariableA( "WINETEST_REPORT_SUCCESS", p, sizeof(p) )) 
report_success = atoi(p);
 
+#ifndef __WINE_WINE_DOS16_TEST_H
     if (!strcmp( winetest_platform, "windows" )) SetUnhandledExceptionFilter( 
exc_filter );
     if (!winetest_interactive) SetErrorMode( SEM_FAILCRITICALERRORS | 
SEM_NOGPFAULTERRORBOX );
+#endif
 
     if (!argv[1])
     {
-- 
1.7.0.4

>From 8ed22bfc559210646cda7e66a3f485fab0927a78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Morten=20R=C3=B8nne?= <morten.roe...@tdcadsl.dk>
Date: Mon, 23 Aug 2010 22:06:54 +0200
Subject: [PATCH 5/6] DOS 16 bit test include file

Added a new include file which sets up Wine's main test include file for
use with DOS 16 bit programs.
---
 include/wine/dos16test.h |   63 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)
 create mode 100644 include/wine/dos16test.h

diff --git a/include/wine/dos16test.h b/include/wine/dos16test.h
new file mode 100644
index 0000000..28d1158
--- /dev/null
+++ b/include/wine/dos16test.h
@@ -0,0 +1,63 @@
+/*
+ * Definitions for Wine DOS C unit tests.
+ *
+ * Copyright (C) 2010 Morten Rønne
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_WINE_DOS16_TEST_H
+#define __WINE_WINE_DOS16_TEST_H
+
+#include <stdlib.h>
+#include <stdio.h>
+
+typedef int           WORD;
+typedef long int      LONG;
+typedef unsigned char WCHAR;
+typedef long int      DWORD;
+typedef long int      DWORD_PTR;
+typedef long int      ULONG_PTR;
+
+#define LOWORD(l)              ((WORD)((DWORD_PTR)(l) & 0xFFFF))
+
+/* Some functions DOS style */
+void ExitProcess(int code)
+{
+    exit(code);
+}
+
+/* Since we are not threaded, no need to do anything special */
+void InterlockedIncrement(LONG *ptr)
+{
+    (*ptr)++;
+}
+
+int TlsAlloc(void)
+{
+    return 0;
+}
+
+int GetEnvironmentVariableA( const char *name, char *value, int max_size)
+{
+    value[0] = '\0';
+    return 0;
+}
+
+#define STANDALONE  1
+
+#include "wine/test.h"
+
+#endif
-- 
1.7.0.4

>From 682471b8d8fe1658fac25cf843cc2755587b0aa5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Morten=20R=C3=B8nne?= <morten.roe...@tdcadsl.dk>
Date: Mon, 23 Aug 2010 22:08:08 +0200
Subject: [PATCH 6/6] New DOS 16 bit test program

Added a 32 bit wrapper program for a 16 bit DOS test program.
---
 dlls/kernel32/tests/dosbasic.c       |   60 ++++++++++++++++++++++++++++++
 dlls/kernel32/tests/dosbasic.dos16.c |   66 ++++++++++++++++++++++++++++++++++
 2 files changed, 126 insertions(+), 0 deletions(-)
 create mode 100644 dlls/kernel32/tests/dosbasic.c
 create mode 100644 dlls/kernel32/tests/dosbasic.dos16.c

diff --git a/dlls/kernel32/tests/dosbasic.c b/dlls/kernel32/tests/dosbasic.c
new file mode 100644
index 0000000..bd65082
--- /dev/null
+++ b/dlls/kernel32/tests/dosbasic.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2010 Morten Rønne
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "wine/test.h"
+
+static void run_program(LPSTR name)
+{
+    STARTUPINFOA si;
+    PROCESS_INFORMATION pi;
+
+    /* The file is not found, then tests are not run, so we return */
+    if(GetFileAttributes(name) == INVALID_FILE_ATTRIBUTES) {
+        skip("Needed DOS program not found. (This test needs OpenWatcom 
installed)\n");
+        return;
+    }
+    memset(&si, 0, sizeof(si));
+    si.cb = sizeof(si);
+    if (CreateProcessA(NULL, name, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
+    {
+        /* Wait for the process to finish (360 seconds timeout) */
+        WaitForSingleObject( pi.hProcess, 360000 );
+        CloseHandle(pi.hThread);
+        CloseHandle(pi.hProcess);
+        /* Do not report from this program, the DOS program already did
+           that */
+        winetest_debug = 0;
+        return;
+    }
+    ok(FALSE, "Failed to run %s test. Last Error: 0x%04x", name, 
GetLastError());
+    return;
+}
+
+
+START_TEST(dosbasic)
+{
+    /*
+     *  We are testing DOS functions which requires 16 bit mode.
+     *  But this program runs in 32 bit mode.
+     *  So we load a 16 bit test program to do the actual testing.
+     */
+
+     /* First test int 21 which are required by all the others */
+     run_program((LPSTR)"dosbasic.exe");
+}
+
diff --git a/dlls/kernel32/tests/dosbasic.dos16.c 
b/dlls/kernel32/tests/dosbasic.dos16.c
new file mode 100644
index 0000000..5483190
--- /dev/null
+++ b/dlls/kernel32/tests/dosbasic.dos16.c
@@ -0,0 +1,66 @@
+/*
+ *  DOSBASIC.DOS16.C
+ *
+ * Copyright 2010 Morten Rønne
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ * -------------------------------------------------------------------------
+ *
+ *  Test the basic operation of DOS (Disk Operating System).
+ *
+ *  This file is compiled as a 16 bit DOS program (.EXE).
+ *  Reference compiler is OpenWatcom version 1.9 (www.openwatcom.org).
+ *
+ */
+
+#include <i86.h>
+#include "wine/dos16test.h"
+
+#define   DOS_INTERRUPT   0x21
+
+/*
+ *   test_serial_number
+ *
+ *   Test that the serial function returns proper values.
+ */
+
+void test_serial_number(void)
+{
+    union REGS   in_regs,
+                 out_regs;
+
+    /* In:  AH = 0x30, AL = flag */
+    /* Out: AL = Major, AH = Minor, BH = flag, BL:CX = Serial number */
+    in_regs.h.ah =  0x30;
+    in_regs.h.al =  0x01;
+    int86( DOS_INTERRUPT, &in_regs, &out_regs);
+
+    /* BH bit 3 tells if DOS is stored in ROM */
+    ok((out_regs.h.bh & 8) == 0, "DOS ROM flag is 0. Got %d\n", out_regs.h.bh);
+
+    todo_wine {
+        ok(out_regs.h.bl == 0 && out_regs.w.cx == 0,
+            "Serial number is zero. Got %02x%04x\n",
+            out_regs.h.bl, out_regs.w.cx);
+    }
+}
+
+START_TEST(dosbasic)
+{
+    test_serial_number();
+}
+
+
-- 
1.7.0.4



Reply via email to