help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cleaner way to run all tests, despite some failing?


From: Eric Hanchrow
Subject: Cleaner way to run all tests, despite some failing?
Date: Tue, 19 Apr 2005 17:26:15 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/22.0.50 (gnu/linux)

Here's the problem:

I have a few executables in the current directory, which are tests.
When I type "make check", I'd like them all to run -- even if some
fail, I'd like the others to run.  And I'd like to collect some status
while they run, which gets reported after the last one finishes.

Here's how I've solved this:

    TESTS := foo bar baz

    check: $(TESTS)
            @failed_tests=;                                                     
        \
            for t in $(TESTS);                                                  
        \
            do                                                                  
        \
                    echo -n $$t ...;                                            
        \
                    ./$$t || failed_tests="$$failed_tests $$t";                 
        \
            done;                                                               
        \
            test -z "$$failed_tests" || { echo Failed tests: $$failed_tests; 
false ; }

    .PHONY: check

This works fine, but it's ... shall we say ... a tad ugly.  (And it
probably subtly depends on features of the shell I happen to be
using.)  Is there a cleaner way to do this?

-- 
... users want control ... [Microsoft's Internet] Explorer
wants them to sit still and shut up. 
        -- Verlyn Klinkenborg





reply via email to

[Prev in Thread] Current Thread [Next in Thread]