[banshee] tests: exit with a >0 exit code if any test fails



commit 5a0a189d8564c19d5820a1bd20bfc2b9d6b6a56b
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Fri Jan 17 15:05:24 2014 +0100

    tests: exit with a >0 exit code if any test fails
    
    This allows us to include the 'test' target as a
    dependency of the 'check' target, because it will
    stop the execution of the latter if the former
    fails.
    
    (It addresses the 2nd item of the list of issues
    raised here [1])
    
    [1] https://git.gnome.org/browse/banshee/commit/?id=dde264d2f6a4dc484e96e4ff81f32b5b4e2a2011

 tests/Makefile.am |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b7fabef..9f25340 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -32,10 +32,19 @@ endif
 ENV_OPTIONS = TZ=America/Chicago LC_ALL=it_IT LANG=it_IT
 NUNIT_CONSOLE = $$(echo $$(which nunit-console2 || which nunit-console))
 RUNNER = \
+       export GLOBAL_EXIT_CODE=0; \
        for asm in $${TEST_ASSEMBLIES}; do \
                echo -e "\033[1mRunning tests on $${asm}...\033[0m"; \
                $(ENV_OPTIONS) $(NUNIT_CONSOLE) -nologo -noshadow $$asm; \
-       done
+               export CURRENT_EXIT_CODE="$$?"; \
+               if [[ $${CURRENT_EXIT_CODE} -eq 1 ]]; then \
+                       export GLOBAL_EXIT_CODE=1; \
+               fi; \
+       done; \
+       if [[ $${GLOBAL_EXIT_CODE} -eq 1 ]]; then \
+               echo "One or more tests failed"; \
+               exit $${GLOBAL_EXIT_CODE}; \
+       fi
 
 test:
        @pushd $(DIR_BIN) &>/dev/null; \


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