shithub: mc

Download patch

ref: 04d69fa430ac53cbed054fda7f86e8a7feb21d77
parent: 80f3197039716af937a80f3f3516c3c8af1a4b58
author: Mura Li <[email protected]>
date: Wed Jan 31 05:21:28 EST 2018

Support running single test

--- a/test/runtest.sh
+++ b/test/runtest.sh
@@ -66,10 +66,28 @@
 	fi
 }
 
+belongto() {
+	elem="$1"; shift
+	subset="$1"; shift
+
+	IFS=','
+	for v in $subset; do
+		if [ "$elem" = "$v" ]; then
+			return 0
+		fi
+	done
+	return 1
+}
+
 # Should build and run
 B() {
 	test="$1"; shift
 	type="$1"; shift
+
+	if ! belongto "$test" "$MTEST_SUBSET"; then
+		return 1
+	fi
+
 	if [ $# -gt 0 ]; then
 		res="$1"; shift
 	fi
@@ -88,6 +106,10 @@
 
 # Should fail
 F() {
+	if ! belongto "$test" "$MTEST_SUBSET"; then
+		return 1
+	fi
+
 	echo "test $1 <<{!"
 	(build $1) > /dev/null 2>1
 	if [ $? -eq '1' ]; then