[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/39] mtest2make: split working directory from test command
From: |
Paolo Bonzini |
Subject: |
[PATCH 03/39] mtest2make: split working directory from test command |
Date: |
Wed, 2 Sep 2020 08:58:41 -0400 |
Pass the working directory and test command in separate macro arguments,
so that we will be able to insert a test driver in the next patch.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/mtest2make.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/scripts/mtest2make.py b/scripts/mtest2make.py
index f4ee4d3994..c709b37f28 100644
--- a/scripts/mtest2make.py
+++ b/scripts/mtest2make.py
@@ -19,16 +19,16 @@ class Suite(object):
print('''
SPEED = quick
-# $1 = environment, $2 = test command, $3 = test name
-.test-human-tap = $1 $2 < /dev/null | ./scripts/tap-driver.pl --test-name="$3"
$(if $(V),,--show-failures-only)
-.test-human-exitcode = $1 $2 < /dev/null
-.test-tap-tap = $1 $2 < /dev/null | sed "s/^[a-z][a-z]* [0-9]*/& $3/" || true
-.test-tap-exitcode = printf "%s\\n" 1..1 "`$1 $2 < /dev/null > /dev/null ||
echo "not "`ok 1 $3"
+# $1 = environment, $2 = test command, $3 = test name, $4 = dir
+.test-human-tap = $1 $(if $4,(cd $4 && $2),$2) < /dev/null |
./scripts/tap-driver.pl --test-name="$3" $(if $(V),,--show-failures-only)
+.test-human-exitcode = $1 $(if $4,(cd $4 && $2),$2) < /dev/null
+.test-tap-tap = $1 $(if $4,(cd $4 && $2),$2) < /dev/null | sed "s/^[a-z][a-z]*
[0-9]*/& $3/" || true
+.test-tap-exitcode = printf "%s\\n" 1..1 "`$1 $(if $4,(cd $4 && $2),$2) <
/dev/null > /dev/null || echo "not "`ok 1 $3"
.test.print = echo $(if $(V),'$1 $2','Running test $3') >&3
.test.env = MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))}
# $1 = test name, $2 = test target (human or tap)
-.test.run = $(call
.test.print,$(.test.env.$1),$(.test.cmd.$1),$(.test.name.$1)) && $(call
.test-$2-$(.test.driver.$1),$(.test.env.$1),$(.test.cmd.$1),$(.test.name.$1))
+.test.run = $(call
.test.print,$(.test.env.$1),$(.test.cmd.$1),$(.test.name.$1)) && $(call
.test-$2-$(.test.driver.$1),$(.test.env.$1),$(.test.cmd.$1),$(.test.name.$1),$(.test.dir.$1))
define .test.human_k
@exec 3>&1; rc=0; $(foreach TEST, $1, $(call .test.run,$(TEST),human)
|| rc=$$?;) \\
@@ -66,11 +66,11 @@ for test in json.load(sys.stdin):
else:
test['cmd'][0] = executable
cmd = ' '.join((shlex.quote(x) for x in test['cmd']))
- if test['workdir'] is not None:
- cmd = '(cd %s && %s)' % (shlex.quote(test['workdir']), cmd)
driver = test['protocol'] if 'protocol' in test else 'exitcode'
i += 1
+ if test['workdir'] is not None:
+ print('.test.dir.%d := %s' % (i, shlex.quote(test['workdir'])))
print('.test.name.%d := %s' % (i, test['name']))
print('.test.driver.%d := %s' % (i, driver))
print('.test.env.%d := $(.test.env) %s' % (i, env))
--
2.26.2
- [PATCH 00/39] Next round of Meson fixes and cleanups, Paolo Bonzini, 2020/09/02
- [PATCH 01/39] configure: Add system = 'linux' for meson when cross-compiling, Paolo Bonzini, 2020/09/02
- [PATCH 02/39] mtest2make: split environment from test command, Paolo Bonzini, 2020/09/02
- [PATCH 03/39] mtest2make: split working directory from test command,
Paolo Bonzini <=
- [PATCH 07/39] configure: do not include absolute paths in -I and -L paths, Paolo Bonzini, 2020/09/02
- [PATCH 14/39] meson: convert qht-bench, Paolo Bonzini, 2020/09/02
- [PATCH 06/39] meson: remove b_lundef option, Paolo Bonzini, 2020/09/02
- [PATCH 11/39] meson: build qapi tests library, Paolo Bonzini, 2020/09/02
- [PATCH 08/39] configure: include cross sdl2-config in meson cross file, Paolo Bonzini, 2020/09/02
- [PATCH 05/39] mtest2make: unify tests that appear in multiple suites, Paolo Bonzini, 2020/09/02
- [PATCH 15/39] tests: qga has virtio-serial by default when host has it, Paolo Bonzini, 2020/09/02
- [PATCH 12/39] meson: declare tasn1 dependency, Paolo Bonzini, 2020/09/02
- [PATCH 10/39] meson: fix libqos linking, Paolo Bonzini, 2020/09/02
- [PATCH 21/39] tests: do not print benchmark output to stdout, Paolo Bonzini, 2020/09/02