!12 fix test case probabilistic fail

From: @zou_lin77 
Reviewed-by: @overweight 
Signed-off-by: @overweight
This commit is contained in:
openeuler-ci-bot 2022-04-07 13:43:09 +00:00 committed by Gitee
commit 03e97ef952
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 170 additions and 1 deletions

View File

@ -0,0 +1,55 @@
From 0ed67a4f4f043acc08e3982a2648e3082e1f245a Mon Sep 17 00:00:00 2001
From: "Arnold D. Robbins" <arnold@skeeve.com>
Date: Sun, 14 Nov 2021 09:33:44 +0200
Subject: [PATCH] Disable racy test in test/iolint.awk.
---
test/iolint.awk | 13 ++++++++-----
test/iolint.ok | 6 +-----
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/test/iolint.awk b/test/iolint.awk
index 257678e..58fd746 100644
--- a/test/iolint.awk
+++ b/test/iolint.awk
@@ -55,12 +55,15 @@ BEGIN {
print close("cat")
fflush()
+ # 11/2021: Disable this test since it's a race condition
+ # and fails intermittently on some systems.
+ #
# `%.*s' used for input pipe and output pipe
- "echo hello" | getline junk
- print "hello" | "echo hello"
- print close("echo hello")
- print close("echo hello")
- fflush()
+ # "echo hello" | getline junk
+ # print "hello" | "echo hello"
+ # print close("echo hello")
+ # print close("echo hello")
+ # fflush()
# `%.*s' used for output file and output pipe"
BINMODE = 2
diff --git a/test/iolint.ok b/test/iolint.ok
index fbf514c..620a70f 100644
--- a/test/iolint.ok
+++ b/test/iolint.ok
@@ -23,11 +23,7 @@ gawk: iolint.awk:53: warning: `cat' used for output file and output pipe
0
hello
0
-gawk: iolint.awk:60: warning: `echo hello' used for input pipe and output pipe
-hello
-0
-0
-gawk: iolint.awk:68: warning: `cksum' used for output file and output pipe
+gawk: iolint.awk:71: warning: `cksum' used for output file and output pipe
3015617425 6
0
0
--
1.8.3.1

View File

@ -0,0 +1,43 @@
From e03c8822c48bedfe6cc7fbd5a9382d9630de6494 Mon Sep 17 00:00:00 2001
From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
Date: Tue, 7 Dec 2021 12:00:22 -0500
Subject: [PATCH] Reorder statements in iolint to try to eliminate a race
condition.
---
test/iolint.awk | 2 +-
test/iolint.ok | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/iolint.awk b/test/iolint.awk
index 042f743..3ebaf43 100644
--- a/test/iolint.awk
+++ b/test/iolint.awk
@@ -49,8 +49,8 @@ BEGIN {
# `%.*s' used for output pipe and two-way pipe
# Not doing |& due to race condition and signals. sigh
cat = "cat"
- print "hello" | "cat"
print "/bin/cat \"$@\"" > "cat"
+ print "hello" | "cat"
print close("cat")
print close("cat")
fflush()
diff --git a/test/iolint.ok b/test/iolint.ok
index 7a165aa..860bcfb 100644
--- a/test/iolint.ok
+++ b/test/iolint.ok
@@ -20,9 +20,9 @@ gawk: iolint.awk:42: warning: `echo hello' used for input pipe and output file
0
0
gawk: iolint.awk:53: warning: `cat' used for output file and output pipe
-0
hello
0
+0
gawk: iolint.awk:67: warning: `eval $CMD_TO_RUN' used for input pipe and output pipe
0
0
--
1.8.3.1

View File

@ -0,0 +1,61 @@
From dc2613b0af11a8cf97232d55c322d40eda35c224 Mon Sep 17 00:00:00 2001
From: "Arnold D. Robbins" <arnold@skeeve.com>
Date: Thu, 18 Nov 2021 21:04:25 +0200
Subject: [PATCH] Restore removed test in test/iolint.awk.
---
test/iolint.awk | 19 ++++++++++++-------
test/iolint.ok | 5 ++++-
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/test/iolint.awk b/test/iolint.awk
index 58fd746..042f743 100644
--- a/test/iolint.awk
+++ b/test/iolint.awk
@@ -55,15 +55,20 @@ BEGIN {
print close("cat")
fflush()
- # 11/2021: Disable this test since it's a race condition
- # and fails intermittently on some systems.
+ # 11/2021: Use a nice trick to avoid race conditions in
+ # child processes. Thanks to Miguel Pineiro Jr. <mpj@pineiro.cc>.
#
# `%.*s' used for input pipe and output pipe
- # "echo hello" | getline junk
- # print "hello" | "echo hello"
- # print close("echo hello")
- # print close("echo hello")
- # fflush()
+ pipecmd = "eval $CMD_TO_RUN"
+
+ ENVIRON["CMD_TO_RUN"] = "echo hello"
+ pipecmd | getline junk
+ ENVIRON["CMD_TO_RUN"] = "read junk"
+ print "hello" | pipecmd
+
+ print close(pipecmd)
+ print close(pipecmd)
+ fflush()
# `%.*s' used for output file and output pipe"
BINMODE = 2
diff --git a/test/iolint.ok b/test/iolint.ok
index 620a70f..7a165aa 100644
--- a/test/iolint.ok
+++ b/test/iolint.ok
@@ -23,7 +23,10 @@ gawk: iolint.awk:53: warning: `cat' used for output file and output pipe
0
hello
0
-gawk: iolint.awk:71: warning: `cksum' used for output file and output pipe
+gawk: iolint.awk:67: warning: `eval $CMD_TO_RUN' used for input pipe and output pipe
+0
+0
+gawk: iolint.awk:76: warning: `cksum' used for output file and output pipe
3015617425 6
0
0
--
1.8.3.1

View File

@ -4,12 +4,16 @@
egrep -i "gawk_api_minor.*[0-9]+" | egrep -o "[0-9]")
Name: gawk
Version: 5.1.1
Release: 1
Release: 2
License: GPLv3+ and GPLv2+ and LGPLv2+ and BSD
Summary: The GNU version of the AWK text processing utility
URL: https://www.gnu.org/software/gawk/
Source0: https://ftp.gnu.org/gnu/gawk/gawk-%{version}.tar.xz
Patch1: Disable-racy-test-in-test-iolint.awk.patch
Patch2: Restore-removed-test-in-test-iolint.awk.patch
Patch3: Reorder-statements-in-iolint-to-try-to-eliminate-a-r.patch
BuildRequires: gcc automake grep
BuildRequires: bison texinfo texinfo-tex ghostscript texlive-ec texlive-cm-super glibc-all-langpacks
BuildRequires: libsigsegv-devel mpfr-devel readline-devel
@ -103,6 +107,12 @@ install -m 0644 -p doc/gawkinet.{pdf,ps} ${RPM_BUILD_ROOT}%{_docdir}/%{name}
%{_datadir}/locale/*
%changelog
* Sat Apr 2 2022 zoulin <zoulin13@h-partners.com> - 5.1.1-2
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:fix test case probabilistic fail
* Tue Feb 8 2022 yixiangzhike <yixiangzhike007@163.com> - 5.1.1-1
- Type:enhancement
- ID:NA