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.

svn path=/trunk/; revision=6883
This commit is contained in:
Casper Hornstrup 2003-12-07 11:34:41 +00:00
parent c22a7eb6ed
commit 3e8873192b
11 changed files with 133 additions and 54 deletions

View file

@ -1,3 +1,20 @@
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> 2003-12-06 Martin Fuchs <martin-fuchs@gmx.net>
* Doxyfile, Makefile: initial doxygen configuration * Doxyfile, Makefile: initial doxygen configuration
* drivers/Doxyfile, drivers/Makefile: Ditto. * drivers/Doxyfile, drivers/Makefile: Ditto.

View file

@ -1,6 +1,8 @@
# $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 shared all
$(MAKE) -C win32base all $(MAKE) -C win32base all
$(MAKE) -C kmregtests all $(MAKE) -C kmregtests all
@ -8,11 +10,13 @@ all:
$(MAKE) -C regtests all $(MAKE) -C regtests all
clean: clean:
$(MAKE) -C shared clean - $(MAKE) -C shared clean
$(MAKE) -C win32base clean - $(MAKE) -C win32base clean
$(MAKE) -C kmregtests clean - $(MAKE) -C kmregtests clean
$(MAKE) -C kmrtint clean - $(MAKE) -C kmrtint clean
$(MAKE) -C regtests clean - $(MAKE) -C regtests clean
- $(RM) ./kmregtests/_regtests.c ./kmregtests/Makefile.tests
- $(RM) ./win32base/_regtests.c ./win32base/Makefile.tests
install: install:
$(MAKE) -C shared install $(MAKE) -C shared install
@ -21,5 +25,10 @@ install:
$(MAKE) -C kmrtint install $(MAKE) -C kmrtint install
$(MAKE) -C regtests 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

View file

@ -7,3 +7,4 @@
*.map *.map
_regtests.c _regtests.c
*.sys *.sys
Makefile.tests

View file

@ -1,4 +1,4 @@
# $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 = ../.. PATH_TO_TOP = ../..
@ -12,14 +12,13 @@ TARGET_LIBS = $(SDK_PATH_LIB)/rtshared.a
TARGET_CFLAGS = -I../shared -Werror -Wall TARGET_CFLAGS = -I../shared -Werror -Wall
TARGET_GENREGTESTS = yes include Makefile.tests
TARGET_OBJECTS = \ TARGET_OBJECTS = \
_regtests.o \ _regtests.o \
driver.o driver.o \
$(addprefix tests/, $(TESTS))
include $(PATH_TO_TOP)/rules.mak include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk include $(TOOLS_PATH)/helper.mk
# EOF

View file

@ -0,0 +1 @@
*.o

View file

@ -4,4 +4,5 @@
*.coff *.coff
*.sym *.sym
*.map *.map
_regtests.c _regtests.c
Makefile.tests

View file

@ -1,4 +1,4 @@
# $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 = ../.. PATH_TO_TOP = ../..
@ -14,12 +14,12 @@ TARGET_CFLAGS = -I../shared -Wall -Werror
TARGET_BASE = 0x60000000 TARGET_BASE = 0x60000000
TARGET_GENREGTESTS = yes include Makefile.tests
TARGET_OBJECTS = \ TARGET_OBJECTS = \
_regtests.o \ _regtests.o \
driver.o \ driver.o \
file-1.o $(addprefix tests/, $(TESTS))
include $(PATH_TO_TOP)/rules.mak include $(PATH_TO_TOP)/rules.mak

View file

@ -0,0 +1 @@
*.o

View file

@ -1,4 +1,4 @@
# $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 # Helper makefile for ReactOS modules
# Variables this makefile accepts: # Variables this makefile accepts:
@ -45,7 +45,6 @@
# $TARGET_PCH = Filename of header to use to generate a PCH if supported by the compiler (optional) # $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 = Whether this file is needed to bootstrap the installation (no,yes) (optional)
# $TARGET_BOOTSTRAP_NAME = Name on the installation medium (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_MODE = Compile using WINE headers (no,yes) (optional)
# $WINE_RC = Name of .rc file for WINE modules (optional) # $WINE_RC = Name of .rc file for WINE modules (optional)
# $SUBDIRS = Subdirs in which to run make (optional) # $SUBDIRS = Subdirs in which to run make (optional)
@ -557,21 +556,7 @@ $(MK_IMPLIBPATH)/$(MK_IMPLIB_FULLNAME): $(TARGET_OBJECTS) $(MK_DEFNAME)
else # MK_IMPLIBONLY else # MK_IMPLIBONLY
all: $(MK_GENREGTESTS) $(MK_FULLNAME) $(MK_NOSTRIPNAME) $(SUBDIRS:%=%_all) all: $(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
ifeq ($(MK_IMPLIB),yes) ifeq ($(MK_IMPLIB),yes)
@ -793,7 +778,7 @@ MK_CLEANDEPS := $(join $(dir $(MK_CLEANFILTERED)), $(addprefix ., $(notdir $(MK_
clean: $(SUBDIRS:%=%_clean) clean: $(SUBDIRS:%=%_clean)
- $(RM) *.o depend.d *.pch $(MK_BASENAME).sym $(MK_BASENAME).a $(TARGET_PATH)/$(MK_RES_BASE).coff \ - $(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 \ junk.tmp base.tmp temp.exp \
$(TARGET_CLEAN) $(TARGET_CLEAN)

View file

@ -35,6 +35,7 @@
static FILE *out; static FILE *out;
static char *path; static char *path;
static char *file; static char *file;
static char *makefile;
char* convert_path(char* origpath) char* convert_path(char* origpath)
{ {
@ -81,12 +82,41 @@ static void write_line(char *line)
n_out = fwrite(&buf[0], 1, strlen(buf), out); 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 ext[100];
char testname[100]; char testname[100];
char call[100]; char call[100];
char regtest[100]; char regtest[100];
char filenamebuffer[MAX_PATH];
int i, j; int i, j;
strcpy(testname, filename); strcpy(testname, filename);
@ -132,17 +162,23 @@ void register_test(char *filename, int prototype)
j++; j++;
} }
if (prototype) if (type == 0)
{ {
sprintf(regtest, "extern int %sTest(int Command, char *Buffer);", testname); sprintf(regtest, "extern int %sTest(int Command, char *Buffer);", testname);
write_line(regtest); write_line(regtest);
} }
else else if (type == 1)
{ {
sprintf(call, "%sTest", testname); sprintf(call, "%sTest", testname);
sprintf(regtest, " AddTest((TestRoutine)%s);", call); sprintf(regtest, " AddTest((TestRoutine)%s);", call);
write_line(regtest); write_line(regtest);
} }
else if (type == 2)
{
change_extension(filenamebuffer, filename, ".o");
sprintf(regtest, "%s \\", filenamebuffer);
write_line(regtest);
}
} }
#ifdef WIN32 #ifdef WIN32
@ -150,14 +186,14 @@ void register_test(char *filename, int prototype)
/* Win32 version */ /* Win32 version */
static void static void
make_file_list (int prototype) make_file_list (int type)
{ {
struct _finddata_t f; struct _finddata_t f;
int findhandle; int findhandle;
char searchbuf[MAX_PATH]; char searchbuf[MAX_PATH];
strcpy(searchbuf, path); strcpy(searchbuf, path);
strcpy(searchbuf, "*.*"); strcat(searchbuf, "*.*");
findhandle =_findfirst(searchbuf, &f); findhandle =_findfirst(searchbuf, &f);
if (findhandle != -1) if (findhandle != -1)
{ {
@ -169,7 +205,7 @@ make_file_list (int prototype)
continue; continue;
} }
register_test(f.name, prototype); register_test(f.name, type);
} }
while (_findnext(findhandle, &f) == 0); while (_findnext(findhandle, &f) == 0);
_findclose(findhandle); _findclose(findhandle);
@ -180,7 +216,7 @@ make_file_list (int prototype)
/* Linux version */ /* Linux version */
static void static void
make_file_list (int prototype) make_file_list (int type)
{ {
DIR *dirp; DIR *dirp;
struct dirent *entry; struct dirent *entry;
@ -225,7 +261,7 @@ make_file_list (int prototype)
continue; continue;
} }
register_test(entry->d_name, prototype); register_test(entry->d_name, type);
} }
} }
closedir(dirp); closedir(dirp);
@ -273,7 +309,7 @@ make_file_list (int prototype)
continue; continue;
} }
register_test(entry->d_name, prototype); register_test(entry->d_name, type);
} }
closedir(dirp); closedir(dirp);
} }
@ -289,15 +325,16 @@ make_file_list (int prototype)
#endif #endif
static char HELP[] = static char HELP[] =
"REGTESTS path file\n" "REGTESTS path file makefile\n"
"\n" "\n"
" path Path to files\n" " path Path to files\n"
" file File to create\n"; " file Registration file to create\n"
" makefile Makefile to create\n";
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char buf[MAX_PATH]; char buf[MAX_PATH];
if (argc < 2) if (argc < 4)
{ {
puts(HELP); puts(HELP);
return 1; return 1;
@ -325,10 +362,19 @@ int main(int argc, char **argv)
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"); out = fopen(file, "wb");
if (out == NULL) if (out == NULL)
{ {
perror("Cannot open output file"); perror("Cannot create output file");
return 1; return 1;
} }
@ -337,7 +383,7 @@ int main(int argc, char **argv)
write_line("typedef int (*TestRoutine)(int Command, char *Buffer);"); write_line("typedef int (*TestRoutine)(int Command, char *Buffer);");
write_line(""); write_line("");
make_file_list(1); make_file_list(0);
write_line(""); write_line("");
write_line("extern void AddTest(TestRoutine Routine);"); write_line("extern void AddTest(TestRoutine Routine);");
@ -345,13 +391,32 @@ int main(int argc, char **argv)
write_line("void RegisterTests()"); write_line("void RegisterTests()");
write_line("{"); write_line("{");
make_file_list(0); make_file_list(1);
write_line("}"); write_line("}");
fclose(out); 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; return 0;
} }
/* EOF */