[v3,12/14] btrfs-progs: tests/common: Detect ungraceful failure case
diff mbox

Message ID 20170918072139.6300-13-quwenruo.btrfs@gmx.com
State New
Headers show

Commit Message

Qu Wenruo Sept. 18, 2017, 7:21 a.m. UTC
run_mustfail() checks the return value but doesn't check if the failure
is graceful.

Add such ungraceful failure check, for incoming "mkfs.btrfs --rootdir"
test cases, as old "--rootdir" never fail gracefully.

Signed-off-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
---
 tests/common | 5 +++++
 1 file changed, 5 insertions(+)

Patch
diff mbox

diff --git a/tests/common b/tests/common
index 242ded1d..b49d9ff3 100644
--- a/tests/common
+++ b/tests/common
@@ -227,6 +227,11 @@  run_mustfail()
 		$INSTRUMENT "$@" >> "$RESULTS" 2>&1
 	fi
 	if [ $? != 0 ]; then
+		if [ $? -gt 128 ]; then
+			"failed (ungracefully): $@" >> "$RESULTS"
+			_fail "unexpected ungraceful failure: $msg"
+			return 1
+		fi
 		echo "failed (expected): $@" >> "$RESULTS"
 		return 0
 	else