The GCR_EL1 context-switch test prints its TAP plan before forking 1,024
child processes. When stdout is fully buffered, the plan remains in the
stdio buffer. Each child inherits the pending "1..1" line and flushes its
copy from exit(), producing repeated plan lines.

ksft_print_header() enables line buffering before printing the TAP
header. Call it before the plan so the plan is flushed before the child
processes are forked.

Fixes: 29f080881601 ("kselftest/arm64: check GCR_EL1 after context switch")
Reviewed-by: Mark Brown <[email protected]>
Signed-off-by: Muhammad Usama Anjum <[email protected]>
---
Changes since v1:
- Explain how line buffering prevents duplicate plan lines.
- Use the selftests/arm64 subject prefix.
---
 tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c 
b/tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c
index 325bca0de0f6e..d23f154d3288c 100644
--- a/tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c
+++ b/tools/testing/selftests/arm64/mte/check_gcr_el1_cswitch.c
@@ -131,6 +131,7 @@ int main(int argc, char *argv[])
        if (err)
                return err;
 
+       ksft_print_header();
        ksft_set_plan(1);
 
        evaluate_test(mte_gcr_fork_test(),
-- 
2.47.3


Reply via email to