diff --git a/cicd_testing/do-test.sh b/cicd_testing/do-test.sh
index d458f8a6315f2de8b036670b4482363fabdd1d28..d206aaa4d813e1e4141f29011e767ce98517b5f7 100755
--- a/cicd_testing/do-test.sh
+++ b/cicd_testing/do-test.sh
@@ -6,10 +6,9 @@ set -x
 
 function main()
 {
-	cd /tmp/libehp_test
 	scons -j3
 	cd test
-	./test.sh
+	./test.sh || exit 1
 	exit 0
 }
 
diff --git a/test/test.sh b/test/test.sh
index 4fc20966a7492022668eb68bacc912f6393cc450..341c487519936a8161de914c26f1067d2a8b94b2 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -16,16 +16,25 @@
 #   limitations under the License.
 
 
-cleanup()
+set -x
+set -e
+
+function cleanup()
 {
 	echo "Test failed"
 	exit 1
 }
 
-scons || cleanup 
-./test.exe ./test.exe || cleanup 
-./test.exe /bin/ls || cleanup 
-./test.exe /bin/bash || cleanup 
 
-echo "test passed"
-exit 0
+function main()
+{
+	scons || cleanup 
+	./test.exe ./test.exe || cleanup 
+	./test.exe /bin/ls || cleanup 
+	./test.exe /bin/bash || cleanup 
+
+	echo "test passed"
+	exit 0
+}
+
+main "$@"