[PATCH 24/28] testsuite: make do_format() more self-contained

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/test-suite | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/validation/test-suite b/validation/test-suite
index 35138cb37..b4ba39f3f 100755
--- a/validation/test-suite
+++ b/validation/test-suite
@@ -244,7 +244,7 @@ echo "    file ...                   runs the test suite on the given file(s)"
 echo "    single file                runs the test in 'file'"
 echo "    format file [name [cmd]]   helps writing a new test case using cmd"
 echo
-echo "    help                       prints usage"
+echo "    [command] help             prints usage"
 }
 
 disable()
@@ -432,10 +432,34 @@ do_test_suite()
 	fi
 }
 
+##
+do_format_help() {
+echo "Usage: $prog_name [--]format file [name [cmd]]"
+echo
+echo "argument(s):"
+echo "    file                       file containing the test case(s)"
+echo "    name                       name for the test case (defaults to file)"
+echo "    cmd                        command to be used (defaults to 'sparse \$file')"
+}
+
 ##
 # do_format(file[, name[, cmd]]) - helps a test writer to format test-suite tags
 do_format()
 {
+	while [ $# -gt 1 ] ; do
+		case "$1" in
+		help|-*)
+			do_format_help
+			return 0
+			;;
+		*)	break ;;
+		esac
+		shift
+		continue
+	done
+
+	arg_file "$1" || return 1
+
 	if [ -z "$2" ]; then
 		fname="$1"
 		fcmd=$default_cmd
@@ -505,8 +529,8 @@ while true; do
 		esac
 		;;
 	format|--format)
-		arg_file "$2"
-		do_format "$2" "$3" "$4"
+		shift
+		do_format "$@"
 		;;
 	help | *)
 		do_usage
-- 
2.14.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux