Skip to content

Commit a9b50f3

Browse files
committed
More flexibile overriding of test results.
We allow implementations to have different error outputs (for very good reasons). We still want to share the test suite. So far we had an "implementation" suffix. This still required all the variants to be put in this repo. This is inconvenient, because we need to sync repos on every change which changes stack traces. This change allows providing an override directory with alternative test results. In addition to making work on go-jsonnet easier, it will also allow 3rd party implementations to use the test suite directly.
1 parent 7354bee commit a9b50f3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Diff for: test_cmd/cmd_tests.source

+10
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ JSONNET_BIN="${JSONNET_BIN:-../jsonnet}"
2424
JSONNETFMT_BIN="${JSONNETFMT_BIN:-../jsonnetfmt}"
2525

2626
# Used to account for known differences in the two implementations.
27+
# Deprecated in favor of override dir.
2728
IMPLEMENTATION="${IMPLEMENTATION:-cpp}"
2829

30+
OVERRIDE_DIR="${OVERRIDE_DIR:-.}"
31+
2932
separator() {
3033
echo -e "\n-----------------------------\n"
3134
}
@@ -64,6 +67,13 @@ do_test_aux() {
6467
GOLDEN_STDOUT="${TEST}.golden.stdout"
6568
GOLDEN_STDERR="${TEST}.golden.stderr"
6669

70+
if [ -r "${OVERRIDE_DIR}/${GOLDEN_STDOUT}" ] ; then
71+
GOLDEN_STDOUT="${OVERRIDE_DIR}/${GOLDEN_STDOUT}"
72+
fi
73+
if [ -r "${OVERRIDE_DIR}/${GOLDEN_STDERR}" ] ; then
74+
GOLDEN_STDERR="${OVERRIDE_DIR}/${GOLDEN_STDERR}"
75+
fi
76+
6777
if [ -r "${GOLDEN_STDOUT}.${IMPLEMENTATION}" ] ; then
6878
GOLDEN_STDOUT="${GOLDEN_STDOUT}.${IMPLEMENTATION}"
6979
fi

Diff for: test_cmd/run_cmd_tests.sh

-1
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,3 @@ else
154154
echo "$0: FAILED: $FAILED / $EXECUTED"
155155
exit 1
156156
fi
157-

0 commit comments

Comments
 (0)