-# $Id: Makefile,v 1.237 2004/07/20 19:24:39 sedwards Exp $
+# $Id: Makefile,v 1.238 2004/07/23 20:03:24 chorns Exp $
#
# Global makefile
#
$(EXT_MODULES:%=%_depends) $(POSIX_LIBS:%=%_depends)
implib: $(COMPONENTS:%=%_implib) $(HALS:%=%_implib) $(BUS:%=%_implib) \
- $(LIB_STATIC:%=%_implib) $(LIB_FSLIB:%=%_implib) $(DLLS:%=%_implib) $(LOADERS:%=%_implib) \
- $(KERNEL_DRIVERS:%=%_implib) $(SUBSYS:%=%_implib) \
- $(SYS_SVC:%=%_implib) $(EXT_MODULES:%=%_implib)
+ $(LIB_STATIC:%=%_implib) $(LIB_FSLIB:%=%_implib) $(DLLS:%=%_implib) $(LOADERS:%=%_implib) \
+ $(KERNEL_DRIVERS:%=%_implib) $(SUBSYS:%=%_implib) \
+ $(SYS_SVC:%=%_implib) $(EXT_MODULES:%=%_implib)
+
+test: $(COMPONENTS:%=%_test) $(HALS:%=%_test) $(BUS:%=%_test) \
+ $(LIB_STATIC:%=%_test) $(LIB_FSLIB:%=%_test) $(DLLS:%=%_test) $(LOADERS:%=%_test) \
+ $(KERNEL_DRIVERS:%=%_test) $(SUBSYS:%=%_test) \
+ $(SYS_SVC:%=%_test) $(EXT_MODULES:%=%_test)
clean: tools dk_clean $(HALS:%=%_clean) \
$(COMPONENTS:%=%_clean) $(BUS:%=%_clean) $(LIB_STATIC:%=%_clean) $(LIB_FSLIB:%=%_clean) $(DLLS:%=%_clean) \
$(CABMAN) /C bootdata/packages/reactos.dff /L $(BOOTCD_DIR)/reactos /I
$(CABMAN) /C bootdata/packages/reactos.dff /RC $(BOOTCD_DIR)/reactos/reactos.inf /L $(BOOTCD_DIR)/reactos /N
- $(RM) $(BOOTCD_DIR)/reactos/reactos.inf
- $(TOOLS_PATH)/cdmake/cdmake -v -m -b $(BOOTCD_DIR)/../isoboot.bin $(BOOTCD_DIR) REACTOS ReactOS.iso
+ $(CDMAKE) -v -m -b $(BOOTCD_DIR)/../isoboot.bin $(BOOTCD_DIR) REACTOS ReactOS.iso
ubootcd_unattend:
$(CP) bootdata/unattend.inf $(BOOTCD_DIR)/reactos/unattend.inf
$(MAKE) LIVECD_INSTALL=yes fastinstall
livecd_install_before:
- $(TOOLS_PATH)/mkhive/mkhive$(EXE_POSTFIX) bootdata $(LIVECD_DIR)/reactos/system32/config bootdata/livecd.inf bootdata/hiveinst.inf
+ $(MKHIVE) bootdata $(LIVECD_DIR)/reactos/system32/config bootdata/livecd.inf bootdata/hiveinst.inf
livecd_basic: livecd_directory_layout livecd_bootstrap_files livecd_install_before
livecd_makecd:
- $(TOOLS_PATH)/cdmake/cdmake -m -j -b $(LIVECD_DIR)/../isoboot.bin $(LIVECD_DIR) REACTOS roslive.iso
+ $(CDMAKE) -m -j -b $(LIVECD_DIR)/../isoboot.bin $(LIVECD_DIR) REACTOS roslive.iso
bootcd: bootcd_basic bootcd_makecd
livecd: livecd_basic livecd_makecd
registry: tools
- $(TOOLS_PATH)/mkhive/mkhive$(EXE_POSTFIX) bootdata $(INSTALL_DIR)/system32/config bootdata/hiveinst.inf
+ $(MKHIVE) bootdata $(INSTALL_DIR)/system32/config bootdata/hiveinst.inf
-.PHONY: all depends implib clean clean_before install freeldr bootcd_directory_layout \
+.PHONY: all depends implib test clean clean_before install freeldr bootcd_directory_layout \
bootcd_bootstrap_files bootcd_install_before bootcd_basic bootcd_makecd ubootcd_unattend bootcd
$(SYS_APPS:%=%_implib): %_implib:
$(MAKE) -C subsys/system/$* implib
+$(SYS_APPS:%=%_test): %_test:
+ $(MAKE) -C subsys/system/$* test
+
$(SYS_APPS:%=%_clean): %_clean:
$(MAKE) -C subsys/system/$* clean
$(SYS_APPS:%=%_bootcd): %_bootcd:
$(MAKE) -C subsys/system/$* bootcd
-.PHONY: $(SYS_APPS) $(SYS_APPS:%=%_implib) $(SYS_APPS:%=%_clean) $(SYS_APPS:%=%_install) $(SYS_APPS:%=%_bootcd)
+.PHONY: $(SYS_APPS) $(SYS_APPS:%=%_implib) $(SYS_APPS:%=%_test) \
+ $(SYS_APPS:%=%_clean) $(SYS_APPS:%=%_install) $(SYS_APPS:%=%_bootcd)
#
# System Services
$(SYS_SVC:%=%_implib): %_implib:
$(MAKE) -C services/$* implib
+$(SYS_SVC:%=%_test): %_test:
+ $(MAKE) -C services/$* test
+
$(SYS_SVC:%=%_clean): %_clean:
$(MAKE) -C services/$* clean
$(SYS_SVC:%=%_install): %_install:
$(MAKE) -C services/$* install
-.PHONY: $(SYS_SVC) $(SYS_SVC:%=%_depends) $(SYS_SVC:%=%_implib) $(SYS_SVC:%=%_clean) $(SYS_SVC:%=%_install)
+.PHONY: $(SYS_SVC) $(SYS_SVC:%=%_depends) $(SYS_SVC:%=%_implib) \
+ $(SYS_SVC:%=%_test) $(SYS_SVC:%=%_clean) $(SYS_SVC:%=%_install)
#
# $(APPS:%=%_implib): %_implib:
# $(MAKE) -C apps/$* implib
+$(APPS:%=%_test): %_test:
+ $(MAKE) -C apps/$* test
+
$(APPS:%=%_clean): %_clean:
$(MAKE) -C apps/$* clean
$(APPS:%=%_install): %_install:
$(MAKE) -C apps/$* install
-.PHONY: $(APPS) $(APPS:%=%_implib) $(APPS:%=%_clean) $(APPS:%=%_install)
+.PHONY: $(APPS) $(APPS:%=%_test) $(APPS:%=%_clean) $(APPS:%=%_install)
#
$(MAKE) -C tools
tools_implib:
+
+
+tools_test:
+
tools_clean:
$(MAKE) -C tools clean
tools_install:
-.PHONY: tools tools_implib tools_clean tools_install
+.PHONY: tools tools_implib tools_test tools_clean tools_install
#
$(MAKE) -C iface/native
iface_native_implib:
-
+
+iface_native_test:
+
iface_native_clean:
$(MAKE) -C iface/native clean
$(MAKE) -C iface/addsys
iface_additional_implib:
-
+
+iface_additional_test:
+
iface_additional_clean:
$(MAKE) -C iface/addsys clean
iface_additional_bootcd:
-.PHONY: iface_native iface_native_implib iface_native_clean iface_native_install \
- iface_native_bootcd \
- iface_additional iface_additional_implib iface_additional_clean \
+.PHONY: iface_native iface_native_implib iface_native_test iface_native_clean \
+ iface_native_install iface_native_bootcd iface_additional \
+ iface_additional_implib iface_additional_test iface_additional_clean \
iface_additional_install iface_additional_bootcd
$(BUS:%=%_implib): %_implib:
$(MAKE) -C drivers/bus/$* implib
+$(BUS:%=%_test): %_test:
+ $(MAKE) -C drivers/bus/$* test
+
$(BUS:%=%_clean): %_clean:
$(MAKE) -C drivers/bus/$* clean
$(DRIVERS_LIB:%=%_implib): %_implib:
$(MAKE) -C drivers/lib/$* implib
+$(DRIVERS_LIB:%=%_test): %_test:
+ $(MAKE) -C drivers/lib/$* test
+
$(DRIVERS_LIB:%=%_clean): %_clean:
$(MAKE) -C drivers/lib/$* clean
$(DRIVERS_LIB:%=%_bootcd): %_bootcd:
$(MAKE) -C drivers/lib/$* bootcd
-.PHONY: $(DRIVERS_LIB) $(DRIVERS_LIB:%=%_implib) $(DRIVERS_LIB:%=%_clean) \
- $(DRIVERS_LIB:%=%_install) $(DRIVERS_LIB:%=%_bootcd)
+.PHONY: $(DRIVERS_LIB) $(DRIVERS_LIB:%=%_implib) $(DRIVERS_LIB:%=%_test) \
+ $(DRIVERS_LIB:%=%_clean) $(DRIVERS_LIB:%=%_install) $(DRIVERS_LIB:%=%_bootcd)
#
$(DEVICE_DRIVERS:%=%_implib): %_implib:
$(MAKE) -C drivers/dd/$* implib
+$(DEVICE_DRIVERS:%=%_test): %_test:
+ $(MAKE) -C drivers/dd/$* test
+
$(DEVICE_DRIVERS:%=%_clean): %_clean:
$(MAKE) -C drivers/dd/$* clean
$(DEVICE_DRIVERS:%=%_bootcd): %_bootcd:
$(MAKE) -C drivers/dd/$* bootcd
-.PHONY: $(DEVICE_DRIVERS) $(DEVICE_DRIVERS:%=%_implib) $(DEVICE_DRIVERS:%=%_clean) \
- $(DEVICE_DRIVERS:%=%_install) $(DEVICE_DRIVERS:%=%_bootcd)
+.PHONY: $(DEVICE_DRIVERS) $(DEVICE_DRIVERS:%=%_implib) $(DEVICE_DRIVERS:%=%_test) \
+ $(DEVICE_DRIVERS:%=%_clean) $(DEVICE_DRIVERS:%=%_install) $(DEVICE_DRIVERS:%=%_bootcd)
#
VIDEO_DRIVERS_implib:
$(MAKE) -C drivers/video implib
+VIDEO_DRIVERS_test:
+ $(MAKE) -C drivers/video test
+
VIDEO_DRIVERS_clean:
$(MAKE) -C drivers/video clean
VIDEO_DRIVERS_bootcd:
$(MAKE) -C drivers/video bootcd
-.PHONY: VIDEO_DRIVERS VIDEO_DRIVERS_implib VIDEO_DRIVERS_clean \
- VIDEO_DRIVERS_install VIDEO_DRIVERS_bootcd
+.PHONY: VIDEO_DRIVERS VIDEO_DRIVERS_implib VIDEO_DRIVERS_test\
+ VIDEO_DRIVERS_clean VIDEO_DRIVERS_install VIDEO_DRIVERS_bootcd
#
$(INPUT_DRIVERS:%=%_implib): %_implib:
$(MAKE) -C drivers/input/$* implib
+$(INPUT_DRIVERS:%=%_test): %_test:
+ $(MAKE) -C drivers/input/$* test
+
$(INPUT_DRIVERS:%=%_clean): %_clean:
$(MAKE) -C drivers/input/$* clean
$(INPUT_DRIVERS:%=%_bootcd): %_bootcd:
$(MAKE) -C drivers/input/$* bootcd
-.PHONY: $(INPUT_DRIVERS) $(INPUT_DRIVERS:%=%_implib) $(INPUT_DRIVERS:%=%_clean)\
- $(INPUT_DRIVERS:%=%_install) $(INPUT_DRIVERS:%=%_bootcd)
+.PHONY: $(INPUT_DRIVERS) $(INPUT_DRIVERS:%=%_implib) $(INPUT_DRIVERS:%=%_test) \
+ $(INPUT_DRIVERS:%=%_clean) $(INPUT_DRIVERS:%=%_install) $(INPUT_DRIVERS:%=%_bootcd)
#
# Filesystem driver rules
$(FS_DRIVERS:%=%_implib): %_implib:
$(MAKE) -C drivers/fs/$* implib
+$(FS_DRIVERS:%=%_test): %_test:
+ $(MAKE) -C drivers/fs/$* test
+
$(FS_DRIVERS:%=%_clean): %_clean:
$(MAKE) -C drivers/fs/$* clean
$(FS_DRIVERS:%=%_bootcd): %_bootcd:
$(MAKE) -C drivers/fs/$* bootcd
-.PHONY: $(FS_DRIVERS) $(FS_DRIVERS:%=%_implib) $(FS_DRIVERS:%=%_clean) \
- $(FS_DRIVERS:%=%_install) $(FS_DRIVERS:%=%_bootcd)
+.PHONY: $(FS_DRIVERS) $(FS_DRIVERS:%=%_implib) $(FS_DRIVERS:%=%_test) \
+ $(FS_DRIVERS:%=%_clean) $(FS_DRIVERS:%=%_install) $(FS_DRIVERS:%=%_bootcd)
#
$(NET_DRIVERS:%=%_implib): %_implib:
$(MAKE) -C drivers/net/$* implib
+$(NET_DRIVERS:%=%_test): %_test:
+ $(MAKE) -C drivers/net/$* test
+
$(NET_DRIVERS:%=%_clean): %_clean:
$(MAKE) -C drivers/net/$* clean
$(NET_DRIVERS:%=%_bootcd): %_bootcd:
$(MAKE) -C drivers/net/$* bootcd
-.PHONY: $(NET_DRIVERS) $(NET_DRIVERS:%=%_implib) $(NET_DRIVERS:%=%_clean) \
- $(NET_DRIVERS:%=%_install) $(NET_DRIVERS:%=%_bootcd)
+.PHONY: $(NET_DRIVERS) $(NET_DRIVERS:%=%_implib) $(NET_DRIVERS:%=%_test) \
+ $(NET_DRIVERS:%=%_clean) $(NET_DRIVERS:%=%_install) $(NET_DRIVERS:%=%_bootcd)
#
$(NET_DEVICE_DRIVERS:%=%_implib): %_implib:
$(MAKE) -C drivers/net/dd/$* implib
+$(NET_DEVICE_DRIVERS:%=%_test): %_test:
+ $(MAKE) -C drivers/net/dd/$* test
+
$(NET_DEVICE_DRIVERS:%=%_clean): %_clean:
$(MAKE) -C drivers/net/dd/$* clean
$(NET_DEVICE_DRIVERS:%=%_bootcd): %_bootcd:
$(MAKE) -C drivers/net/dd/$* bootcd
-.PHONY: $(NET_DEVICE_DRIVERS) $(NET_DEVICE_DRIVERS:%=%_clean) $(NET_DEVICE_DRIVERS:%=%_implib) \
+.PHONY: $(NET_DEVICE_DRIVERS) $(NET_DEVICE_DRIVERS:%=%_clean) \
+ $(NET_DEVICE_DRIVERS:%=%_implib) $(NET_DEVICE_DRIVERS:%=%_test) \
$(NET_DEVICE_DRIVERS:%=%_install) $(NET_DEVICE_DRIVERS:%=%_bootcd)
$(STORAGE_DRIVERS:%=%_implib): %_implib:
$(MAKE) -C drivers/storage/$* implib
+$(STORAGE_DRIVERS:%=%_test): %_test:
+ $(MAKE) -C drivers/storage/$* test
+
$(STORAGE_DRIVERS:%=%_clean): %_clean:
$(MAKE) -C drivers/storage/$* clean
$(STORAGE_DRIVERS:%=%_bootcd): %_bootcd:
$(MAKE) -C drivers/storage/$* bootcd
-.PHONY: $(STORAGE_DRIVERS) $(STORAGE_DRIVERS:%=%_clean) $(STORAGE_DRIVERS:%=%_implib) \
- $(STORAGE_DRIVERS:%=%_install) $(STORAGE_DRIVERS:%=%_bootcd)
+.PHONY: $(STORAGE_DRIVERS) $(STORAGE_DRIVERS:%=%_clean) \
+ $(STORAGE_DRIVERS:%=%_implib) $(STORAGE_DRIVERS:%=%_test) \
+ $(STORAGE_DRIVERS:%=%_install) $(STORAGE_DRIVERS:%=%_bootcd)
#
$(LOADERS:%=%_implib): %_implib:
+$(LOADERS:%=%_test): %_test:
+
$(LOADERS:%=%_clean): %_clean:
$(MAKE) -C loaders/$* clean
$(LOADERS:%=%_install): %_install:
$(MAKE) -C loaders/$* install
-.PHONY: $(LOADERS) $(LOADERS:%=%_implib) $(LOADERS:%=%_clean) $(LOADERS:%=%_install)
+.PHONY: $(LOADERS) $(LOADERS:%=%_implib) $(LOADERS:%=%_test) \
+ $(LOADERS:%=%_clean) $(LOADERS:%=%_install)
#
ntoskrnl_implib:
$(MAKE) -C ntoskrnl implib
+ntoskrnl_test:
+ $(MAKE) -C ntoskrnl test
+
ntoskrnl_clean:
$(MAKE) -C ntoskrnl clean
ntoskrnl_bootcd:
$(MAKE) -C ntoskrnl bootcd
-.PHONY: ntoskrnl ntoskrnl_implib ntoskrnl_clean ntoskrnl_install ntoskrnl_bootcd
+.PHONY: ntoskrnl ntoskrnl_implib ntoskrnl_test \
+ ntoskrnl_clean ntoskrnl_install ntoskrnl_bootcd
#
hallib_implib:
$(MAKE) -C hal/hal implib
+hallib_test:
+ $(MAKE) -C hal/hal test
+
hallib_clean:
$(MAKE) -C hal/hal clean
hallib_bootcd:
$(MAKE) -C hal/hal bootcd
-.PHONY: hallib hallib_implib hallib_clean hallib_install hallib_bootcd
+.PHONY: hallib hallib_implib hallib_test hallib_clean \
+ hallib_install hallib_bootcd
#
$(HALS:%=%_implib): %_implib:
$(MAKE) -C hal/$* implib
+$(HALS:%=%_test): %_test:
+ $(MAKE) -C hal/$* test
+
$(HALS:%=%_clean): %_clean:
$(MAKE) -C hal/$* clean
$(HALS:%=%_bootcd): %_bootcd:
$(MAKE) -C hal/$* bootcd
-.PHONY: $(HALS) $(HALS:%=%_implib) $(HALS:%=%_clean) $(HALS:%=%_install) $(HALS:%=%_bootcd)
+.PHONY: $(HALS) $(HALS:%=%_implib) $(HALS:%=%_test) \
+ $(HALS:%=%_clean) $(HALS:%=%_install) $(HALS:%=%_bootcd)
#
$(LIB_FSLIB:%=%_implib): %_implib:
$(MAKE) -C lib/fslib/$* implib
+$(LIB_FSLIB:%=%_test): %_test:
+ $(MAKE) -C lib/fslib/$* test
+
$(LIB_FSLIB:%=%_clean): %_clean:
$(MAKE) -C lib/fslib/$* clean
$(LIB_FSLIB:%=%_bootcd): %_bootcd:
$(MAKE) -C lib/fslib/$* bootcd
-.PHONY: $(LIB_FSLIB) $(LIB_FSLIB:%=%_depends) $(LIB_FSLIB:%=%_implib) $(LIB_FSLIB:%=%_clean) \
- $(LIB_FSLIB:%=%_install) $(LIB_FSLIB:%=%_bootcd)
+.PHONY: $(LIB_FSLIB) $(LIB_FSLIB:%=%_depends) $(LIB_FSLIB:%=%_implib) \
+ $(LIB_FSLIB:%=%_test) $(LIB_FSLIB:%=%_clean) \
+ $(LIB_FSLIB:%=%_install) $(LIB_FSLIB:%=%_bootcd)
#
$(LIB_STATIC:%=%_implib): %_implib:
$(MAKE) -C lib/$* implib
+$(LIB_STATIC:%=%_test): %_test:
+ $(MAKE) -C lib/$* test
+
$(LIB_STATIC:%=%_clean): %_clean:
$(MAKE) -C lib/$* clean
$(LIB_STATIC:%=%_bootcd): %_bootcd:
$(MAKE) -C lib/$* bootcd
-.PHONY: $(LIB_STATIC) $(LIB_STATIC:%=%_depends) $(LIB_STATIC:%=%_implib) $(LIB_STATIC:%=%_clean) \
- $(LIB_STATIC:%=%_install) $(LIB_STATIC:%=%_bootcd)
+.PHONY: $(LIB_STATIC) $(LIB_STATIC:%=%_depends) $(LIB_STATIC:%=%_implib) \
+ $(LIB_STATIC:%=%_test) $(LIB_STATIC:%=%_clean) \
+ $(LIB_STATIC:%=%_install) $(LIB_STATIC:%=%_bootcd)
#
$(DLLS:%=%_implib): %_implib:
$(MAKE) -C lib/$* implib
+$(DLLS:%=%_test): %_test:
+ $(MAKE) -C lib/$* test
+
$(DLLS:%=%_clean): %_clean:
$(MAKE) -C lib/$* clean
$(DLLS:%=%_bootcd): %_bootcd:
$(MAKE) -C lib/$* bootcd
-.PHONY: $(DLLS) $(DLLS:%=%_depends) $(DLLS:%=%_implib) $(DLLS:%=%_clean) $(DLLS:%=%_install) \
- $(DLLS:%=%_bootcd)
+.PHONY: $(DLLS) $(DLLS:%=%_depends) $(DLLS:%=%_implib) $(DLLS:%=%_test) \
+ $(DLLS:%=%_clean) $(DLLS:%=%_install) $(DLLS:%=%_bootcd)
#
$(SUBSYS:%=%_implib): %_implib:
$(MAKE) -C subsys/$* implib
+$(SUBSYS:%=%_test): %_test:
+ $(MAKE) -C subsys/$* test
+
$(SUBSYS:%=%_clean): %_clean:
$(MAKE) -C subsys/$* clean
$(SUBSYS:%=%_bootcd): %_bootcd:
$(MAKE) -C subsys/$* bootcd
-.PHONY: $(SUBSYS) $(SUBSYS:%=%_depends) $(SUBSYS:%=%_implib) $(SUBSYS:%=%_clean) $(SUBSYS:%=%_install) \
- $(SUBSYS:%=%_bootcd)
+.PHONY: $(SUBSYS) $(SUBSYS:%=%_depends) $(SUBSYS:%=%_implib) $(SUBSYS:%=%_test) \
+ $(SUBSYS:%=%_clean) $(SUBSYS:%=%_install) $(SUBSYS:%=%_bootcd)
#
# Regression testsuite
doxygen Doxyfile
.PHONY: docu
-
-
-# EOF
-
static char *makefile;
static char *umstubfile;
static char *kmstubfile;
+static char *exestubfile;
-char* convert_path(char* origpath)
+static char*
+convert_path(char* origpath)
{
char* newpath;
int i;
return(newpath);
}
-static void write_line(char *line)
+static void
+write_line(char *line)
{
int n_out;
char buf[200];
n_out = fwrite(&buf[0], 1, strlen(buf), out);
}
-static void change_extension(char *filenamebuffer, char *filename, char *newextension)
+static void
+change_extension(char *filenamebuffer,
+ char *filename,
+ char *newextension)
{
char *ptr;
}
}
+static void
+get_test_name(char *filename,
+ char *testname)
+{
+ int i;
+
+ strcpy(testname, filename);
+
+ i = strlen(testname);
+ while (i > 0 && testname[i] != '.')
+ {
+ i--;
+ }
+ if (i > 0)
+ {
+ testname[i] = 0;
+ }
+
+ /* Make a capital first letter and make all other letters lower case */
+ testname[0] = toupper(testname[0]);
+ if (!((testname[0] >= 'A' && testname[0] <= 'Z') ||
+ (testname[0] >= '0' && testname[0] <= '9')))
+ {
+ testname[0] = '_';
+ }
+ i = 1;
+ while (i < strlen(testname))
+ {
+ testname[i] = tolower(testname[i]);
+ if (!((testname[i] >= 'a' && testname[i] <= 'z') ||
+ (testname[i] >= '0' && testname[i] <= '9')))
+ {
+ testname[i] = '_';
+ }
+ i++;
+ }
+}
+
/*
* filename - name of file to make registrations for
- * regtype - type of registration (0 = prototype, 1 = call, 2 = makefile)
+ * type - type of registration (0 = prototype, 1 = call, 2 = makefile)
*/
-void register_test(char *filename, int type)
+static void
+register_test(char *filename,
+ int type)
{
char ext[100];
char testname[100];
char call[100];
char regtest[100];
char filenamebuffer[MAX_PATH];
- int i, j;
-
- strcpy(testname, filename);
+ int i;
- i = strlen(testname);
- while (i > 0 && testname[i] != '.')
+ i = strlen(filename);
+ while (i > 0 && filename[i] != '.')
{
i--;
}
if (i > 0)
{
memset(ext, 0, sizeof(ext));
- strncpy(&ext[0], &testname[i], strlen(&testname[i]));
+ strncpy(&ext[0], &filename[i], strlen(&filename[i]));
if ((strncmp(ext, ".c", 2) != 0) && (strncmp(ext, ".C", 2) != 0))
{
return;
}
-
- testname[i] = 0;
}
else
{
return;
}
- // Make a capital first letter and make all other letters lower case
- testname[0] = toupper(testname[0]);
- if (!((testname[0] >= 'A' && testname[0] <= 'Z') ||
- (testname[0] >= '0' && testname[0] <= '9')))
- {
- testname[0] = '_';
- }
- j = 1;
- while (j < strlen(testname))
- {
- testname[j] = tolower(testname[j]);
- if (!((testname[j] >= 'a' && testname[j] <= 'z') ||
- (testname[j] >= '0' && testname[j] <= '9')))
- {
- testname[j] = '_';
- }
- j++;
- }
+ memset(testname, 0, sizeof(testname));
+ get_test_name(filename, testname);
if (type == 0)
{
#endif
static int
-is_file_changed(char *filename, char *content)
+is_file_changed(char *filename,
+ char *content)
{
FILE *file;
int size;
}
static int
-write_file_if_changed(char *filename, char *content)
+write_file_if_changed(char *filename,
+ char *content)
{
FILE *file;
int n;
" }\n"
"}\n";
+static char EXESTUB[] =
+ "/* This file is autogenerated. */\n"
+ "\n"
+ "#include <stdio.h>\n"
+ "#include <windows.h>\n"
+ "#define NTOS_MODE_USER\n"
+ "#include <ntos.h>\n"
+ "#include \"regtests.h\"\n"
+ "\n"
+ "PVOID\n"
+ "AllocateMemory(ULONG Size)\n"
+ "{\n"
+ " return (PVOID) RtlAllocateHeap(RtlGetProcessHeap(), 0, Size);\n"
+ "}\n"
+ "\n"
+ "VOID\n"
+ "FreeMemory(PVOID Base)\n"
+ "{\n"
+ " RtlFreeHeap(RtlGetProcessHeap(), 0, Base);\n"
+ "}\n"
+ "\n"
+ "void\n"
+ "ConsoleWrite(char *Buffer)\n"
+ "{\n"
+ " printf(Buffer);\n"
+ "}\n"
+ "\n"
+ "ULONG\n"
+ "DbgPrint(PCH Format, ...)\n"
+ "{\n"
+ " return 0;\n"
+ "}\n"
+ "\n"
+ "int __stdcall WinMain(HINSTANCE hInstance,\n"
+ " HINSTANCE hPrevInstance,\n"
+ " LPSTR lpCmdLine,\n"
+ " int nCmdShow)\n"
+ "{\n"
+ " InitializeTests();\n"
+ " RegisterTests();\n"
+ " PerformTests(ConsoleWrite, NULL);\n"
+ " return 0;\n"
+ "}\n";
+
static char HELP[] =
- "REGTESTS path file makefile [-u umstubfile] [-k kmstubfile]\n"
+ "REGTESTS path file makefile [-u umstubfile] [-k kmstubfile] [-e exestubfile]\n"
"\n"
" path Path to files\n"
" file Registration file to create\n"
" makefile Makefile to create\n"
" umstubfile Optional stub for running tests internal to a user-mode module\n"
- " kmstubfile Optional stub for running tests internal to a kernel-mode module\n";
+ " kmstubfile Optional stub for running tests internal to a kernel-mode module\n"
+ " exestubfile Optional stub for running tests internal to a module in the build environment\n";
-int main(int argc, char **argv)
+int main(int argc,
+ char **argv)
{
char buf[MAX_PATH];
int i;
umstubfile = NULL;
kmstubfile = NULL;
+ exestubfile = NULL;
for (i = 4; i < argc; i++)
{
if (argv[i][0] == '-')
{
printf("Missing kmstubfile\n");
return 1;
+ }
+ }
+ else if (argv[i][1] == 'e')
+ {
+ exestubfile = convert_path(argv[++i]);
+ if (exestubfile[0] == 0)
+ {
+ printf("Missing exestubfile\n");
+ return 1;
}
}
else
}
}
+ /* Executable stubfile */
+ if (exestubfile != NULL)
+ {
+ if (write_file_if_changed(exestubfile, EXESTUB) != 0)
+ {
+ perror("Cannot create output executable stubfile");
+ return 1;
+ }
+ }
+
return 0;
}