From 13b0c0915b195288a60d31d037eba568b21ae065 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 10 Jan 2002 03:30:21 +0000 Subject: [PATCH] Added rules for running tests. --- Make.rules.in | 29 ++++++++++++++++++++++++++--- Makefile.in | 22 ++++++++++++++-------- dlls/Makedll.rules.in | 4 ++++ dlls/Makefile.in | 5 +++++ programs/Makeprog.rules.in | 4 ++++ programs/winetest/runtest | 34 ++++++++++++++++++++++++++++++++++ 6 files changed, 87 insertions(+), 11 deletions(-) create mode 100755 programs/winetest/runtest diff --git a/Make.rules.in b/Make.rules.in index b4d9bf09e27..878923bc582 100644 --- a/Make.rules.in +++ b/Make.rules.in @@ -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) diff --git a/Makefile.in b/Makefile.in index cab5c7e9ff1..dcc2df28849 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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` diff --git a/dlls/Makedll.rules.in b/dlls/Makedll.rules.in index 23d1c83078d..1f95477671d 100644 --- a/dlls/Makedll.rules.in +++ b/dlls/Makedll.rules.in @@ -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 diff --git a/dlls/Makefile.in b/dlls/Makefile.in index b6927d4f152..96078532509 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -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__) diff --git a/programs/Makeprog.rules.in b/programs/Makeprog.rules.in index 00a80cfc184..1dc0465dd19 100644 --- a/programs/Makeprog.rules.in +++ b/programs/Makeprog.rules.in @@ -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 diff --git a/programs/winetest/runtest b/programs/winetest/runtest new file mode 100755 index 00000000000..62cee4d8c85 --- /dev/null +++ b/programs/winetest/runtest @@ -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 $@