t0213: skip ancestry tests under user-mode emulation
The tests added in 3c8c638df6 (t0213: add trace2 cmd_ancestry tests, 2026-02-13) expect the cmd_ancestry event to name "test-tool" and "git". On Linux those names come from the "comm" field of /proc/<pid>/stat. Under user-mode emulation (e.g. qemu-user) /proc reports the emulator ("qemu-riscv64") instead, so the event is still emitted, the TRACE2_ANCESTRY probe enables the tests, and tests 2-5 fail even though they pass on native riscv64. Require the probe to see "test-tool" in the ancestry of a test-tool spawned from test-tool, so the tests skip when the names are unreliable. Cc: Matthew John Cheetham <mjcheetham@outlook.com> Signed-off-by: Jamie Magee <jamie.magee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jamie Magee committed
Jul 6, 2026 at 17:34 UTC
7454b68b6a08abdc87b8fea6ebc2c54f334860af
1 file changed
+6
-3
t/t0213-trace2-ancestry.sh
+6
-3
@@ -31,12 +31,15 @@ PATH="$TTDIR:$PATH" && export PATH
31
# no cmd_ancestry event is emitted. We detect this at runtime and
32
# skip the format-specific tests accordingly.
33
34
-# Determine if cmd_ancestry is supported on this platform.
34
+# Enable these tests only when cmd_ancestry reports real process names.
35
+# The procinfo stub emits no event; under user-mode emulation (e.g.
36
+# qemu-user) /proc reports the emulator, not the guest. Spawn test-tool
37
+# from test-tool and require "test-tool" in the child's ancestry.
38
test_expect_success 'detect cmd_ancestry support' '
39
test_when_finished "rm -f trace.detect" &&
40
GIT_TRACE2_BRIEF=1 GIT_TRACE2="$(pwd)/trace.detect" \
38
- test-tool trace2 001return 0 &&
39
- if grep -q "^cmd_ancestry" trace.detect
41
+ test-tool trace2 004child test-tool trace2 001return 0 &&
42
+ if grep -q "^cmd_ancestry.*test-tool" trace.detect
43
then
44
test_set_prereq TRACE2_ANCESTRY
45
fi