You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
duster/js/run_compliance_suite.bash

54 lines
1.2 KiB
Bash

#!/usr/bin/env bash
#
# Runs the full suite of tests against LinkedIn DustJS and duster to compare the result
set -euo pipefail
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
set +e
if [ $show_diff -eq 1 ]; then
"$DIR/run_single_test.bash" --show-diff "$test_group"
else
"$DIR/run_single_test.bash" --show-diff "$test_group"
fi
result=$?
if [ $result -ne 0 ]; then
failed_count=$((failed_count + result))
fi
set -e
done <<<"$(find "$DIR/test_cases" -maxdepth 1 -mindepth 1 -type d ! -name '_*' | sort)"
ignored_count=$(find "$DIR/test_cases" -maxdepth 1 -mindepth 1 -type d -name '_*' | wc -l)
echo ""
echo "$ignored_count ignored tests"
if [ $failed_count -ne 0 ]; then
echo "$failed_count failed tests"
exit 1
else
echo "All tests passed"
fi