diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-09-11 09:52:53 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-11-08 10:51:02 +0100 |
| commit | c8ab2db0b25f1060545994a927f5caf75e05b0f0 (patch) | |
| tree | 59d95b7578880aca350a2756dc130295b80e7e17 /validation | |
| parent | e6a832d7210201751d6bc17fa1b44fd24a95d094 (diff) | |
| download | sparse-dev-c8ab2db0b25f1060545994a927f5caf75e05b0f0.tar.gz | |
testsuite: make do_format() more self-contained
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
| -rwxr-xr-x | validation/test-suite | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/validation/test-suite b/validation/test-suite index 59d79918..677d1d00 100755 --- a/validation/test-suite +++ b/validation/test-suite @@ -245,7 +245,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() @@ -434,9 +434,33 @@ do_test_suite() } ## +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 @@ -506,8 +530,8 @@ while true; do esac ;; format|--format) - arg_file "$2" - do_format "$2" "$3" "$4" + shift + do_format "$@" ;; help | *) do_usage |
