We don't have variables all over the place now, so it's nicer to move script generator into a separate function and redirect its output. Signed-off-by: Radim Krčmář <rkrcmar@xxxxxxxxxx> --- scripts/mkstandalone.sh | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh index d9cfded36d5e..6ced8e5970ef 100755 --- a/scripts/mkstandalone.sh +++ b/scripts/mkstandalone.sh @@ -42,24 +42,10 @@ temp_file () echo "chmod +x \$$var" } -function mkstandalone() +generate_test () { - local testname="$1" local args=( $(escape "${@}") ) - if [ -z "$testname" ]; then - return 1 - fi - - if [ -n "$one_testname" ] && [ "$testname" != "$one_testname" ]; then - return 1 - fi - - standalone=tests/$testname - - exec {tmpfd}<&1 - exec > $standalone - echo "#!/bin/bash" cat config.mak | grep '^ARCH=' @@ -67,8 +53,8 @@ function mkstandalone() if [ ! -f $kernel ]; then echo 'echo "skip '"$testname"' (test kernel not present)"' echo 'exit 1' - else - # XXX: bad indentation + return 1 + fi echo "trap 'rm -f \$cleanup' EXIT" @@ -81,9 +67,24 @@ function mkstandalone() echo "run ${args[@]}" echo "exit 0" +} + +function mkstandalone() +{ + local testname="$1" + + if [ -z "$testname" ]; then + return 1 fi - exec 1<&$tmpfd {tmpfd}<&- + if [ -n "$one_testname" ] && [ "$testname" != "$one_testname" ]; then + return 1 + fi + + standalone=tests/$testname + + generate_test "$@" > $standalone + chmod +x $standalone return 0 -- 2.7.0 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html