Skip to content

Commit

Permalink
Test script output names which test suite is failing
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkprime committed Aug 15, 2017
1 parent 294b8a3 commit daf563c
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 13 deletions.
8 changes: 6 additions & 2 deletions examples/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

TEST_SUITE_NAME="${TEST_SUITE_NAME:-$0}"

cd $(dirname $0)

JSONNET_BIN="${JSONNET_BIN:-../jsonnet}"

source ../test_suite/tests.source
Expand Down Expand Up @@ -51,8 +55,8 @@ done
deinit

if [ "$FAILED" -eq 0 ] ; then
echo "All $EXECUTED examples executed correctly."
echo "$TEST_SUITE_NAME: All $EXECUTED tests executed correctly."
else
echo "$FAILED / $EXECUTED tests failed."
echo "$TEST_SUITE_NAME: $FAILED / $EXECUTED tests failed."
exit 1
fi
4 changes: 4 additions & 0 deletions examples/terraform/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

export TEST_SUITE_NAME="$0"

cd "$(dirname $0)"

export EXAMPLES_DIR="$PWD"

cd .. && ./check.sh
6 changes: 4 additions & 2 deletions test_suite/run_fmt_idempotence_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cd "$(dirname $0)"

source "tests.source"

# Enable next line to test the garbage collector
Expand Down Expand Up @@ -51,9 +53,9 @@ for TEST in *.jsonnet ../examples/*.jsonnet ../examples/terraform/*.jsonnet ../b
done

if [ $FAILED -eq 0 ] ; then
echo "All $EXECUTED test scripts pass."
echo "$0: All $EXECUTED test scripts pass."
else
echo "FAILED: $FAILED / $EXECUTED"
echo "$0: FAILED: $FAILED / $EXECUTED"
exit 1
fi

Expand Down
6 changes: 4 additions & 2 deletions test_suite/run_fmt_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cd "$(dirname $0)"

source "tests.source"

# Enable next line to test the garbage collector
Expand Down Expand Up @@ -45,9 +47,9 @@ for TEST in *.jsonnet ../examples/*.jsonnet ../examples/terraform/*.jsonnet ../b
done

if [ $FAILED -eq 0 ] ; then
echo "All $EXECUTED test scripts pass."
echo "$0: All $EXECUTED test scripts pass."
else
echo "FAILED: $FAILED / $EXECUTED"
echo "$0: FAILED: $FAILED / $EXECUTED"
exit 1
fi

Expand Down
6 changes: 4 additions & 2 deletions test_suite/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

cd "$(dirname $0)"

source "tests.source"

# Enable next line to test the garbage collector
Expand Down Expand Up @@ -62,8 +64,8 @@ done
deinit

if [ $FAILED -eq 0 ] ; then
echo "All $EXECUTED test scripts pass."
echo "$0: All $EXECUTED test scripts pass."
else
echo "FAILED: $FAILED / $EXECUTED"
echo "$0: FAILED: $FAILED / $EXECUTED"
exit 1
fi
13 changes: 8 additions & 5 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ set -e

JSONNET_BIN="${JSONNET_BIN:-./jsonnet}"
TEST_SNIPPET="std.assertEqual(({ x: 1, y: self.x } { x: 2 }).y, 2)"
echo -n "snippet: "
"$JSONNET_BIN" -e "${TEST_SNIPPET}" || FAIL=TRUE

if [ -z "$DISABLE_LIB_TESTS" ]; then
echo -n 'libjsonnet_test_snippet: '
LD_LIBRARY_PATH=. ./libjsonnet_test_snippet "${TEST_SNIPPET}" || FAIL=TRUE
echo -n 'libjsonnet_test_file: '
LD_LIBRARY_PATH=. ./libjsonnet_test_file "test_suite/object.jsonnet" || FAIL=TRUE
fi
(cd examples ; ./check.sh) || FAIL=TRUE
(cd examples/terraform ; ./check.sh) || FAIL=TRUE
(cd test_suite ; ./run_tests.sh) || FAIL=TRUE
examples/check.sh || FAIL=TRUE
examples/terraform/check.sh || FAIL=TRUE
test_suite/run_tests.sh || FAIL=TRUE
if [ -z "$DISABLE_FMT_TESTS" ]; then
(cd test_suite ; ./run_fmt_tests.sh) || FAIL=TRUE
(cd test_suite ; ./run_fmt_idempotence_tests.sh) || FAIL=TRUE
test_suite/run_fmt_tests.sh || FAIL=TRUE
test_suite/run_fmt_idempotence_tests.sh || FAIL=TRUE
fi
if [ -n "$FAIL" ]; then
echo "TESTS FAILED"
Expand Down

0 comments on commit daf563c

Please sign in to comment.