Browse Source

Try to fix problems related to inclusion of non-existing MakeChunk file

git-svn-id: trunk@23942 -
pierre 12 years ago
parent
commit
3b655c312e
2 changed files with 38 additions and 19 deletions
  1. 27 12
      tests/Makefile.fpc
  2. 11 7
      tests/utils/gparmake.pp

+ 27 - 12
tests/Makefile.fpc

@@ -102,6 +102,9 @@ C_SUBDIR=$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)
 # Date and time the testsuite was run
 # Date and time the testsuite was run
 ifneq ($(DATE),__missing_command_DATE)
 ifneq ($(DATE),__missing_command_DATE)
 TEST_DATETIME:=$(shell $(DATE) +%Y%m%d%H%M)
 TEST_DATETIME:=$(shell $(DATE) +%Y%m%d%H%M)
+else
+# Use a spaceless string, as it will be used for file names
+TEST_DATETIME="No-date"
 endif
 endif
 
 
 ifndef TEST_USER
 ifndef TEST_USER
@@ -464,7 +467,9 @@ allexectests:  $(TEST_OUTPUTDIR)/log.testlog $(TEST_OUTPUTDIR)/log.tbslog $(TEST
 # SINGLEDOTESTRUNS
 # SINGLEDOTESTRUNS
 else
 else
 
 
-.PHONY: allexectests
+.PHONY: allexectests gparmake_allexectests
+
+MAKEINC=$(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc
 
 
 $(GPARMAKE): $(COMPILER_UNITTARGETDIR) utils/gparmake.pp
 $(GPARMAKE): $(COMPILER_UNITTARGETDIR) utils/gparmake.pp
         $(FPC) $(FPCOPT) -FE. utils/gparmake.pp $(OPT)
         $(FPC) $(FPCOPT) -FE. utils/gparmake.pp $(OPT)
@@ -481,28 +486,38 @@ $(GPARMAKE): $(COMPILER_UNITTARGETDIR) utils/gparmake.pp
 # As a result, we list TEST_OUTPUTDIR as a dependency (that just creates
 # As a result, we list TEST_OUTPUTDIR as a dependency (that just creates
 # the directory) and have an explicit rule to build GPARMAKE rather than
 # the directory) and have an explicit rule to build GPARMAKE rather than
 # building it via the utils Makefile
 # building it via the utils Makefile
-$(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc: $(GPARMAKE) $(TEST_OUTPUTDIR)
+$(MAKEINC): $(GPARMAKE) $(TEST_OUTPUTDIR)
 # generate rules for parallel executions of dotest
 # generate rules for parallel executions of dotest
-	$(Q)$(GPARMAKE) $(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc 1 $(CHUNKSIZE) $(sort $(wildcard $(addsuffix /t*.pp,$(TESTDIRS))))
-	$(Q)$(GPARMAKE) -a $(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc 100000 $(CHUNKSIZE) $(sort $(wildcard tbs/t*.pp))
-	$(Q)$(GPARMAKE) -a $(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc 150000 $(CHUNKSIZE) $(sort $(wildcard tbf/t*.pp))
-	$(Q)$(GPARMAKE) -a $(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc 200000 $(CHUNKSIZE) $(sort $(wildcard webtbs/t*.pp))
-	$(Q)$(GPARMAKE) -a $(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc 300000 $(CHUNKSIZE) $(sort $(wildcard webtbf/t*.pp))
+# gparmake now also needs an additional parameter for the name of the 
+# used subdirectory. Note also that the index must be increasing for each
+# new call with a gap insuring that all the previous files have lower index
+# even if CHUNKSIZE is equal to 1.
+	$(Q)$(GPARMAKE) $(MAKEINC) test 1 $(CHUNKSIZE) $(sort $(wildcard $(addsuffix /t*.pp,$(TESTDIRS))))
+	$(Q)$(GPARMAKE) -a $(MAKEINC) tbs 10000 $(CHUNKSIZE) $(sort $(wildcard tbs/t*.pp))
+	$(Q)$(GPARMAKE) -a $(MAKEINC) tbf 15000 $(CHUNKSIZE) $(sort $(wildcard tbf/t*.pp))
+	$(Q)$(GPARMAKE) -a $(MAKEINC) webtbs 20000 $(CHUNKSIZE) $(sort $(wildcard webtbs/t*.pp))
+	$(Q)$(GPARMAKE) -a $(MAKEINC) webtbf 30000 $(CHUNKSIZE) $(sort $(wildcard webtbf/t*.pp))
 
 
 
 
 # only include the targets to compile/run the tests when we want to
 # only include the targets to compile/run the tests when we want to
 # run them (in particular: not when cleaning)
 # run them (in particular: not when cleaning)
 ifneq (,$(findstring all,$(MAKECMDGOALS)))
 ifneq (,$(findstring all,$(MAKECMDGOALS)))
+ifneq (,$(wildcard $(MAKEINC)))
 # incude the rules we just generated
 # incude the rules we just generated
 include $(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc
 include $(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc
 endif
 endif
+endif
 
 
 
 
-
-# this is pretty cool: MakeChunks-$(TEST_TARGETSUFFIX).inc will contain additional prerequisites
-# for the allexectests target, and after it is generated it will be included by the above "include"
-# statement, and those additional prerquisites will be added on the fly and also be evaluated
-allexectests: $(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc
+# this is pretty cool: MakeChunks-$(TEST_TARGETSUFFIX).inc will contain
+# additional prerequisites for the allexectests target, and after it is
+# generated it will be included by the above "include" statement, and those
+# additional prerequisites will be added on the fly and also be evaluated.
+# However, to avoid problems on some targets that seem to have problems
+# handling missing include files, we first create MAKEINC file
+# and rerun MAKE with gparmake_allexectests target.
+allexectests: $(MAKEINC)
+	$(MAKE) gparmake_allexectests
 
 
 # SINGLEDOTESTRUNS
 # SINGLEDOTESTRUNS
 endif
 endif

+ 11 - 7
tests/utils/gparmake.pp

@@ -5,7 +5,7 @@ Program GParMake;
 procedure Usage;
 procedure Usage;
   begin
   begin
     writeln('GParMake: create make rules for parallel execution of testsuite');
     writeln('GParMake: create make rules for parallel execution of testsuite');
-    writeln('Usage: gparmake [-a] <outputfile>  <startchunk> <tests_per_chunk> <test1> [<test2> ...]');
+    writeln('Usage: gparmake [-a] <outputfile> <dirname> <startchunk> <tests_per_chunk> <test1> [<test2> ...]');
     writeln('Output: makefile fragment with rules to run the tests in sequences of <tests_per_chunk>');
     writeln('Output: makefile fragment with rules to run the tests in sequences of <tests_per_chunk>');
     writeln;
     writeln;
     halt(1);
     halt(1);
@@ -23,14 +23,14 @@ function rulenr2str(rulenr: longint): string;
         rulenr2str[i]:='0';
         rulenr2str[i]:='0';
   end;
   end;
 
 
-procedure WriteChunkRule(rulenr: longint; const files: ansistring);
+procedure WriteChunkRule(rulenr: longint; const dirname, files: ansistring);
   var
   var
     rulestr: string;
     rulestr: string;
   begin
   begin
-    rulestr:=rulenr2str(rulenr);
+    rulestr:=rulenr2str(rulenr)+dirname;
     writeln('$(TEST_OUTPUTDIR)/testchunk_',rulestr,'-stamp.$(TEST_FULL_TARGET): testprep-stamp.$(TEST_FULL_TARGET)');
     writeln('$(TEST_OUTPUTDIR)/testchunk_',rulestr,'-stamp.$(TEST_FULL_TARGET): testprep-stamp.$(TEST_FULL_TARGET)');
     writeln(#9'$(Q)$(DOTEST) $(DOTESTOPT) -Lchunk',rulestr,' -e ',files);
     writeln(#9'$(Q)$(DOTEST) $(DOTESTOPT) -Lchunk',rulestr,' -e ',files);
-    writeln(#9'$(ECHOREDIR) $(DATE) > $@');
+    writeln(#9'$(ECHOREDIR) $(TEST_DATETIME) > $@');
     writeln;
     writeln;
     writeln('$(addsuffix .chunk',rulestr,', $(LOGFILES)) : $(TEST_OUTPUTDIR)/testchunk_',rulestr,'-stamp.$(TEST_FULL_TARGET)');
     writeln('$(addsuffix .chunk',rulestr,', $(LOGFILES)) : $(TEST_OUTPUTDIR)/testchunk_',rulestr,'-stamp.$(TEST_FULL_TARGET)');
     writeln;
     writeln;
@@ -41,6 +41,7 @@ procedure WriteChunkRule(rulenr: longint; const files: ansistring);
 
 
 var
 var
   startchunk: longint;
   startchunk: longint;
+  dirname : ansistring;
   doappend: boolean;
   doappend: boolean;
 
 
 Function ProcessArgs: longint;
 Function ProcessArgs: longint;
@@ -58,7 +59,7 @@ Function ProcessArgs: longint;
 
 
   procedure FlushChunk;
   procedure FlushChunk;
     begin
     begin
-      WriteChunkRule(chunknr,testlist);
+      WriteChunkRule(chunknr,dirname,testlist);
       inc(chunknr);
       inc(chunknr);
       testlist:='';
       testlist:='';
       chunksize:=0;
       chunksize:=0;
@@ -80,6 +81,9 @@ Function ProcessArgs: longint;
     outputname:=paramstr(paramnr);
     outputname:=paramstr(paramnr);
     inc(paramnr);
     inc(paramnr);
 
 
+    dirname:=paramstr(paramnr);
+    inc(paramnr);
+
     val(paramstr(paramnr),startchunk,error);
     val(paramstr(paramnr),startchunk,error);
     if error<>0 then
     if error<>0 then
       Usage;
       Usage;
@@ -137,7 +141,7 @@ procedure WriteWrapperRules(totalchunks: longint);
       begin
       begin
         write('$(TEST_OUTPUTDIR)/',lognames[logi],' :');
         write('$(TEST_OUTPUTDIR)/',lognames[logi],' :');
         for i:=startchunk to totalchunks do
         for i:=startchunk to totalchunks do
-          write(' $(TEST_OUTPUTDIR)/',lognames[logi],'.chunk',rulenr2str(i));
+          write(' $(TEST_OUTPUTDIR)/',lognames[logi],'.chunk',rulenr2str(i)+dirname);
         writeln;
         writeln;
         { if you have multiple rules for one (non-pattern) target, all
         { if you have multiple rules for one (non-pattern) target, all
           prerequisites will be merged, but only one of the rules can have a
           prerequisites will be merged, but only one of the rules can have a
@@ -151,7 +155,7 @@ procedure WriteWrapperRules(totalchunks: longint);
       end;
       end;
     if not doappend then
     if not doappend then
       begin
       begin
-        writeln('allexectests : $(LOGFILES)');
+        writeln('gparmake_allexectests : $(LOGFILES)');
         writeln;
         writeln;
       end;
       end;
   end;
   end;