From a2d2de0674c7b91d4268fd83459d9d2fa7cafef2 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@meta.com>
Date: Sun, 17 May 2026 22:07:31 -0700
Subject: [PATCH] tests: port pipe-output and zgrep-signal to Cygwin

* tests/zgrep-signal: Use skip_, not framework_failure_,
when SIGPIPE is not delivered, since that is a platform
limitation, not a test infrastructure problem.
* tests/pipe-output: Skip the no-trap iteration on Cygwin,
where SIGPIPE delivery is unreliable.
* tests/Makefile.am (TESTS_ENVIRONMENT): Add host_os.
Problem reported by Bruno Haible in
https://lists.gnu.org/r/bug-gzip/2026-05/msg00001.html
---
 tests/Makefile.am  | 1 +
 tests/pipe-output  | 3 +++
 tests/zgrep-signal | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0e94b48..b5a19b6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -116,6 +116,7 @@ TESTS_ENVIRONMENT =					\
   MAKE=$(MAKE)						\
   PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)'		\
   PACKAGE_VERSION=$(PACKAGE_VERSION)			\
+  host_os='$(host_os)'					\
   PERL='$(PERL)'					\
   SHELL='$(SHELL)'					\
   PATH='$(abs_top_builddir)$(PATH_SEPARATOR)'"$$PATH"	\
diff --git a/tests/pipe-output b/tests/pipe-output
index 7b1241c..3ac02ef 100755
--- a/tests/pipe-output
+++ b/tests/pipe-output
@@ -44,6 +44,9 @@ get_underlying_status() {

 # Check that gzip etc. behave like cat etc. if the output is a broken pipe.
 for trap_pipe in trap :; do
+  case $trap_pipe:$host_os in
+    ':':cygwin*) continue;;
+  esac
   get_underlying_status 'cat <a.gz' 1
   cat_status=$underlying_status

diff --git a/tests/zgrep-signal b/tests/zgrep-signal
index 0399ba0..b44a4fc 100755
--- a/tests/zgrep-signal
+++ b/tests/zgrep-signal
@@ -54,7 +54,7 @@ write_to_dangling_pipe () {
 write_to_dangling_pipe cat f.gz f.gz
 signal_status=$?
 test 128 -lt $signal_status ||
-  framework_failure_ 'signal handling busted on this host'
+  skip_ 'signal handling busted on this host'

 fail=0

-- 
2.54.0.128.g68aca6b912

