Dockerized tests are now working and added a flag to toggle showing the test case diff.

master
Tom Alexander 4 years ago
parent aa7155d467
commit 8435028a55
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

@ -1,6 +1,8 @@
FROM rustlang/rust:nightly-alpine3.10
RUN apk --no-cache add bash git npm nodejs
# findutils needed to replace busybox xargs because it is failing to
# pass stdin through when using the `-a` flag
RUN apk --no-cache add bash git npm nodejs findutils
# Create unprivileged user
RUN addgroup -S duster && adduser -S duster -G duster
@ -20,3 +22,5 @@ RUN chown -R duster:duster /home/duster/duster
USER duster
RUN git clean -dfxq
RUN cargo build
RUN npm link dustjs-linkedin
CMD /home/duster/duster/js/run_compliance_suite.bash

@ -6,6 +6,25 @@ IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
failed_count=0
show_diff=0
while (( "$#" )); do
if [ "$1" = "--help" ]; then
cat<<EOF
Runs the full compliance test suite.
Options:
--show-diff Shows the difference between the two dust implementations
EOF
exit 0
elif [ "$1" = "--show-diff" ]; then
show_diff=1
else
(>&2 echo "Unrecognized option: $1")
exit 1
fi
shift
done
while read -r test_group; do
test_group_name=$(basename "$test_group")
@ -14,11 +33,13 @@ while read -r test_group; do
test_case_name=${test_case_file_name%.*}
set +e
(
if cmp --quiet <(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') 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') "$DIR/../target/debug/duster-cli" < "$test_case"); then
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') 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') "$DIR/../target/debug/duster-cli" < "$test_case"); then
echo "$test_group_name::$test_case_name PASSED"
else
echo "$test_group_name::$test_case_name FAILED"
diff <(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') 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') "$DIR/../target/debug/duster-cli" < "$test_case")
if [ $show_diff -eq 1 ]; then
diff --label "dustjs-linked" --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') 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') "$DIR/../target/debug/duster-cli" < "$test_case")
fi
exit 1
fi
)

Loading…
Cancel
Save