* regtests/Makefile: Generate regression test registrations.
* regtests/kmregtests/.cvsignore: Ignore Makefile.tests.
* regtests/win32base/.cvsignore: Ditto.
* regtests/kmregtests/Makefile: Include Makefile.tests.
* regtests/win32base/Makefile: Ditto.
* regtests/kmregtests/tests: New directory.
* regtests/win32base/tests: Ditto.
* regtests/kmregtests/tests/.cvsignore: New file.
* regtests/win32base/tests/.cvsignore: Ditto.
* tools/helper.mk: Remove TARGET_GENREGTESTS.
* tools/regtests.c: Generate makefile for regression tests.
(change_extension): New function.
* regtests/win32base/file-1.c: Move ...
* regtests/win32base/tests/file-1.c: ... here.
svn path=/trunk/; revision=6883
+2003-12-07 Casper S. Hornstrup <chorns@users.sourceforge.net>
+
+ * regtests/Makefile: Generate regression test registrations.
+ * regtests/kmregtests/.cvsignore: Ignore Makefile.tests.
+ * regtests/win32base/.cvsignore: Ditto.
+ * regtests/kmregtests/Makefile: Include Makefile.tests.
+ * regtests/win32base/Makefile: Ditto.
+ * regtests/kmregtests/tests: New directory.
+ * regtests/win32base/tests: Ditto.
+ * regtests/kmregtests/tests/.cvsignore: New file.
+ * regtests/win32base/tests/.cvsignore: Ditto.
+ * tools/helper.mk: Remove TARGET_GENREGTESTS.
+ * tools/regtests.c: Generate makefile for regression tests.
+ (change_extension): New function.
+ * regtests/win32base/file-1.c: Move ...
+ * regtests/win32base/tests/file-1.c: ... here.
+
2003-12-06 Martin Fuchs <martin-fuchs@gmx.net>
* Doxyfile, Makefile: initial doxygen configuration
* drivers/Doxyfile, drivers/Makefile: Ditto.
-# $Id: Makefile,v 1.1 2003/07/11 18:13:57 chorns Exp $
+# $Id: Makefile,v 1.2 2003/12/07 11:34:41 chorns Exp $
-all:
+PATH_TO_TOP = ..
+
+all: registrations
$(MAKE) -C shared all
$(MAKE) -C win32base all
$(MAKE) -C kmregtests all
$(MAKE) -C regtests all
clean:
- $(MAKE) -C shared clean
- $(MAKE) -C win32base clean
- $(MAKE) -C kmregtests clean
- $(MAKE) -C kmrtint clean
- $(MAKE) -C regtests clean
+ - $(MAKE) -C shared clean
+ - $(MAKE) -C win32base clean
+ - $(MAKE) -C kmregtests clean
+ - $(MAKE) -C kmrtint clean
+ - $(MAKE) -C regtests clean
+ - $(RM) ./kmregtests/_regtests.c ./kmregtests/Makefile.tests
+ - $(RM) ./win32base/_regtests.c ./win32base/Makefile.tests
install:
$(MAKE) -C shared install
$(MAKE) -C kmrtint install
$(MAKE) -C regtests install
-.PHONY: all clean install
-
+registrations:
+ $(REGTESTS) ./kmregtests/tests ./kmregtests/_regtests.c ./kmregtests/Makefile.tests
+ $(REGTESTS) ./win32base/tests ./win32base/_regtests.c ./win32base/Makefile.tests
+
+.PHONY: all clean install registrations
+
+include $(PATH_TO_TOP)/rules.mak
*.map
_regtests.c
*.sys
+Makefile.tests
-# $Id: Makefile,v 1.2 2003/11/19 05:53:37 vizzini Exp $
+# $Id: Makefile,v 1.3 2003/12/07 11:34:41 chorns Exp $
PATH_TO_TOP = ../..
TARGET_CFLAGS = -I../shared -Werror -Wall
-TARGET_GENREGTESTS = yes
+include Makefile.tests
TARGET_OBJECTS = \
_regtests.o \
- driver.o
+ driver.o \
+ $(addprefix tests/, $(TESTS))
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
-
-# EOF
*.coff
*.sym
*.map
-_regtests.c
\ No newline at end of file
+_regtests.c
+Makefile.tests
-# $Id: Makefile,v 1.2 2003/11/19 05:53:38 vizzini Exp $
+# $Id: Makefile,v 1.3 2003/12/07 11:34:41 chorns Exp $
PATH_TO_TOP = ../..
TARGET_BASE = 0x60000000
-TARGET_GENREGTESTS = yes
+include Makefile.tests
TARGET_OBJECTS = \
_regtests.o \
driver.o \
- file-1.o
+ $(addprefix tests/, $(TESTS))
include $(PATH_TO_TOP)/rules.mak
-# $Id: helper.mk,v 1.46 2003/12/02 11:38:47 gvg Exp $
+# $Id: helper.mk,v 1.47 2003/12/07 11:34:41 chorns Exp $
#
# Helper makefile for ReactOS modules
# Variables this makefile accepts:
# $TARGET_PCH = Filename of header to use to generate a PCH if supported by the compiler (optional)
# $TARGET_BOOTSTRAP = Whether this file is needed to bootstrap the installation (no,yes) (optional)
# $TARGET_BOOTSTRAP_NAME = Name on the installation medium (optional)
-# $TARGET_GENREGTESTS = Generate regression test registrations (optional)
# $WINE_MODE = Compile using WINE headers (no,yes) (optional)
# $WINE_RC = Name of .rc file for WINE modules (optional)
# $SUBDIRS = Subdirs in which to run make (optional)
else # MK_IMPLIBONLY
-all: $(MK_GENREGTESTS) $(MK_FULLNAME) $(MK_NOSTRIPNAME) $(SUBDIRS:%=%_all)
-
-
-ifeq ($(TARGET_GENREGTESTS),yes)
-_regtests_phony:
- $(RM) _regtests.c
-.PHONY: _regtests_phony
-_regtests.c: _regtests_phony
- $(REGTESTS) . _regtests.c
- MK_GENREGTESTS := _regtests_phony
- MK_GENREGTESTS_CLEAN := _regtests.c _regtests.o
-else
- MK_GENREGTESTS :=
- MK_GENREGTESTS_CLEAN :=
-endif
+all: $(MK_FULLNAME) $(MK_NOSTRIPNAME) $(SUBDIRS:%=%_all)
ifeq ($(MK_IMPLIB),yes)
clean: $(SUBDIRS:%=%_clean)
- $(RM) *.o depend.d *.pch $(MK_BASENAME).sym $(MK_BASENAME).a $(TARGET_PATH)/$(MK_RES_BASE).coff \
- $(MK_FULLNAME) $(MK_NOSTRIPNAME) $(MK_CLEANFILES) $(MK_CLEANDEPS) $(MK_GENREGTESTS_CLEAN) $(MK_BASENAME).map \
+ $(MK_FULLNAME) $(MK_NOSTRIPNAME) $(MK_CLEANFILES) $(MK_CLEANDEPS) $(MK_BASENAME).map \
junk.tmp base.tmp temp.exp \
$(TARGET_CLEAN)
static FILE *out;
static char *path;
static char *file;
+static char *makefile;
char* convert_path(char* origpath)
{
n_out = fwrite(&buf[0], 1, strlen(buf), out);
}
-void register_test(char *filename, int prototype)
+static void change_extension(char *filenamebuffer, char *filename, char *newextension)
+{
+ char *ptr;
+
+ if (newextension == NULL)
+ {
+ strcpy(filenamebuffer, filename);
+ return;
+ }
+
+ ptr = strrchr(filename, '.');
+ if (ptr != NULL)
+ {
+ strncpy(filenamebuffer, filename, ptr - filename);
+ filenamebuffer[ptr - filename] = 0;
+ strcat(filenamebuffer, newextension);
+ }
+ else
+ {
+ strcpy(filenamebuffer, filename);
+ strcat(filenamebuffer, newextension);
+ }
+}
+
+/*
+ * filename - name of file to make registrations for
+ * regtype - type of registration (0 = prototype, 1 = call, 2 = makefile)
+ */
+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);
j++;
}
- if (prototype)
+ if (type == 0)
{
sprintf(regtest, "extern int %sTest(int Command, char *Buffer);", testname);
write_line(regtest);
}
- else
+ else if (type == 1)
{
sprintf(call, "%sTest", testname);
sprintf(regtest, " AddTest((TestRoutine)%s);", call);
write_line(regtest);
}
+ else if (type == 2)
+ {
+ change_extension(filenamebuffer, filename, ".o");
+ sprintf(regtest, "%s \\", filenamebuffer);
+ write_line(regtest);
+ }
}
#ifdef WIN32
/* Win32 version */
static void
-make_file_list (int prototype)
+make_file_list (int type)
{
struct _finddata_t f;
int findhandle;
char searchbuf[MAX_PATH];
strcpy(searchbuf, path);
- strcpy(searchbuf, "*.*");
+ strcat(searchbuf, "*.*");
findhandle =_findfirst(searchbuf, &f);
if (findhandle != -1)
{
continue;
}
- register_test(f.name, prototype);
+ register_test(f.name, type);
}
while (_findnext(findhandle, &f) == 0);
_findclose(findhandle);
/* Linux version */
static void
-make_file_list (int prototype)
+make_file_list (int type)
{
DIR *dirp;
struct dirent *entry;
continue;
}
- register_test(entry->d_name, prototype);
+ register_test(entry->d_name, type);
}
}
closedir(dirp);
continue;
}
- register_test(entry->d_name, prototype);
+ register_test(entry->d_name, type);
}
closedir(dirp);
}
#endif
static char HELP[] =
- "REGTESTS path file\n"
+ "REGTESTS path file makefile\n"
"\n"
- " path Path to files\n"
- " file File to create\n";
+ " path Path to files\n"
+ " file Registration file to create\n"
+ " makefile Makefile to create\n";
int main(int argc, char **argv)
{
char buf[MAX_PATH];
- if (argc < 2)
+ if (argc < 4)
{
puts(HELP);
return 1;
return 1;
}
+ makefile = convert_path(argv[3]);
+ if (makefile[0] == 0)
+ {
+ printf("Missing makefile\n");
+ return 1;
+ }
+
+
+ /* Registration file */
out = fopen(file, "wb");
if (out == NULL)
{
- perror("Cannot open output file");
+ perror("Cannot create output file");
return 1;
}
write_line("typedef int (*TestRoutine)(int Command, char *Buffer);");
write_line("");
- make_file_list(1);
+ make_file_list(0);
write_line("");
write_line("extern void AddTest(TestRoutine Routine);");
write_line("void RegisterTests()");
write_line("{");
- make_file_list(0);
+ make_file_list(1);
write_line("}");
fclose(out);
+
+ /* Makefile */
+ out = fopen(makefile, "wb");
+ if (out == NULL)
+ {
+ perror("Cannot create output makefile");
+ return 1;
+ }
+
+ write_line("# This file is autogenerated.");
+ write_line("");
+ write_line("TESTS = \\");
+
+ make_file_list(2);
+
+ write_line("");
+
+ fclose(out);
+
+ printf("Successfully generated regression test registrations.\n");
+
return 0;
}
-
-/* EOF */