[PATCH 6/6] New DOS 16 bit test program
Morten Rønne
morten.roenne at tdcadsl.dk
Mon Aug 23 15:08:08 CDT 2010
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
--------------010804060206000305020908--
More information about the wine-devel
mailing list