Skip to content

Commit d3d8c60

Browse files
pks-tgitster
authored andcommitted
t7815: fix unexpectedly passing test on macOS
In t7815, we have the following test: test_expect_failure !CYGWIN 'git grep .fi a' ' git grep .fi a ' The test passes if '.' matches a NUL byte, which we expect to only happen on Cygwin. The upcoming changes to support parsing TAP output in Meson surface that this test, surprisingly, passes on macOS as well. It is unclear how long the test has been passing on macOS already. 064eed3 (config.mak.uname: only set NO_REGEX on cygwin for v1.7, 2025-04-17) mentions that the test started to pass for Cygwin. This was attributed to a new implementation of regcomp(3p) and friends, which was inherited from FreeBSD. Given the BSD lineage of macOS it is feasible that it also inherited similar code eventually that made the test pass now. It is somewhat dubious what the test actually brings to the table given that it is quite platform specific. Ideally, we would fix this mess by having a configure-time check whether regcomp(3p) works as expected, including NUL bytes, and use our bundled version of the regex library in case it doesn't. Like this, we could ensure that all platforms work the same in this edge case and mark the new behaviour as expected. This change is outside of the scope of this patch series, which only introduces support for TAP. So instead of fixing the bigger issue, ignore the test on Darwin like we already do for Cygwin. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d4ea24b commit d3d8c60

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

t/t7815-grep-binary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ test_expect_success 'git grep ile a' '
6363
git grep ile a
6464
'
6565

66-
test_expect_failure !CYGWIN 'git grep .fi a' '
66+
test_expect_failure !CYGWIN,!MACOS 'git grep .fi a' '
6767
git grep .fi a
6868
'
6969

t/test-lib.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,6 +1636,9 @@ fi
16361636
# Fix some commands on Windows, and other OS-specific things
16371637
uname_s=$(uname -s)
16381638
case $uname_s in
1639+
Darwin)
1640+
test_set_prereq MACOS
1641+
;;
16391642
*MINGW*)
16401643
# Windows has its own (incompatible) sort and find
16411644
sort () {

0 commit comments

Comments
 (0)