summaryrefslogtreecommitdiff
path: root/cesar/common/make/test/test_make.sh
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/common/make/test/test_make.sh')
-rwxr-xr-xcesar/common/make/test/test_make.sh65
1 files changed, 65 insertions, 0 deletions
diff --git a/cesar/common/make/test/test_make.sh b/cesar/common/make/test/test_make.sh
new file mode 100755
index 0000000000..330943f6d2
--- /dev/null
+++ b/cesar/common/make/test/test_make.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+tmp=make.log
+
+function failure () {
+ echo FAIL >&2
+ exit 1
+}
+
+trap failure ERR
+
+function runmake () {
+ t=$1
+ shift
+ echo "$t: make $*"
+ sleep 1
+ make -C project "$@" &> "$tmp"
+ sleep 1
+}
+function grepcap () {
+ grep '^[[:upper:]]\{2,\} ' | grep -v '\.\./lib/'
+}
+
+if [[ "$1" = quick ]]
+then
+ make -C project &> /dev/null
+else
+ make -C project clean &> /dev/null
+
+ runmake first
+ grepcap < "$tmp" | diff - first-output
+fi
+
+touch project/inc/test_make.h
+runmake test_make.h
+grepcap < "$tmp" | diff - test_make.h-output
+
+touch project/ecos.ecc.sh
+runmake ecos.ecc.sh
+grepcap < "$tmp" | diff - ecos.ecc.sh-output
+
+touch project/src/test_make.c
+runmake test_make.c
+grepcap < "$tmp" | diff - test_make.c-output
+
+runmake nothing
+grepcap < "$tmp" | diff - nothing-output
+
+touch modules/b/inc/b_shout.h
+runmake b_shout.h
+grepcap < "$tmp" | diff - b_shout.h-output
+
+touch project/Config
+runmake Config
+grepcap < "$tmp" | diff - Config-output
+
+touch project/Config.alt
+runmake Config.alt PROJECT_CONFIG=Config.alt
+grepcap < "$tmp" | diff - Config.alt-output
+
+runmake clean clean
+grep -v 'make:' < "$tmp" | grep -v ' obj/' | diff - clean-output
+
+rm -f "$tmp"
+echo PASS