I have access to a quad Mac Pro now and have started building clang  
in the llvm tree.

I know that clang's test system is independent of dejagnu (which is a  
good thing).
While TestRunner.sh is pretty basic it does a good job.

But I expect that the clang tests will multiply soon. So I thought of
using extra cores to speed up tests.

The idea is this:

typing "make test" could proceed as follows:

0) cd into the test/ directory and make all there, which in turn
1) collects *.m, *.c, *.cpp files and creates targets *.cpp.testresults
     into a fresh makefile: Makefile.tests
2) in Makefile.tests some administrative targets like "all",  
"report", "clean"
    are established.
3) Makefile.tests is run with targets "run" and "report".

*.testresults are built by executing ./TestRunner.sh and capturing  
all output

the "report" targes just catenates all *.testresults to stdout.

So the behaviour is not grossly different, just the errors are shown
at the *end*.

The big profit of this approach is that specifying -j 4 to make
lets the testing proceed in parallel!

Below you find the new makefile, it is not yet polished, but works.
Please tell me whether I can proceed an commit.

Some empirical results.

My timings for the 4-core machine indicate that

"make test" takes 23 seconds.
"make -j 2 test" takes 15 seconds
"make -j 4 test" takes 13 seconds

A significant speedup I would say.

Cheers,

        Gabor



-----------------------------------------------------



LEVEL = ../../..
include $(LEVEL)/Makefile.common

AWK = awk

TESTDIRS = Rewriter CodeGen Lexer Preprocessor Parser Sema Analysis  
Serialization

Makefile.tests:
        @ echo '%.testresults: %' > $@
        @ echo "^@ echo $$<" | tr "^" "\t" >> $@
        @ echo "^@ PATH=$$PATH:$(ToolDir):$(LLVM_SRC_ROOT)/test/Scripts ./ 
TestRunner.sh &< > &@" | tr "^&" '\t$$' >> $@
        @ echo >> $@
        @ echo "TESTS =" \\ >> $@
        @ find $(TESTDIRS) \
          \( -name '*.c' -or -name '*.cpp' -or -name '*.m' \) \
        | $(AWK) '{print "  " $$0 ".testresults \\"}' >> $@
        @ echo '  ' >> $@
        @ echo >> $@
        @ echo "all:: &(TESTS)" | tr "&" '$$' >> $@
        @ echo >> $@
        @ echo "report: &(TESTS)" | tr "&" '$$' >> $@
        @ echo "^@ cat $$<" | tr "^&<" "\t$$^" >> $@
        @ echo >> $@
        @ echo "clean:" | tr "&" '$$' >> $@
        @ echo "^@ rm -f &(TESTS)" | tr "^&<" "\t$$^" >> $@
        @ echo >> $@
        @ echo ".PHONY: all report clean" >> $@

all:: Makefile.tests
        @ $(MAKE) -f $< clean
        @ $(MAKE) -f $< all report
        @ $(MAKE) -f $< clean
        @ rm $<

.PHONY: all

.NOTPARALLEL:


_______________________________________________
cfe-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

Reply via email to