From 12856c4096d7e842021a6e9ed16a8e8e823fe0c2 Mon Sep 17 00:00:00 2001
From: Aditya G S <adityags2004@gmail.com>
Date: Thu, 14 May 2026 14:02:13 +0530
Subject: [PATCH] gawk: disable randtest in ptest

gawk: ptest: disable randtest due to nondeterministic behavior

randtest performs a statistical validation of randomness by computing
autocorrelation of generated samples and verifying that the results
remain within a defined sigma threshold.

In testing, the correlation values are generally small and consistent
with expected random behavior. However, in some runs the condition:

    abs(corr[tau] / sigma) > max_allowed_sigma

is triggered, resulting in intermittent failures.

This behavior appears to be highly sensitive to small variations in
floating point calculations and runtime conditions such as CPU timing,
entropy state, and execution environment. The test can pass or fail
without any functional issue in rand() itself.

This was reproduced by enabling debug output in randtest and running
it multiple times, where occasional failures were observed despite
normal statistical characteristics of the output.

Since the underlying functionality appears correct and the failure is
environment-dependent, this test behaves similarly to other
nondeterministic tests (e.g., time, timeout) already skipped in this recipe.

As a temporary measure, disable randtest in ptest to ensure stable
test results in CI environments.

Upstream discussion: (add link once reported)

Signed-off-by: Aditya GS <adityags2004@gmail.com>
---
 meta/recipes-extended/gawk/gawk_5.4.0.bb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/recipes-extended/gawk/gawk_5.4.0.bb b/meta/recipes-extended/gawk/gawk_5.4.0.bb
index d7211f28f3..7962a1ebac 100644
--- a/meta/recipes-extended/gawk/gawk_5.4.0.bb
+++ b/meta/recipes-extended/gawk/gawk_5.4.0.bb
@@ -83,6 +83,10 @@ do_install_ptest() {
 	for t in time timeout; do
 		echo $t >> ${D}${PTEST_PATH}/test/skipped.txt
 	done
+
+ rm -f ${D}${PTEST_PATH}/test/randtest.*
+ echo randtest >> ${D}${PTEST_PATH}/test/skipped.txt
+ 
 }
 
 do_install_ptest:append:libc-musl() {
-- 
2.34.1

