From f55ad2bbfcde461e6ec52b06258ee3c277cc5edf Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Thu, 25 Jan 2018 10:33:55 +0100 Subject: [PATCH] tests/gen_tests.sh: enable passing arguments to sourced tests * tests/gen_tests.sh: Read first argument separately, put it in $arg0, and the rest of the arguments in $args. (case "$arg0" in) <+*)>: Set command line to $args and source $arg0. --- tests/gen_tests.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/gen_tests.sh b/tests/gen_tests.sh index b0624365..fd497edb 100755 --- a/tests/gen_tests.sh +++ b/tests/gen_tests.sh @@ -54,7 +54,7 @@ fi names= -while read -r name args; do { +while read -r name arg0 args; do { [ -n "${name###*}" ] || continue if [ -z "$match" ]; then names="$names $name" @@ -65,13 +65,14 @@ while read -r name args; do { hdr="\ #!/bin/sh -efu -# Generated by $0 from $input ($name $args); do not edit." +# Generated by $0 from $input ($name $arg0 $args); do not edit." - case "$args" in + case "$arg0" in +*) cat <<-EOF $hdr - . "\${srcdir=.}/${args#+}" + set -- $args + . "\${srcdir=.}/${arg0#+}" EOF ;; @@ -79,7 +80,7 @@ while read -r name args; do { cat <<-EOF $hdr . "\${srcdir=.}/init.sh" - run_strace_match_diff $args + run_strace_match_diff $arg0 $args EOF ;; @@ -87,7 +88,7 @@ while read -r name args; do { cat <<-EOF $hdr . "\${srcdir=.}/init.sh" - $args + $arg0 $args EOF ;; esac > "$output" -- 2.40.0