[chirp_devel] [PATCH 2 of 2] Add top-level test script

Dan Smith
Mon Dec 2 13:47:09 PST 2013


# HG changeset patch
# User Dan Smith <dsmith at danplanet.com>
# Date 1386020810 28800
#      Mon Dec 02 13:46:50 2013 -0800
# Node ID a9d8238eea0d9306c210eceeb292e5e180cfc434
# Parent  e6c6ffd8cae979cbeafa14c5fdfbb80d22333ecd
Add top-level test script

This runs our unit tests, driver tests, and style checks.

Had this idea after the patch for #1277

diff -r e6c6ffd8cae9 -r a9d8238eea0d run_all_tests.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run_all_tests.sh	Mon Dec 02 13:46:50 2013 -0800
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+function record_failure() {
+    FAILED="$1 $FAILED"
+}
+
+function unit_tests() {
+    NOSE=$(which nosetests)
+    if [ -x "$NOSE" ]; then
+	$NOSE -v tests/unit
+    else
+	echo "NOTE: nosetests required for unit tests!"
+	record_failure unit_tests
+    fi
+}
+
+function driver_tests() {
+    (cd tests && ./run_tests)
+}
+
+function style_tests() {
+    ./tools/checkpatch.sh
+}
+
+TESTS="unit_tests driver_tests style_tests"
+for testname in $TESTS; do
+    eval "$testname" || record_failure "$testname"
+done
+
+echo "================================================"
+
+if [ -z "$FAILED" ]; then
+    echo Tests OK
+else
+    failed=$(echo $FAILED | sed 's/ /, /g' | sed 's/_/ /g')
+    echo Tests FAILED: $failed
+    exit 1
+fi



More information about the chirp_devel mailing list