Преглед на файлове

+ response file support for gparmake
* create a file list of all test/t*.pp tests and pass it as response file to gparmake to overcome command line length limits

git-svn-id: trunk@32548 -

florian преди 9 години
родител
ревизия
38f3644b0b
променени са 5 файла, в които са добавени 49 реда и са изтрити 5 реда
  1. 1 0
      .gitattributes
  2. 2 1
      tests/Makefile
  3. 2 1
      tests/Makefile.fpc
  4. 4 0
      tests/createlst.mak
  5. 40 3
      tests/utils/gparmake.pp

+ 1 - 0
.gitattributes

@@ -9946,6 +9946,7 @@ tests/bench/shortbench.pp svneol=native#text/plain
 tests/bench/stream.pp svneol=native#text/plain
 tests/bench/timer.pas svneol=native#text/plain
 tests/bench/whet.pas svneol=native#text/plain
+tests/createlst.mak svneol=native#text/plain
 tests/dbdigest.cfg.example -text
 tests/readme.txt svneol=native#text/plain
 tests/tbf/tb0001.pp svneol=native#text/plain

+ 2 - 1
tests/Makefile

@@ -2401,7 +2401,8 @@ MAKEINC=$(TEST_OUTPUTDIR)/MakeChunks-$(TEST_TARGETSUFFIX).inc
 $(GPARMAKE): $(COMPILER_UNITTARGETDIR) utils/gparmake.pp
 	$(FPC) $(FPCOPT) -FE. utils/gparmake.pp $(OPT)
 $(MAKEINC): $(GPARMAKE) $(TEST_OUTPUTDIR)
-	$(Q)$(GPARMAKE) $(MAKEINC) test 1 $(CHUNKSIZE) $(sort $(wildcard $(addsuffix /t*.pp,$(TESTDIRS))))
+	$(MAKE) -s -f createlst.mak "TESTDIRS=$(TESTDIRS)" > testfilelist.lst
+	$(Q)$(GPARMAKE) $(MAKEINC) test 1 $(CHUNKSIZE) @testfilelist.lst
 	$(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))

+ 2 - 1
tests/Makefile.fpc

@@ -515,7 +515,8 @@ $(MAKEINC): $(GPARMAKE) $(TEST_OUTPUTDIR)
 # 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))))
+	$(MAKE) -s -f createlst.mak "TESTDIRS=$(TESTDIRS)" > testfilelist.lst
+	$(Q)$(GPARMAKE) $(MAKEINC) test 1 $(CHUNKSIZE) @testfilelist.lst
 	$(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))

+ 4 - 0
tests/createlst.mak

@@ -0,0 +1,4 @@
+FILES=$(sort $(wildcard $(addsuffix /t*.pp,$(TESTDIRS))))
+$(foreach filename,$(FILES),$(info $(filename)))
+
+all: ;

+ 40 - 3
tests/utils/gparmake.pp

@@ -2,6 +2,9 @@
 
 Program GParMake;
 
+Uses
+  Classes;
+
 procedure Usage;
   begin
     writeln('GParMake: create make rules for parallel execution of testsuite');
@@ -43,6 +46,7 @@ var
   startchunk: longint;
   dirname : ansistring;
   doappend: boolean;
+  FileList : TStringList;
 
 Function ProcessArgs: longint;
   var
@@ -51,11 +55,23 @@ Function ProcessArgs: longint;
     chunktargetsize,
     chunksize,
     chunknr,
+    nextfileindex,
     error: longint;
     testname,
     nexttestname,
     testlist,
+    s,
     outputname: ansistring;
+    filelist : array of ansistring;
+    responsefile : text;
+
+  procedure AddFile(const s : ansistring);
+    begin
+      if nextfileindex>high(filelist) then
+        SetLength(filelist,length(filelist)+128);
+      filelist[nextfileindex]:=s;
+      inc(nextfileindex);
+    end;
 
   procedure FlushChunk;
     begin
@@ -105,20 +121,41 @@ Function ProcessArgs: longint;
     chunknr:=startchunk;
     chunksize:=0;
     testlist:='';
+    nextfileindex:=0;
     for i := paramnr to paramcount do
       begin
-        testname:=paramstr(i);
+        if paramstr(i)[1]='@' then
+          begin
+            assign(responsefile,copy(paramstr(i),2,length(paramstr(i))));
+            reset(responsefile);
+            while not(eof(responsefile)) do
+              begin
+                readln(responsefile,s);
+                AddFile(s);
+              end;
+            close(responsefile);
+          end
+        else
+          AddFile(paramstr(i));
+      end;
+
+    for i := 0 to nextfileindex-1 do
+      begin
+        testname:=filelist[i];
         testlist:=testlist+' '+testname;
         inc(chunksize);
         if chunksize>=chunktargetsize then
           begin
-            if (i=paramcount) then
+            if (i=nextfileindex-1) then
               FlushChunk
             else
               begin
                 { keep tests with the same name except for the last character in the same chunk,
                   because they may have to be executed in order (skip ".pp" suffix and last char) }
-                nexttestname:=paramstr(i+1);
+                if i+1>=nextfileindex then
+                  nexttestname:=''
+                else
+                  nexttestname:=filelist[i+1];
                 if lowercase(copy(testname,1,length(testname)-4))<>lowercase(copy(nexttestname,1,length(nexttestname)-4)) then
                   FlushChunk;
               end;