1 Star 0 Fork 23

konglidong/gawk

forked from src-openEuler/gawk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Restore-removed-test-in-test-iolint.awk.patch 1.69 KB
一键复制 编辑 原始数据 按行查看 历史
邹林 提交于 2022-04-02 15:42 +08:00 . fix test case probabilistic fail
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/konglidong/gawk.git
git@gitee.com:konglidong/gawk.git
konglidong
gawk
gawk
master

搜索帮助