From: Hemanth Kumar M D <[email protected]>
The tests-printers-out rule in Rules runs $(PYTHON) through
$(test-wrapper-env). Unlike ordinary tests, which wrap a freshly
built target binary, this wraps python3, a build-host tool. The
wrapping itself is intentional: the pretty-printer tests drive gdb
against the built test binaries, so they must run wherever those
binaries can execute.
When cross-testing with test-wrapper set (e.g. via
scripts/cross-test-ssh.sh) the whole command is forwarded to the
target. If the target lacks python3, the remote shell exits with
status 127 and evaluate-test.sh reports the six nptl pretty-printer
tests as FAIL instead of UNSUPPORTED.
scripts/test_printers_common.py already exits with the UNSUPPORTED
status (77) when its dependencies (gdb, pexpect) are missing, but
that check is unreachable when the python3 interpreter itself is
absent.
Guard the invocation with a "command -v" check so the recipe exits
77 (UNSUPPORTED) when $(PYTHON) is not found in the test
environment. Note that this checks for the interpreter configure
found on the build host, which may be an absolute path; if it is
not present at that location on the target, the test cannot run as
invoked, so UNSUPPORTED is the correct result. Native builds are
unaffected, as configure requires python3.
Tested natively on x86_64-linux-gnu (make check; the pretty-printer
tests continue to PASS) and by cross-testing via
scripts/cross-test-ssh.sh to a target without python3 (the six
tests now report UNSUPPORTED instead of FAIL).
Signed-off-by: Hemanth Kumar M D <[email protected]>
---
Rules | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Rules b/Rules
index 71495028fb..06604b41a5 100644
--- a/Rules
+++ b/Rules
@@ -467,8 +467,9 @@ py-env := PYTHONPATH=$(py-const-dir):$(..)scripts:$${PYTHONPATH}
# The pretty printer files and test_common_printers.py must be present for all.
$(tests-printers-out): $(objpfx)%.out: $(objpfx)% %.py %.c $(pretty-printers) \
$(..)scripts/test_printers_common.py
- $(test-wrapper-env) $(py-env) \
- $(PYTHON) $*.py $*.c $(objpfx)$* $(pretty-printers) > $@; \
+ $(test-wrapper-env) $(py-env) sh -c \
+ 'command -v $(PYTHON) > /dev/null 2>&1 || exit 77; \
+ exec $(PYTHON) $*.py $*.c $(objpfx)$* $(pretty-printers)' > $@; \
$(evaluate-test)
endif
--
2.49.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.