test selection from fgrep to whole line matching

This commit is contained in:
Aaron Blankstein
2017-08-18 12:26:30 -04:00
parent b3cd1a75fc
commit c49c225b10

View File

@@ -1,11 +1,12 @@
#!/bin/sh
usage() {
echo "Usage: $0 [path/to/test/output/dir] [OPTIONAL: --exclusive] [OPTIONAL: path/to/tests/to/skip.txt] [OPTIONAL: path/to/existing/test/logdir/]"
echo "Usage: $0 [path/to/test/output/dir] [OPTIONAL: --exclusive] [OPTIONAL: path/to/tests/to/skip-or-run.txt] [OPTIONAL: path/to/existing/test/logdir/]"
echo "if you pass --exclusive, ONLY run tests in skip-or-run.txt, otherwise, run all tests EXCEPT those in skip-or-run.txt"
exit 1
}
if [ $# -lt 1 ]; then
if [ $# -lt 1 ]; then
usage $0
fi
@@ -13,7 +14,7 @@ RUN_SCENARIO="blockstack-test-scenario"
CHECK_SERIALIZATION="blockstack-test-check-serialization"
SCENARIOS_PYTHON="blockstack_integration_tests.scenarios"
SCENARIOS="$(BLOCKSTACK_TESTNET=1 python -c "import blockstack_integration_tests; import blockstack_integration_tests.scenarios; print blockstack_integration_tests.scenarios.__path__[0]")"
if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then
echo >&2 "Failed to load blockstack integration test scenarios"
exit 1
fi
@@ -38,19 +39,19 @@ while IFS= read SCENARIO_FILE; do
continue
fi
if [ "$SCENARIO_FILE" = "__init__.py" ] || [ "$SCENARIO_FILE" = "testlib.py" ]; then
if [ "$SCENARIO_FILE" = "__init__.py" ] || [ "$SCENARIO_FILE" = "testlib.py" ]; then
continue
fi
SCENARIO_MODULE_BASE="$(echo "$SCENARIO_FILE" | sed 's/\.py//g')"
SCENARIO_MODULE="$SCENARIOS_PYTHON.$SCENARIO_MODULE_BASE"
if [ "0" -eq "$EXCLUSIVE" ] && [ -n "$TESTS_SKIP" ] && [ -n "$(fgrep "$SCENARIO_MODULE_BASE" "$TESTS_SKIP")" ]; then
if [ "0" -eq "$EXCLUSIVE" ] && [ -n "$TESTS_SKIP" ] && [ -n "$(grep "^$SCENARIO_MODULE_BASE\$" "$TESTS_SKIP")" ]; then
continue
fi
if [ "1" -eq "$EXCLUSIVE" ] && [ -n "$TESTS_SKIP" ]; then
if ! [ -n "$(fgrep "$SCENARIO_MODULE_BASE" "$TESTS_SKIP")" ]; then
if ! [ -n "$(grep "^$SCENARIO_MODULE_BASE\$" "$TESTS_SKIP")" ]; then
continue
fi
fi
@@ -86,8 +87,8 @@ while IFS= read SCENARIO_FILE; do
fi
echo "</testcase></testsuite>" >> "$OUTPUT_FILE"
if [ $RC -ne 0 ]; then
# failed
if [ $RC -ne 0 ]; then
# failed
echo " FAILURE"
mv "$TESTDIR" "$OUTPUTS/$SCENARIO_MODULE_BASE.d"
@@ -96,7 +97,7 @@ while IFS= read SCENARIO_FILE; do
# compare serialized consensus fields with older release
EXISTING_LOG="$EXISTING_LOGS/$SCENARIO_MODULE_BASE.log"
if [ -f "$EXISTING_LOG" ]; then
if [ -f "$EXISTING_LOG" ]; then
"$CHECK_SERIALIZATION" "$EXISTING_LOGS/$SCENARIO_MODULE_BASE.log" "$OUTPUTS/$SCENARIO_MODULE_BASE.log"
RC=$?
@@ -108,9 +109,8 @@ while IFS= read SCENARIO_FILE; do
echo " (ERROR: mismatched serialization) FAILURE"
mv "$TESTDIR" "$OUTPUTS/$SCENARIO_MODULE_BASE.d"
# TODO: only exit with option
# TODO: only exit with option
exit 1
else
# exit 2 means no serialization check happened
echo " (WARN: SKIPPED SERIALIZATION CHECK) SUCCESS"
@@ -118,7 +118,7 @@ while IFS= read SCENARIO_FILE; do
fi
else
echo -n " (WARN: no existing log) "
fi
fi
bitcoin_pid=$(pidof bitcoind)
if [ "$bitcoin_pid" != "" ]; then