summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/dmz-clean.sh20
-rw-r--r--tests/dmz.sh2
2 files changed, 18 insertions, 4 deletions
diff --git a/tests/dmz-clean.sh b/tests/dmz-clean.sh
index b13ef7e..9161d69 100644
--- a/tests/dmz-clean.sh
+++ b/tests/dmz-clean.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2015-2016 AT&T Intellectual Property, Inc
+# Copyright 2015-2017 AT&T Intellectual Property, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -28,6 +28,22 @@
# # After test, cleanup
# $ bash dmz-clean.sh
+trap 'fail' ERR
+
+pass() {
+ echo "Hooray!"
+ set +x #echo off
+ exit 0
+}
+
+# Use this to trigger fail() at the right places
+# if [ "$RESULT" == "Test Failed!" ]; then fail; fi
+fail() {
+ echo "Test Failed!"
+ set +x
+ exit 1
+}
+
if [ $# -eq 1 ]; then
if [ $1 == "debug" ]; then
set -x #echo on
@@ -101,5 +117,5 @@ neutron subnet-delete test_internal
echo "Delete internal network"
neutron net-delete test_internal
-set +x #echo off
+pass
diff --git a/tests/dmz.sh b/tests/dmz.sh
index e95a7ea..ab16ef6 100644
--- a/tests/dmz.sh
+++ b/tests/dmz.sh
@@ -209,6 +209,4 @@ done
echo "Verify cirros1 is paused:" $RESULT
if [ "$RESULT" == "Test Failed!" ]; then fail; fi
-set +x #echo off
-
pass