* [PATCH] gawk: improve randtest stability
@ 2026-06-05 8:17 Aditya GS
2026-06-05 10:18 ` Alexander Kanavin
0 siblings, 1 reply; 9+ messages in thread
From: Aditya GS @ 2026-06-05 8:17 UTC (permalink / raw)
To: openembedded-core
Cc: richard.purdie, alex.kanavin, joaomarcos.costa, ross.burton,
randy.macleod, Aditya GS
Backport upstream fix to improve stability of randtest.sh by
retrying when sigma is too small, avoiding intermittent failures.
[YOCTO #16254]
Signed-off-by: Aditya GS <adityags2004@gmail.com>
---
.../gawk/files/randtest-fix.patch | 138 ++++++++++++++++++
meta/recipes-extended/gawk/gawk_5.4.0.bb | 1 +
2 files changed, 139 insertions(+)
create mode 100644 meta/recipes-extended/gawk/files/randtest-fix.patch
diff --git a/meta/recipes-extended/gawk/files/randtest-fix.patch b/meta/recipes-extended/gawk/files/randtest-fix.patch
new file mode 100644
index 0000000000..0aafa0f282
--- /dev/null
+++ b/meta/recipes-extended/gawk/files/randtest-fix.patch
@@ -0,0 +1,138 @@
+From f2250f4bc864913437619af7a9834a1c24915acd Mon Sep 17 00:00:00 2001
+From: "Arnold D. Robbins" <arnold@skeeve.com>
+Date: Thu, 28 May 2026 09:52:41 -0400
+Subject: Improve test/randtest.sh.
+
+Upstream-Status: Backport
+https://cgit.git.savannah.gnu.org/cgit/gawk.git/commit/?id=f2250f4bc864913437619af7a9834a1c24915acd
+
+Signed-off-by: Aditya GS <adityags2004@gmail.com>
+
+---
+
+diff --git a/test/randtest.sh b/test/randtest.sh
+index 597376a8..6ae6f830 100755
+--- a/test/randtest.sh
++++ b/test/randtest.sh
+@@ -45,68 +45,77 @@ $AWK 'BEGIN{
+ nsamples=('$NSAMPLES');
+ max_allowed_sigma=('$MAX_ALLOWED_SIGMA');
+ nruns=('$NRUNS');
+- for(tau=0;tau<nsamples/2;tau++) corr[tau]=0;
++ max_retries=5
+
+- for(run=0;run<nruns;run++) {
+- sum=0;
++ for (retry=0; retry<max_retries; retry++) {
++ for(tau=0; tau<nsamples/2; tau++) corr[tau]=0;
+
+- # Fill an array with a sequence of samples that are a
+- # function of pairs of rand() values.
++ for(run=0; run<nruns; run++) {
++ sum=0;
+
+- for(i=0;i<nsamples;i++) {
+- samp[i]=((rand()-0.5)*(rand()-0.5))^2;
+- sum=sum+samp[i];
+- }
++ # Fill an array with a sequence of samples that are a
++ # function of pairs of rand() values.
+
+- # Subtract off the mean of the sequence:
++ for(i=0; i<nsamples; i++) {
++ samp[i]=((rand()-0.5)*(rand()-0.5))^2;
++ sum=sum+samp[i];
++ }
+
+- mean=sum/nsamples;
+- for(i=0;i<nsamples;i++) samp[i]=samp[i]-mean;
++ # Subtract off the mean of the sequence:
+
+- # Calculate an autocorrelation function on the sequence.
+- # Because the values of rand() should be independent, there
+- # should be no peaks in the autocorrelation.
++ mean=sum/nsamples;
++ for(i=0;i<nsamples;i++) samp[i]=samp[i]-mean;
+
+- for(tau=0;tau<nsamples/2;tau++) {
+- sum=0;
+- for(i=0;i<nsamples/2;i++) sum=sum+samp[i]*samp[i+tau];
+- corr[tau]=corr[tau]+sum;
+- }
++ # Calculate an autocorrelation function on the sequence.
++ # Because the values of rand() should be independent, there
++ # should be no peaks in the autocorrelation.
+
+- }
+- # Normalize the autocorrelation to the tau=0 value.
++ for(tau=0; tau<nsamples/2; tau++) {
++ sum=0;
++ for(i=0;i<nsamples/2;i++) sum=sum+samp[i]*samp[i+tau];
++ corr[tau]=corr[tau]+sum;
++ }
+
+- max_corr=corr[0];
+- for(tau=0;tau<nsamples/2;tau++) corr[tau]=corr[tau]/max_corr;
++ }
++ # Normalize the autocorrelation to the tau=0 value.
+
+- # OPTIONALLY Print out the autocorrelation values:
++ max_corr=corr[0];
++ for(tau=0;tau<nsamples/2;tau++) corr[tau]=corr[tau]/max_corr;
+
+- # for(tau=0;tau<nsamples/2;tau++) print tau, corr[tau] > "pairpower_corr.data";
++ # OPTIONALLY Print out the autocorrelation values:
+
+- # Calculate the sigma for the non-zero tau values:
++ # for(tau=0;tau<nsamples/2;tau++) print tau, corr[tau] > "pairpower_corr.data";
+
+- power_sum=0;
++ # Calculate the sigma for the non-zero tau values:
+
+- for(tau=1;tau<nsamples/2;tau++) power_sum=power_sum+(corr[tau])^2;
++ power_sum=0;
+
+- sigma=sqrt(power_sum/(nsamples/2-1));
++ for(tau=1;tau<nsamples/2;tau++) power_sum=power_sum+(corr[tau])^2;
+
+- # See if any of the correlations exceed a reasonable number of sigma:
++ sigma=sqrt(power_sum/(nsamples/2-1));
+
+- passed=1;
+- for(tau=1;tau<nsamples/2;tau++) {
+- if ( abs(corr[tau])/sigma > max_allowed_sigma ) {
+- print "Tau=", tau ", Autocorr=", corr[tau]/sigma, "sigma";
+- passed=0;
+- }
++ if (sigma < 1e-6) {
++ print "Sigma too small, retrying run", retry
++ continue
+ }
+- if(!passed) {
+- print "Test failed."
+- exit(1);
++
++ # See if any of the correlations exceed a reasonable number of sigma:
++
++ for(tau=1;tau<nsamples/2;tau++) {
++ if (abs(corr[tau])/sigma > max_allowed_sigma) {
++ print "Tau=", tau ", Autocorr=", corr[tau]/sigma, "sigma";
++ print "Test failed."
++ exit 1
++ }
+ }
+- else exit (0);
++
++ exit 0
+ }
+
++ print "Test failed after retries due to unstable sigma"
++ exit 1
++}
++
+ function abs(abs_input) { return(sqrt(abs_input^2)) ; }
+ '
+
+--
+2.34.1
+
diff --git a/meta/recipes-extended/gawk/gawk_5.4.0.bb b/meta/recipes-extended/gawk/gawk_5.4.0.bb
index d7211f28f3..71e7ddb31f 100644
--- a/meta/recipes-extended/gawk/gawk_5.4.0.bb
+++ b/meta/recipes-extended/gawk/gawk_5.4.0.bb
@@ -28,6 +28,7 @@ PACKAGECONFIG[pma-if-64bit] = "--enable-pma,--disable-pma, "
SRC_URI = "${GNU_MIRROR}/gawk/gawk-${PV}.tar.xz \
file://run-ptest \
file://0001-configure.ac-re-enable-disabled-printf-features.patch \
+ file://randtest-fix.patch \
"
SRC_URI[sha256sum] = "3dd430f0cd3b4428c6c3f6afc021b9cd3c1f8c93f7a688dc268ca428a90b4ac1"
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH] gawk: improve randtest stability
2026-06-05 8:17 [PATCH] gawk: improve randtest stability Aditya GS
@ 2026-06-05 10:18 ` Alexander Kanavin
2026-06-05 10:27 ` Aditya G.S
0 siblings, 1 reply; 9+ messages in thread
From: Alexander Kanavin @ 2026-06-05 10:18 UTC (permalink / raw)
To: Aditya GS
Cc: openembedded-core, richard.purdie, joaomarcos.costa, ross.burton,
randy.macleod
Hello Aditya,
an earlier version of the patch was already fixed up and merged; the
patch review participants decided that it's better to fix the
frustrating CI failures quicker than do more review-fix-resend cycles:
https://git.openembedded.org/openembedded-core/commit/?id=ccabae3036a713cac8b08731b765ff1dc3ed93eb
I'd suggest you rebase the latest commit on top of current oe-core
master with 'git rebase', and send any remaining differences (e.g. the
missing signed-off-by) as a separate patch (remember to also edit the
commit message so it matches the patch content).
Alex
On Fri, 5 Jun 2026 at 10:18, Aditya GS <adityags2004@gmail.com> wrote:
>
> Backport upstream fix to improve stability of randtest.sh by
> retrying when sigma is too small, avoiding intermittent failures.
>
> [YOCTO #16254]
>
> Signed-off-by: Aditya GS <adityags2004@gmail.com>
> ---
> .../gawk/files/randtest-fix.patch | 138 ++++++++++++++++++
> meta/recipes-extended/gawk/gawk_5.4.0.bb | 1 +
> 2 files changed, 139 insertions(+)
> create mode 100644 meta/recipes-extended/gawk/files/randtest-fix.patch
>
> diff --git a/meta/recipes-extended/gawk/files/randtest-fix.patch b/meta/recipes-extended/gawk/files/randtest-fix.patch
> new file mode 100644
> index 0000000000..0aafa0f282
> --- /dev/null
> +++ b/meta/recipes-extended/gawk/files/randtest-fix.patch
> @@ -0,0 +1,138 @@
> +From f2250f4bc864913437619af7a9834a1c24915acd Mon Sep 17 00:00:00 2001
> +From: "Arnold D. Robbins" <arnold@skeeve.com>
> +Date: Thu, 28 May 2026 09:52:41 -0400
> +Subject: Improve test/randtest.sh.
> +
> +Upstream-Status: Backport
> +https://cgit.git.savannah.gnu.org/cgit/gawk.git/commit/?id=f2250f4bc864913437619af7a9834a1c24915acd
> +
> +Signed-off-by: Aditya GS <adityags2004@gmail.com>
> +
> +---
> +
> +diff --git a/test/randtest.sh b/test/randtest.sh
> +index 597376a8..6ae6f830 100755
> +--- a/test/randtest.sh
> ++++ b/test/randtest.sh
> +@@ -45,68 +45,77 @@ $AWK 'BEGIN{
> + nsamples=('$NSAMPLES');
> + max_allowed_sigma=('$MAX_ALLOWED_SIGMA');
> + nruns=('$NRUNS');
> +- for(tau=0;tau<nsamples/2;tau++) corr[tau]=0;
> ++ max_retries=5
> +
> +- for(run=0;run<nruns;run++) {
> +- sum=0;
> ++ for (retry=0; retry<max_retries; retry++) {
> ++ for(tau=0; tau<nsamples/2; tau++) corr[tau]=0;
> +
> +- # Fill an array with a sequence of samples that are a
> +- # function of pairs of rand() values.
> ++ for(run=0; run<nruns; run++) {
> ++ sum=0;
> +
> +- for(i=0;i<nsamples;i++) {
> +- samp[i]=((rand()-0.5)*(rand()-0.5))^2;
> +- sum=sum+samp[i];
> +- }
> ++ # Fill an array with a sequence of samples that are a
> ++ # function of pairs of rand() values.
> +
> +- # Subtract off the mean of the sequence:
> ++ for(i=0; i<nsamples; i++) {
> ++ samp[i]=((rand()-0.5)*(rand()-0.5))^2;
> ++ sum=sum+samp[i];
> ++ }
> +
> +- mean=sum/nsamples;
> +- for(i=0;i<nsamples;i++) samp[i]=samp[i]-mean;
> ++ # Subtract off the mean of the sequence:
> +
> +- # Calculate an autocorrelation function on the sequence.
> +- # Because the values of rand() should be independent, there
> +- # should be no peaks in the autocorrelation.
> ++ mean=sum/nsamples;
> ++ for(i=0;i<nsamples;i++) samp[i]=samp[i]-mean;
> +
> +- for(tau=0;tau<nsamples/2;tau++) {
> +- sum=0;
> +- for(i=0;i<nsamples/2;i++) sum=sum+samp[i]*samp[i+tau];
> +- corr[tau]=corr[tau]+sum;
> +- }
> ++ # Calculate an autocorrelation function on the sequence.
> ++ # Because the values of rand() should be independent, there
> ++ # should be no peaks in the autocorrelation.
> +
> +- }
> +- # Normalize the autocorrelation to the tau=0 value.
> ++ for(tau=0; tau<nsamples/2; tau++) {
> ++ sum=0;
> ++ for(i=0;i<nsamples/2;i++) sum=sum+samp[i]*samp[i+tau];
> ++ corr[tau]=corr[tau]+sum;
> ++ }
> +
> +- max_corr=corr[0];
> +- for(tau=0;tau<nsamples/2;tau++) corr[tau]=corr[tau]/max_corr;
> ++ }
> ++ # Normalize the autocorrelation to the tau=0 value.
> +
> +- # OPTIONALLY Print out the autocorrelation values:
> ++ max_corr=corr[0];
> ++ for(tau=0;tau<nsamples/2;tau++) corr[tau]=corr[tau]/max_corr;
> +
> +- # for(tau=0;tau<nsamples/2;tau++) print tau, corr[tau] > "pairpower_corr.data";
> ++ # OPTIONALLY Print out the autocorrelation values:
> +
> +- # Calculate the sigma for the non-zero tau values:
> ++ # for(tau=0;tau<nsamples/2;tau++) print tau, corr[tau] > "pairpower_corr.data";
> +
> +- power_sum=0;
> ++ # Calculate the sigma for the non-zero tau values:
> +
> +- for(tau=1;tau<nsamples/2;tau++) power_sum=power_sum+(corr[tau])^2;
> ++ power_sum=0;
> +
> +- sigma=sqrt(power_sum/(nsamples/2-1));
> ++ for(tau=1;tau<nsamples/2;tau++) power_sum=power_sum+(corr[tau])^2;
> +
> +- # See if any of the correlations exceed a reasonable number of sigma:
> ++ sigma=sqrt(power_sum/(nsamples/2-1));
> +
> +- passed=1;
> +- for(tau=1;tau<nsamples/2;tau++) {
> +- if ( abs(corr[tau])/sigma > max_allowed_sigma ) {
> +- print "Tau=", tau ", Autocorr=", corr[tau]/sigma, "sigma";
> +- passed=0;
> +- }
> ++ if (sigma < 1e-6) {
> ++ print "Sigma too small, retrying run", retry
> ++ continue
> + }
> +- if(!passed) {
> +- print "Test failed."
> +- exit(1);
> ++
> ++ # See if any of the correlations exceed a reasonable number of sigma:
> ++
> ++ for(tau=1;tau<nsamples/2;tau++) {
> ++ if (abs(corr[tau])/sigma > max_allowed_sigma) {
> ++ print "Tau=", tau ", Autocorr=", corr[tau]/sigma, "sigma";
> ++ print "Test failed."
> ++ exit 1
> ++ }
> + }
> +- else exit (0);
> ++
> ++ exit 0
> + }
> +
> ++ print "Test failed after retries due to unstable sigma"
> ++ exit 1
> ++}
> ++
> + function abs(abs_input) { return(sqrt(abs_input^2)) ; }
> + '
> +
> +--
> +2.34.1
> +
> diff --git a/meta/recipes-extended/gawk/gawk_5.4.0.bb b/meta/recipes-extended/gawk/gawk_5.4.0.bb
> index d7211f28f3..71e7ddb31f 100644
> --- a/meta/recipes-extended/gawk/gawk_5.4.0.bb
> +++ b/meta/recipes-extended/gawk/gawk_5.4.0.bb
> @@ -28,6 +28,7 @@ PACKAGECONFIG[pma-if-64bit] = "--enable-pma,--disable-pma, "
> SRC_URI = "${GNU_MIRROR}/gawk/gawk-${PV}.tar.xz \
> file://run-ptest \
> file://0001-configure.ac-re-enable-disabled-printf-features.patch \
> + file://randtest-fix.patch \
> "
>
> SRC_URI[sha256sum] = "3dd430f0cd3b4428c6c3f6afc021b9cd3c1f8c93f7a688dc268ca428a90b4ac1"
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] gawk: improve randtest stability
2026-06-05 10:18 ` Alexander Kanavin
@ 2026-06-05 10:27 ` Aditya G.S
2026-06-05 10:34 ` Alexander Kanavin
0 siblings, 1 reply; 9+ messages in thread
From: Aditya G.S @ 2026-06-05 10:27 UTC (permalink / raw)
To: Alexander Kanavin
Cc: openembedded-core, Richard Purdie, joaomarcos.costa, ross.burton,
randy.macleod
[-- Attachment #1: Type: text/plain, Size: 7952 bytes --]
Hi Alex,
Thanks for the update.
I've reviewed the merged commit and verified that the fix is already
present and complete, including the required metadata.
My latest submission (v11) also included the missing Signed-off-by, so I
believe there are no remaining differences to address.
Thanks again for reviewing and integrating the fix.
Regards,
Aditya
On Fri, Jun 5, 2026, 3:49 PM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:
> Hello Aditya,
>
> an earlier version of the patch was already fixed up and merged; the
> patch review participants decided that it's better to fix the
> frustrating CI failures quicker than do more review-fix-resend cycles:
>
> https://git.openembedded.org/openembedded-core/commit/?id=ccabae3036a713cac8b08731b765ff1dc3ed93eb
>
> I'd suggest you rebase the latest commit on top of current oe-core
> master with 'git rebase', and send any remaining differences (e.g. the
> missing signed-off-by) as a separate patch (remember to also edit the
> commit message so it matches the patch content).
>
> Alex
>
> On Fri, 5 Jun 2026 at 10:18, Aditya GS <adityags2004@gmail.com> wrote:
> >
> > Backport upstream fix to improve stability of randtest.sh by
> > retrying when sigma is too small, avoiding intermittent failures.
> >
> > [YOCTO #16254]
> >
> > Signed-off-by: Aditya GS <adityags2004@gmail.com>
> > ---
> > .../gawk/files/randtest-fix.patch | 138 ++++++++++++++++++
> > meta/recipes-extended/gawk/gawk_5.4.0.bb | 1 +
> > 2 files changed, 139 insertions(+)
> > create mode 100644 meta/recipes-extended/gawk/files/randtest-fix.patch
> >
> > diff --git a/meta/recipes-extended/gawk/files/randtest-fix.patch
> b/meta/recipes-extended/gawk/files/randtest-fix.patch
> > new file mode 100644
> > index 0000000000..0aafa0f282
> > --- /dev/null
> > +++ b/meta/recipes-extended/gawk/files/randtest-fix.patch
> > @@ -0,0 +1,138 @@
> > +From f2250f4bc864913437619af7a9834a1c24915acd Mon Sep 17 00:00:00 2001
> > +From: "Arnold D. Robbins" <arnold@skeeve.com>
> > +Date: Thu, 28 May 2026 09:52:41 -0400
> > +Subject: Improve test/randtest.sh.
> > +
> > +Upstream-Status: Backport
> > +
> https://cgit.git.savannah.gnu.org/cgit/gawk.git/commit/?id=f2250f4bc864913437619af7a9834a1c24915acd
> > +
> > +Signed-off-by: Aditya GS <adityags2004@gmail.com>
> > +
> > +---
> > +
> > +diff --git a/test/randtest.sh b/test/randtest.sh
> > +index 597376a8..6ae6f830 100755
> > +--- a/test/randtest.sh
> > ++++ b/test/randtest.sh
> > +@@ -45,68 +45,77 @@ $AWK 'BEGIN{
> > + nsamples=('$NSAMPLES');
> > + max_allowed_sigma=('$MAX_ALLOWED_SIGMA');
> > + nruns=('$NRUNS');
> > +- for(tau=0;tau<nsamples/2;tau++) corr[tau]=0;
> > ++ max_retries=5
> > +
> > +- for(run=0;run<nruns;run++) {
> > +- sum=0;
> > ++ for (retry=0; retry<max_retries; retry++) {
> > ++ for(tau=0; tau<nsamples/2; tau++) corr[tau]=0;
> > +
> > +- # Fill an array with a sequence of samples that are a
> > +- # function of pairs of rand() values.
> > ++ for(run=0; run<nruns; run++) {
> > ++ sum=0;
> > +
> > +- for(i=0;i<nsamples;i++) {
> > +- samp[i]=((rand()-0.5)*(rand()-0.5))^2;
> > +- sum=sum+samp[i];
> > +- }
> > ++ # Fill an array with a sequence of samples that are a
> > ++ # function of pairs of rand() values.
> > +
> > +- # Subtract off the mean of the sequence:
> > ++ for(i=0; i<nsamples; i++) {
> > ++ samp[i]=((rand()-0.5)*(rand()-0.5))^2;
> > ++ sum=sum+samp[i];
> > ++ }
> > +
> > +- mean=sum/nsamples;
> > +- for(i=0;i<nsamples;i++) samp[i]=samp[i]-mean;
> > ++ # Subtract off the mean of the sequence:
> > +
> > +- # Calculate an autocorrelation function on the sequence.
> > +- # Because the values of rand() should be independent, there
> > +- # should be no peaks in the autocorrelation.
> > ++ mean=sum/nsamples;
> > ++ for(i=0;i<nsamples;i++) samp[i]=samp[i]-mean;
> > +
> > +- for(tau=0;tau<nsamples/2;tau++) {
> > +- sum=0;
> > +- for(i=0;i<nsamples/2;i++) sum=sum+samp[i]*samp[i+tau];
> > +- corr[tau]=corr[tau]+sum;
> > +- }
> > ++ # Calculate an autocorrelation function on the sequence.
> > ++ # Because the values of rand() should be independent, there
> > ++ # should be no peaks in the autocorrelation.
> > +
> > +- }
> > +- # Normalize the autocorrelation to the tau=0 value.
> > ++ for(tau=0; tau<nsamples/2; tau++) {
> > ++ sum=0;
> > ++ for(i=0;i<nsamples/2;i++) sum=sum+samp[i]*samp[i+tau];
> > ++ corr[tau]=corr[tau]+sum;
> > ++ }
> > +
> > +- max_corr=corr[0];
> > +- for(tau=0;tau<nsamples/2;tau++) corr[tau]=corr[tau]/max_corr;
> > ++ }
> > ++ # Normalize the autocorrelation to the tau=0 value.
> > +
> > +- # OPTIONALLY Print out the autocorrelation values:
> > ++ max_corr=corr[0];
> > ++ for(tau=0;tau<nsamples/2;tau++) corr[tau]=corr[tau]/max_corr;
> > +
> > +- # for(tau=0;tau<nsamples/2;tau++) print tau, corr[tau] >
> "pairpower_corr.data";
> > ++ # OPTIONALLY Print out the autocorrelation values:
> > +
> > +- # Calculate the sigma for the non-zero tau values:
> > ++ # for(tau=0;tau<nsamples/2;tau++) print tau, corr[tau] >
> "pairpower_corr.data";
> > +
> > +- power_sum=0;
> > ++ # Calculate the sigma for the non-zero tau values:
> > +
> > +- for(tau=1;tau<nsamples/2;tau++) power_sum=power_sum+(corr[tau])^2;
> > ++ power_sum=0;
> > +
> > +- sigma=sqrt(power_sum/(nsamples/2-1));
> > ++ for(tau=1;tau<nsamples/2;tau++)
> power_sum=power_sum+(corr[tau])^2;
> > +
> > +- # See if any of the correlations exceed a reasonable number of
> sigma:
> > ++ sigma=sqrt(power_sum/(nsamples/2-1));
> > +
> > +- passed=1;
> > +- for(tau=1;tau<nsamples/2;tau++) {
> > +- if ( abs(corr[tau])/sigma > max_allowed_sigma ) {
> > +- print "Tau=", tau ", Autocorr=", corr[tau]/sigma, "sigma";
> > +- passed=0;
> > +- }
> > ++ if (sigma < 1e-6) {
> > ++ print "Sigma too small, retrying run", retry
> > ++ continue
> > + }
> > +- if(!passed) {
> > +- print "Test failed."
> > +- exit(1);
> > ++
> > ++ # See if any of the correlations exceed a reasonable number of
> sigma:
> > ++
> > ++ for(tau=1;tau<nsamples/2;tau++) {
> > ++ if (abs(corr[tau])/sigma > max_allowed_sigma) {
> > ++ print "Tau=", tau ", Autocorr=", corr[tau]/sigma,
> "sigma";
> > ++ print "Test failed."
> > ++ exit 1
> > ++ }
> > + }
> > +- else exit (0);
> > ++
> > ++ exit 0
> > + }
> > +
> > ++ print "Test failed after retries due to unstable sigma"
> > ++ exit 1
> > ++}
> > ++
> > + function abs(abs_input) { return(sqrt(abs_input^2)) ; }
> > + '
> > +
> > +--
> > +2.34.1
> > +
> > diff --git a/meta/recipes-extended/gawk/gawk_5.4.0.bb
> b/meta/recipes-extended/gawk/gawk_5.4.0.bb
> > index d7211f28f3..71e7ddb31f 100644
> > --- a/meta/recipes-extended/gawk/gawk_5.4.0.bb
> > +++ b/meta/recipes-extended/gawk/gawk_5.4.0.bb
> > @@ -28,6 +28,7 @@ PACKAGECONFIG[pma-if-64bit] =
> "--enable-pma,--disable-pma, "
> > SRC_URI = "${GNU_MIRROR}/gawk/gawk-${PV}.tar.xz \
> > file://run-ptest \
> >
> file://0001-configure.ac-re-enable-disabled-printf-features.patch \
> > + file://randtest-fix.patch \
> > "
> >
> > SRC_URI[sha256sum] =
> "3dd430f0cd3b4428c6c3f6afc021b9cd3c1f8c93f7a688dc268ca428a90b4ac1"
> > --
> > 2.34.1
> >
>
[-- Attachment #2: Type: text/html, Size: 11081 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] gawk: improve randtest stability
2026-06-05 10:27 ` Aditya G.S
@ 2026-06-05 10:34 ` Alexander Kanavin
2026-06-05 11:50 ` Aditya G.S
0 siblings, 1 reply; 9+ messages in thread
From: Alexander Kanavin @ 2026-06-05 10:34 UTC (permalink / raw)
To: Aditya G.S
Cc: openembedded-core, Richard Purdie, joaomarcos.costa, ross.burton,
randy.macleod
On Fri, 5 Jun 2026 at 12:28, Aditya G.S <adityags2004@gmail.com> wrote:
> I've reviewed the merged commit and verified that the fix is already present and complete, including the required metadata.
>
> My latest submission (v11) also included the missing Signed-off-by, so I believe there are no remaining differences to address.
Your latest submission has the signed-off-by, but the version that got
merged in master does not. So you can rebase your latest submission on
top of master branch (use 'git rebase'), and it would reduce it to
just adding the signed-off-by, and then you can re-submit just that
change.
Alex
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] gawk: improve randtest stability
2026-06-05 10:34 ` Alexander Kanavin
@ 2026-06-05 11:50 ` Aditya G.S
0 siblings, 0 replies; 9+ messages in thread
From: Aditya G.S @ 2026-06-05 11:50 UTC (permalink / raw)
To: Alexander Kanavin
Cc: openembedded-core, Richard Purdie, joaomarcos.costa, ross.burton,
randy.macleod
[-- Attachment #1: Type: text/plain, Size: 949 bytes --]
Hi Alex,
Thanks for the clarification.
I've rebased on top of master and submitted a follow-up patch that adds the
missing Signed-off-by to the previously merged change.
Thanks,
Aditya
On Fri, Jun 5, 2026, 4:04 PM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:
> On Fri, 5 Jun 2026 at 12:28, Aditya G.S <adityags2004@gmail.com> wrote:
> > I've reviewed the merged commit and verified that the fix is already
> present and complete, including the required metadata.
> >
> > My latest submission (v11) also included the missing Signed-off-by, so I
> believe there are no remaining differences to address.
>
> Your latest submission has the signed-off-by, but the version that got
> merged in master does not. So you can rebase your latest submission on
> top of master branch (use 'git rebase'), and it would reduce it to
> just adding the signed-off-by, and then you can re-submit just that
> change.
>
> Alex
>
[-- Attachment #2: Type: text/html, Size: 1508 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH] gawk: improve randtest stability
@ 2026-06-05 6:10 Aditya GS
0 siblings, 0 replies; 9+ messages in thread
From: Aditya GS @ 2026-06-05 6:10 UTC (permalink / raw)
To: openembedded-core
Cc: richard.purdie, alex.kanavin, joaomarcos.costa, ross.burton,
randy.macleod, Aditya GS
Backport upstream fix to improve stability of randtest.sh by
retrying when sigma is too small, avoiding intermittent failures.
[YOCTO #16254]
Signed-off-by: Aditya GS <adityags2004@gmail.com>
---
.../gawk/files/randtest-fix.patch | 136 ++++++++++++++++++
meta/recipes-extended/gawk/gawk_5.4.0.bb | 1 +
2 files changed, 137 insertions(+)
create mode 100644 meta/recipes-extended/gawk/files/randtest-fix.patch
diff --git a/meta/recipes-extended/gawk/files/randtest-fix.patch b/meta/recipes-extended/gawk/files/randtest-fix.patch
new file mode 100644
index 0000000000..ee1950e8bc
--- /dev/null
+++ b/meta/recipes-extended/gawk/files/randtest-fix.patch
@@ -0,0 +1,136 @@
+From f2250f4bc864913437619af7a9834a1c24915acd Mon Sep 17 00:00:00 2001
+From: "Arnold D. Robbins" <arnold@skeeve.com>
+Date: Thu, 28 May 2026 09:52:41 -0400
+Subject: Improve test/randtest.sh.
+
+Upstream-Status: Backport
+https://cgit.git.savannah.gnu.org/cgit/gawk.git/commit/?id=f2250f4bc864913437619af7a9834a1c24915acd
+
+---
+
+diff --git a/test/randtest.sh b/test/randtest.sh
+index 597376a8..6ae6f830 100755
+--- a/test/randtest.sh
++++ b/test/randtest.sh
+@@ -45,68 +45,77 @@ $AWK 'BEGIN{
+ nsamples=('$NSAMPLES');
+ max_allowed_sigma=('$MAX_ALLOWED_SIGMA');
+ nruns=('$NRUNS');
+- for(tau=0;tau<nsamples/2;tau++) corr[tau]=0;
++ max_retries=5
+
+- for(run=0;run<nruns;run++) {
+- sum=0;
++ for (retry=0; retry<max_retries; retry++) {
++ for(tau=0; tau<nsamples/2; tau++) corr[tau]=0;
+
+- # Fill an array with a sequence of samples that are a
+- # function of pairs of rand() values.
++ for(run=0; run<nruns; run++) {
++ sum=0;
+
+- for(i=0;i<nsamples;i++) {
+- samp[i]=((rand()-0.5)*(rand()-0.5))^2;
+- sum=sum+samp[i];
+- }
++ # Fill an array with a sequence of samples that are a
++ # function of pairs of rand() values.
+
+- # Subtract off the mean of the sequence:
++ for(i=0; i<nsamples; i++) {
++ samp[i]=((rand()-0.5)*(rand()-0.5))^2;
++ sum=sum+samp[i];
++ }
+
+- mean=sum/nsamples;
+- for(i=0;i<nsamples;i++) samp[i]=samp[i]-mean;
++ # Subtract off the mean of the sequence:
+
+- # Calculate an autocorrelation function on the sequence.
+- # Because the values of rand() should be independent, there
+- # should be no peaks in the autocorrelation.
++ mean=sum/nsamples;
++ for(i=0;i<nsamples;i++) samp[i]=samp[i]-mean;
+
+- for(tau=0;tau<nsamples/2;tau++) {
+- sum=0;
+- for(i=0;i<nsamples/2;i++) sum=sum+samp[i]*samp[i+tau];
+- corr[tau]=corr[tau]+sum;
+- }
++ # Calculate an autocorrelation function on the sequence.
++ # Because the values of rand() should be independent, there
++ # should be no peaks in the autocorrelation.
+
+- }
+- # Normalize the autocorrelation to the tau=0 value.
++ for(tau=0; tau<nsamples/2; tau++) {
++ sum=0;
++ for(i=0;i<nsamples/2;i++) sum=sum+samp[i]*samp[i+tau];
++ corr[tau]=corr[tau]+sum;
++ }
+
+- max_corr=corr[0];
+- for(tau=0;tau<nsamples/2;tau++) corr[tau]=corr[tau]/max_corr;
++ }
++ # Normalize the autocorrelation to the tau=0 value.
+
+- # OPTIONALLY Print out the autocorrelation values:
++ max_corr=corr[0];
++ for(tau=0;tau<nsamples/2;tau++) corr[tau]=corr[tau]/max_corr;
+
+- # for(tau=0;tau<nsamples/2;tau++) print tau, corr[tau] > "pairpower_corr.data";
++ # OPTIONALLY Print out the autocorrelation values:
+
+- # Calculate the sigma for the non-zero tau values:
++ # for(tau=0;tau<nsamples/2;tau++) print tau, corr[tau] > "pairpower_corr.data";
+
+- power_sum=0;
++ # Calculate the sigma for the non-zero tau values:
+
+- for(tau=1;tau<nsamples/2;tau++) power_sum=power_sum+(corr[tau])^2;
++ power_sum=0;
+
+- sigma=sqrt(power_sum/(nsamples/2-1));
++ for(tau=1;tau<nsamples/2;tau++) power_sum=power_sum+(corr[tau])^2;
+
+- # See if any of the correlations exceed a reasonable number of sigma:
++ sigma=sqrt(power_sum/(nsamples/2-1));
+
+- passed=1;
+- for(tau=1;tau<nsamples/2;tau++) {
+- if ( abs(corr[tau])/sigma > max_allowed_sigma ) {
+- print "Tau=", tau ", Autocorr=", corr[tau]/sigma, "sigma";
+- passed=0;
+- }
++ if (sigma < 1e-6) {
++ print "Sigma too small, retrying run", retry
++ continue
+ }
+- if(!passed) {
+- print "Test failed."
+- exit(1);
++
++ # See if any of the correlations exceed a reasonable number of sigma:
++
++ for(tau=1;tau<nsamples/2;tau++) {
++ if (abs(corr[tau])/sigma > max_allowed_sigma) {
++ print "Tau=", tau ", Autocorr=", corr[tau]/sigma, "sigma";
++ print "Test failed."
++ exit 1
++ }
+ }
+- else exit (0);
++
++ exit 0
+ }
+
++ print "Test failed after retries due to unstable sigma"
++ exit 1
++}
++
+ function abs(abs_input) { return(sqrt(abs_input^2)) ; }
+ '
+
+--
+2.34.1
+
diff --git a/meta/recipes-extended/gawk/gawk_5.4.0.bb b/meta/recipes-extended/gawk/gawk_5.4.0.bb
index d7211f28f3..71e7ddb31f 100644
--- a/meta/recipes-extended/gawk/gawk_5.4.0.bb
+++ b/meta/recipes-extended/gawk/gawk_5.4.0.bb
@@ -28,6 +28,7 @@ PACKAGECONFIG[pma-if-64bit] = "--enable-pma,--disable-pma, "
SRC_URI = "${GNU_MIRROR}/gawk/gawk-${PV}.tar.xz \
file://run-ptest \
file://0001-configure.ac-re-enable-disabled-printf-features.patch \
+ file://randtest-fix.patch \
"
SRC_URI[sha256sum] = "3dd430f0cd3b4428c6c3f6afc021b9cd3c1f8c93f7a688dc268ca428a90b4ac1"
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH] gawk: improve randtest stability
@ 2026-06-01 8:20 Aditya GS
2026-06-01 8:44 ` Alexander Kanavin
0 siblings, 1 reply; 9+ messages in thread
From: Aditya GS @ 2026-06-01 8:20 UTC (permalink / raw)
To: openembedded-core
Cc: richard.purdie, alex.kanavin, joaomarcos.costa, ross.burton,
randy.macleod, Aditya GS
Backport upstream fix to improve stability of randtest.sh by
retrying when sigma is too small, avoiding intermittent failures.
[YOCTO #16254]
Signed-off-by: Aditya GS <adityags2004@gmail.com>
---
.../0001-gawk-disable-randtest-in-ptest.patch | 59 +++++++++++++++++++
meta/recipes-extended/gawk/gawk_5.4.0.bb | 1 +
2 files changed, 60 insertions(+)
create mode 100644 meta/recipes-extended/gawk/0001-gawk-disable-randtest-in-ptest.patch
diff --git a/meta/recipes-extended/gawk/0001-gawk-disable-randtest-in-ptest.patch b/meta/recipes-extended/gawk/0001-gawk-disable-randtest-in-ptest.patch
new file mode 100644
index 0000000000..caa6f7a031
--- /dev/null
+++ b/meta/recipes-extended/gawk/0001-gawk-disable-randtest-in-ptest.patch
@@ -0,0 +1,59 @@
+From ff431c433eee5e35f6d637ada858af029c1c3a25 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..a357d172eb 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
+
diff --git a/meta/recipes-extended/gawk/gawk_5.4.0.bb b/meta/recipes-extended/gawk/gawk_5.4.0.bb
index d7211f28f3..71e7ddb31f 100644
--- a/meta/recipes-extended/gawk/gawk_5.4.0.bb
+++ b/meta/recipes-extended/gawk/gawk_5.4.0.bb
@@ -28,6 +28,7 @@ PACKAGECONFIG[pma-if-64bit] = "--enable-pma,--disable-pma, "
SRC_URI = "${GNU_MIRROR}/gawk/gawk-${PV}.tar.xz \
file://run-ptest \
file://0001-configure.ac-re-enable-disabled-printf-features.patch \
+ file://randtest-fix.patch \
"
SRC_URI[sha256sum] = "3dd430f0cd3b4428c6c3f6afc021b9cd3c1f8c93f7a688dc268ca428a90b4ac1"
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH] gawk: improve randtest stability
2026-06-01 8:20 Aditya GS
@ 2026-06-01 8:44 ` Alexander Kanavin
2026-06-05 5:55 ` Aditya G.S
0 siblings, 1 reply; 9+ messages in thread
From: Alexander Kanavin @ 2026-06-01 8:44 UTC (permalink / raw)
To: Aditya GS
Cc: openembedded-core, richard.purdie, joaomarcos.costa, ross.burton,
randy.macleod
On Mon, 1 Jun 2026 at 10:20, Aditya GS <adityags2004@gmail.com> wrote:
> +++ b/meta/recipes-extended/gawk/0001-gawk-disable-randtest-in-ptest.patch
> + file://randtest-fix.patch \
The filenames do not match. How was this tested?
Also the patch content isn't a backport, but an earlier test disabling fix.
I'd suggest you run 'git format-patch' before 'git send-email' so you
can inspect what is going to be sent, and to avoid mistakes like this.
Alex
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] gawk: improve randtest stability
2026-06-01 8:44 ` Alexander Kanavin
@ 2026-06-05 5:55 ` Aditya G.S
0 siblings, 0 replies; 9+ messages in thread
From: Aditya G.S @ 2026-06-05 5:55 UTC (permalink / raw)
To: Alexander Kanavin
Cc: openembedded-core, Richard Purdie, joaomarcos.costa, ross.burton,
randy.macleod
[-- Attachment #1: Type: text/plain, Size: 866 bytes --]
Hi Alex,
Thanks for the feedback.
You're right I had mistakenly included the earlier test-disabling patch in
the submission.
I've now removed it and ensured that only the upstream backport fix is
included with the correct metadata.
Resending.
Thanks,
Aditya
On Mon, Jun 1, 2026, 2:14 PM Alexander Kanavin <alex.kanavin@gmail.com>
wrote:
> On Mon, 1 Jun 2026 at 10:20, Aditya GS <adityags2004@gmail.com> wrote:
> > +++
> b/meta/recipes-extended/gawk/0001-gawk-disable-randtest-in-ptest.patch
> > + file://randtest-fix.patch \
>
> The filenames do not match. How was this tested?
>
> Also the patch content isn't a backport, but an earlier test disabling fix.
>
> I'd suggest you run 'git format-patch' before 'git send-email' so you
> can inspect what is going to be sent, and to avoid mistakes like this.
>
> Alex
>
[-- Attachment #2: Type: text/html, Size: 1533 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-06-05 14:22 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-05 8:17 [PATCH] gawk: improve randtest stability Aditya GS
2026-06-05 10:18 ` Alexander Kanavin
2026-06-05 10:27 ` Aditya G.S
2026-06-05 10:34 ` Alexander Kanavin
2026-06-05 11:50 ` Aditya G.S
-- strict thread matches above, loose matches on Subject: below --
2026-06-05 6:10 Aditya GS
2026-06-01 8:20 Aditya GS
2026-06-01 8:44 ` Alexander Kanavin
2026-06-05 5:55 ` Aditya G.S
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox