From ca721868868c8ad70d4c7bc70c94cfbe8d837e5c Mon Sep 17 00:00:00 2001 From: David Zafman Date: Mon, 31 Jul 2017 09:28:12 -0700 Subject: [PATCH] qa: Add special test_failure.sh script (not run by default) Signed-off-by: David Zafman (cherry picked from commit b20dfc2864751d0ae75b63f997c5aa3c57242585) --- qa/run-standalone.sh | 5 ++++ qa/standalone/special/test-failure.sh | 35 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100755 qa/standalone/special/test-failure.sh diff --git a/qa/run-standalone.sh b/qa/run-standalone.sh index 6b94958568725..ce86d0ef749f2 100755 --- a/qa/run-standalone.sh +++ b/qa/run-standalone.sh @@ -60,6 +60,11 @@ do continue fi fi + # Don't run test-failure.sh unless explicitly specified + if [ "$all" = "true" -a "$f" = "special/test-failure.sh" ]; then + continue + fi + count=$(expr $count + 1) echo "--- $f ---" if [[ "$dryrun" != "true" ]]; then diff --git a/qa/standalone/special/test-failure.sh b/qa/standalone/special/test-failure.sh new file mode 100755 index 0000000000000..d110d94921031 --- /dev/null +++ b/qa/standalone/special/test-failure.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +set -ex + +source $CEPH_ROOT/qa/standalone/ceph-helpers.sh + +function run() { + local dir=$1 + shift + + local funcs=${@:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')} + for func in $funcs ; do + setup $dir || return 1 + $func $dir || return 1 + teardown $dir || return 1 + done +} + +function TEST_failure_log() { + local dir=$1 + + cat > $dir/test_failure.log << EOF +This is a fake log file +* +* +* +* +* +This ends the fake log file +EOF + + # Test fails + return 1 +} + +main test_failure "$@" -- 2.39.5