Only run each command once in the compliance test suite.

This commit is contained in:
Tom Alexander 2020-05-17 16:40:23 -04:00
parent a33b46661e
commit 52ba4fd0a3
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -52,18 +52,25 @@ while read -r test_case; do
test_case_file_name=$(basename "$test_case") test_case_file_name=$(basename "$test_case")
test_case_name=${test_case_file_name%.*} test_case_name=${test_case_file_name%.*}
set +e set +e
if [ "$test_mode" = "dustjs" ] || [ "$test_mode" = "" ]; then
dustjs_output=$(xargs -a <(find "$test_group" -maxdepth 1 -mindepth 1 -type f -name 'main.dust'; find "$test_group" -maxdepth 1 -mindepth 1 -type f -name '*.dust' ! -name 'main.dust' | sort) node "$DIR/dustjs_shim.js" < "$test_case")
fi
if [ "$test_mode" = "duster" ] || [ "$test_mode" = "" ]; then
duster_output=$(xargs -a <(find "$test_group" -maxdepth 1 -mindepth 1 -type f -name 'main.dust'; find "$test_group" -maxdepth 1 -mindepth 1 -type f -name '*.dust' ! -name 'main.dust' | sort) "$DIR/../target/debug/duster-cli" < "$test_case")
fi
if [ "$test_mode" = "dustjs" ]; then if [ "$test_mode" = "dustjs" ]; then
xargs -a <(find "$test_group" -maxdepth 1 -mindepth 1 -type f -name 'main.dust'; find "$test_group" -maxdepth 1 -mindepth 1 -type f -name '*.dust' ! -name 'main.dust' | sort) node "$DIR/dustjs_shim.js" < "$test_case" cat <<<"$dustjs_output"
elif [ "$test_mode" = "duster" ]; then elif [ "$test_mode" = "duster" ]; then
xargs -a <(find "$test_group" -maxdepth 1 -mindepth 1 -type f -name 'main.dust'; find "$test_group" -maxdepth 1 -mindepth 1 -type f -name '*.dust' ! -name 'main.dust' | sort) "$DIR/../target/debug/duster-cli" < "$test_case" cat <<<"$duster_output"
else else
( (
if cmp -s <(xargs -a <(find "$test_group" -maxdepth 1 -mindepth 1 -type f -name 'main.dust'; find "$test_group" -maxdepth 1 -mindepth 1 -type f -name '*.dust' ! -name 'main.dust' | sort) node "$DIR/dustjs_shim.js" < "$test_case") <(xargs -a <(find "$test_group" -maxdepth 1 -mindepth 1 -type f -name 'main.dust'; find "$test_group" -maxdepth 1 -mindepth 1 -type f -name '*.dust' ! -name 'main.dust' | sort) "$DIR/../target/debug/duster-cli" < "$test_case"); then if cmp -s <(cat <<<"$dustjs_output") <(cat <<<"$duster_output"); then
echo "$test_group_name::$test_case_name PASSED" echo "$test_group_name::$test_case_name PASSED"
else else
echo "$test_group_name::$test_case_name FAILED" echo "$test_group_name::$test_case_name FAILED"
if [ $show_diff -eq 1 ]; then if [ $show_diff -eq 1 ]; then
diff --label "dustjs-linkedin" --label "duster" <(xargs -a <(find "$test_group" -maxdepth 1 -mindepth 1 -type f -name 'main.dust'; find "$test_group" -maxdepth 1 -mindepth 1 -type f -name '*.dust' ! -name 'main.dust' | sort) node "$DIR/dustjs_shim.js" < "$test_case" 2>/dev/null ) <(xargs -a <(find "$test_group" -maxdepth 1 -mindepth 1 -type f -name 'main.dust'; find "$test_group" -maxdepth 1 -mindepth 1 -type f -name '*.dust' ! -name 'main.dust' | sort) "$DIR/../target/debug/duster-cli" < "$test_case" 2>/dev/null ) diff --label "dustjs-linkedin" --label "duster" <(cat <<<"$dustjs_output") <(cat <<<"$duster_output")
fi fi
exit 1 exit 1
fi fi