summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@vince-x220.cbg.collabora.co.uk>2012-01-16 12:03:50 (GMT)
committerVincent Sanders <vince@vince-x220.cbg.collabora.co.uk>2012-01-16 12:03:50 (GMT)
commite90ce0ca070c479497c114de3d3cceda67beaa3a (patch)
tree19bb974e0d5d46ed97df5f1ecfb733c494cf639a
parentc664316c31f168dc756323a15e6f2b1ca7cdff34 (diff)
downloadstack-test-e90ce0ca070c479497c114de3d3cceda67beaa3a.tar.gz
stack-test-e90ce0ca070c479497c114de3d3cceda67beaa3a.tar.xz
improve how tests are run
-rw-r--r--Makefile7
-rwxr-xr-xshouldfail8
-rwxr-xr-xstack-test18
3 files changed, 22 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index d6cc186..38f8c31 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,9 @@
#!/usr/bin/make
-test: stack-test-noexec stack-test-exec
- ./stack-test-exec
- ./shouldfail ./stack-test-noexec
+.PHONY: stack-test
+
+stack-test: stack-test-noexec stack-test-exec
+ ./stack-test stack-test-noexec stack-test-exec
stack-test-exec:
gcc -z execstack -Wall -g -O0 stack-test.c -o stack-test-exec
diff --git a/shouldfail b/shouldfail
deleted file mode 100755
index 854eebf..0000000
--- a/shouldfail
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-${1}
-if [ $? -eq 0 ]; then
-exit 1
-else
-exit 0
-fi
diff --git a/stack-test b/stack-test
new file mode 100755
index 0000000..7546b66
--- /dev/null
+++ b/stack-test
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+exec_test=$(./stack-test-exec)
+if [ $? -ne 0 ]; then
+echo FAIL
+exit 1
+fi
+
+
+noexec_test=$(./stack-test-noexec 2>&1 )
+if [ $? -eq 0 ]; then
+echo FAIL
+exit 1
+else
+echo PASS
+exit 0
+fi
+