Added rules for running tests.

This commit is contained in:
Alexandre Julliard 2002-01-10 03:30:21 +00:00
parent 65b7e64c1f
commit 13b0c0915b
6 changed files with 87 additions and 11 deletions

View File

@ -18,6 +18,8 @@
# EXTRA_OBJS : extra object files
# SUBDIRS : subdirectories that contain a Makefile
# EXTRASUBDIRS : subdirectories that do not contain a Makefile
# PLTESTS : Perl test scripts
# CTESTS : C test sources
# First some useful definitions
@ -57,6 +59,9 @@ LINT = @LINT@
LINTFLAGS = @LINTFLAGS@
ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
WINETEST = $(TOPOBJDIR)/programs/winetest/winetest
RUNTEST = $(TOPSRCDIR)/programs/winetest/runtest
TESTRESULTS = $(PLTESTS:.pl=.ok) $(CTESTS:.c=.ok)
WINEBUILD = $(TOPOBJDIR)/tools/winebuild/winebuild
MAKEDEP = $(TOPOBJDIR)/tools/makedep
WRC = $(TOPOBJDIR)/tools/wrc/wrc
@ -95,7 +100,7 @@ LINTS = $(C_SRCS:.c=.ln)
# Implicit rules
.SUFFIXES: .mc .rc .mc.rc .res .spec .spec.c .glue.c
.SUFFIXES: .mc .rc .mc.rc .res .spec .spec.c .glue.c .pl .ok
.c.o:
$(CC) -c $(ALLCFLAGS) -o $@ $<
@ -121,7 +126,10 @@ LINTS = $(C_SRCS:.c=.ln)
.c.ln:
$(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
.PHONY: all install uninstall clean distclean depend dummy
.pl.ok:
$(RUNTEST) $(TOPOBJDIR) $< $(RUNTESTFLAGS) && touch $@
.PHONY: all install uninstall clean distclean depend dummy test testclean
# 'all' target first in case the enclosing Makefile didn't define any target
@ -212,11 +220,17 @@ depend: $(MAKEDEP) $(GEN_C_SRCS) $(SUBDIRS:%=%/__depend__)
$(SUBDIRS:%=%/__clean__): dummy
cd `dirname $@` && $(MAKE) clean
$(SUBDIRS:%=%/__testclean__): dummy
cd `dirname $@` && $(MAKE) testclean
$(EXTRASUBDIRS:%=%/__clean__): dummy
-cd `dirname $@` && $(RM) $(CLEAN_FILES)
testclean:: $(SUBDIRS:%=%/__testclean__)
$(RM) $(TESTRESULTS)
clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
$(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(PROGRAMS)
$(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(TESTRESULTS) $(PROGRAMS)
# Rules for installing
@ -226,6 +240,15 @@ $(SUBDIRS:%=%/__install__): dummy
$(SUBDIRS:%=%/__uninstall__): dummy
cd `dirname $@` && $(MAKE) uninstall
# Rules for testing
test:: $(TESTRESULTS)
$(TESTRESULTS): $(WINETEST)
$(WINETEST):
cd $(TOPOBJDIR)/programs/winetest && $(MAKE) winetest
# Misc. rules
$(SPEC_SRCS:.spec=.spec.c): $(WINEBUILD)

View File

@ -1,13 +1,15 @@
# This Makefile understands the following targets:
#
# all (default): build wine
# clean: remove all intermediate files
# distclean: also remove all files created by configure
# install: install everything
# uninstall: uninstall everything
# depend: create the dependencies
# etags: create a TAGS file for Emacs.
# manpages: compile manpages for Wine API
# all (default): build wine
# clean: remove all intermediate files
# distclean: also remove all files created by configure
# test: run tests
# testclean: clean test results to force running all tests again
# install: install everything
# uninstall: uninstall everything
# depend: create the dependencies
# etags: create a TAGS file for Emacs.
# manpages: compile manpages for Wine API
#
# Directories
@ -130,6 +132,10 @@ checklink::
@cd dlls && $(MAKE) checklink
@cd debugger && $(MAKE) checklink
test::
@cd programs/winetest && $(MAKE) test
@cd dlls && $(MAKE) test
TAGS etags:
etags `find $(TOPSRCDIR) -name '*.[chS]' -print | grep -v dbgmain`

View File

@ -36,6 +36,10 @@ lib$(MODULE).dll: $(ALL_OBJS) Makefile.in
checklink:: lib$(MODULE).$(LIBEXT)
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c -L. -l$(MODULE) $(ALL_LIBS) && $(RM) checklink
# Rules for testing
$(TESTRESULTS): lib$(MODULE).$(LIBEXT)
# Rules for debug channels
debug_channels: dummy

View File

@ -764,6 +764,9 @@ x11drv/libx11drv.$(LIBEXT): dummy libuser32.$(LIBEXT) libgdi32.$(LIBEXT) \
# Misc rules
$(SUBDIRS:%=%/__test__): dummy
@cd `dirname $@` && $(MAKE) test
$(SUBDIRS:%=%/__checklink__): dummy
@cd `dirname $@` && $(MAKE) checklink
@ -774,6 +777,8 @@ install:: $(SUBDIRS:%=%/__install__)
uninstall:: $(SUBDIRS:%=%/__uninstall__)
test:: $(SUBDIRS:%=%/__test__)
checklink:: $(SUBDIRS:%=%/__checklink__)
debug_channels:: $(SUBDIRS:%=%/__debug_channels__)

View File

@ -31,6 +31,10 @@ $(MODULE): $(MODULE).so
checklink:: $(MODULE).so
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c $(MODULE).so $(ALL_LIBS) && $(RM) checklink
# Rules for testing
$(TESTRESULTS): $(MODULE).so
# Rules for debug channels
debug_channels: dummy

34
programs/winetest/runtest Executable file
View File

@ -0,0 +1,34 @@
#!/bin/sh
#
# Wrapper script to run tests from inside the Wine tree
#
# Usage: runtest $TOPOBJDIR input_file [flags...]
#
usage()
{
echo "Usage: $0 \$TOPOBJDIR input_file [flags]"
exit 1
}
if [ $# -lt 2 ]
then
usage
fi
if [ -d "$1" ]
then
topobjdir=`cd "$1" && pwd`
else
echo "$1 is not a directory"
usage
fi
LD_LIBRARY_PATH="$topobjdir/dlls:$topobjdir:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH
WINESERVER="$topobjdir/server/wineserver"
export WINESERVER
WINELOADER="$topobjdir/wine"
export WINELOADER
testdir=`dirname "$0"`
infile="$2"
shift 2
exec $topobjdir/programs/winetest/winetest -- -I "$testdir" $infile $@