mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-11 08:37:40 +08:00
69 lines
1.6 KiB
Bash
Executable File
69 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
usage() {
|
|
echo "Usage: $0 [path/to/test/output/dir] [OPTIONAL: path/to/tests/to/skip.txt]"
|
|
exit 1
|
|
}
|
|
|
|
if [ $# -lt 1 ]; then
|
|
usage $0
|
|
fi
|
|
|
|
RUN_SCENARIO="blockstack-test-scenario"
|
|
SCENARIOS_PYTHON="blockstack_integration_tests.scenarios"
|
|
SCENARIOS="$(python -c "import blockstack_integration_tests; import blockstack_integration_tests.scenarios; print blockstack_integration_tests.scenarios.__path__[0]")"
|
|
if [ $? -ne 0 ]; then
|
|
echo >&2 "Failed to load blockstack integration test scenarios"
|
|
exit 1
|
|
fi
|
|
|
|
OUTPUTS="$1"
|
|
TESTS_SKIP="$2"
|
|
|
|
test -d "$OUTPUTS" || mkdir -p "$OUTPUTS"
|
|
|
|
while IFS= read SCENARIO_FILE; do
|
|
|
|
if ! [ "$(echo "$SCENARIO_FILE" | egrep '.py$')" ]; then
|
|
continue
|
|
fi
|
|
|
|
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 [ -n "$TESTS_SKIP" ] && [ -n "$(fgrep "$SCENARIO_MODULE_BASE" "$TESTS_SKIP")" ]; then
|
|
continue
|
|
fi
|
|
|
|
TESTDIR="/tmp/blockstack-test"
|
|
|
|
if ! [ -f "$OUTPUTS/$SCENARIO_MODULE_BASE.log" ]; then
|
|
|
|
echo -n "$SCENARIO_MODULE ... "
|
|
|
|
mkdir -p "$TESTDIR"
|
|
"$RUN_SCENARIO" "$SCENARIO_MODULE" "$TESTDIR" > "$OUTPUTS/$SCENARIO_MODULE_BASE.log" 2>&1
|
|
|
|
RC=$?
|
|
|
|
if [ $RC -eq 0 ]; then
|
|
echo " SUCCESS"
|
|
rm -rf "$TESTDIR"
|
|
|
|
else
|
|
echo " FAILURE"
|
|
mv "$TESTDIR" "$OUTPUTS/$SCENARIO_MODULE_BASE.d"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
done <<EOF
|
|
$(ls "$SCENARIOS")
|
|
EOF
|
|
|
|
exit 0
|