From 673ad108623b3bfaa0b1e5a822d576523a5bbe6c Mon Sep 17 00:00:00 2001 From: zou_lin77 <422351577@qq.com> Date: Fri, 1 Apr 2022 17:25:25 +0800 Subject: [PATCH] fix test case probabilistic fail --- Disable-racy-test-in-test-iolint.awk.patch | 55 +++++++++++++++++ ...ts-in-iolint-to-try-to-eliminate-a-r.patch | 43 +++++++++++++ Restore-removed-test-in-test-iolint.awk.patch | 61 +++++++++++++++++++ gawk.spec | 12 +++- 4 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 Disable-racy-test-in-test-iolint.awk.patch create mode 100644 Reorder-statements-in-iolint-to-try-to-eliminate-a-r.patch create mode 100644 Restore-removed-test-in-test-iolint.awk.patch diff --git a/Disable-racy-test-in-test-iolint.awk.patch b/Disable-racy-test-in-test-iolint.awk.patch new file mode 100644 index 0000000..357c6a8 --- /dev/null +++ b/Disable-racy-test-in-test-iolint.awk.patch @@ -0,0 +1,55 @@ +From 0ed67a4f4f043acc08e3982a2648e3082e1f245a Mon Sep 17 00:00:00 2001 +From: "Arnold D. Robbins" +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 + diff --git a/Reorder-statements-in-iolint-to-try-to-eliminate-a-r.patch b/Reorder-statements-in-iolint-to-try-to-eliminate-a-r.patch new file mode 100644 index 0000000..d3a8ea3 --- /dev/null +++ b/Reorder-statements-in-iolint-to-try-to-eliminate-a-r.patch @@ -0,0 +1,43 @@ +From e03c8822c48bedfe6cc7fbd5a9382d9630de6494 Mon Sep 17 00:00:00 2001 +From: "Andrew J. Schorr" +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 + diff --git a/Restore-removed-test-in-test-iolint.awk.patch b/Restore-removed-test-in-test-iolint.awk.patch new file mode 100644 index 0000000..8dbd69d --- /dev/null +++ b/Restore-removed-test-in-test-iolint.awk.patch @@ -0,0 +1,61 @@ +From dc2613b0af11a8cf97232d55c322d40eda35c224 Mon Sep 17 00:00:00 2001 +From: "Arnold D. Robbins" +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. . + # + # `%.*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 + diff --git a/gawk.spec b/gawk.spec index 863e043..3393402 100644 --- a/gawk.spec +++ b/gawk.spec @@ -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: git 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 +* Fri Apr 1 2022 zoulin - 5.1.1-2 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:fix test case probabilistic fail + * Sat Dec 11 2021 wangjie - 5.1.1-1 - Type:enhancement - ID:NA -- Gitee