tests: make the grep pattern in remotefilelog-gcrepack portable (
issue6122)
test-remotefilelog-gcrepack was using "\" to escape "|" in the grep pattern.
The most of implementations ignore "\" when it is followed by "|", so the regex
works. However, OpenBSD doesn't ignore "\" and considers "|" part of the text
instead of create two branches. Neither of both behaviors violate POSIX.
This change removes the unnecessary escape character and changes grep to egrep,
so the extended regular expression works on every unix.
This is part of the bug 6122. Tested on OpenBSD, GNU, FreeBSD, NetBSD, Solaris
11 and BusyBox.
Credits to Todd C. Miller, Paul de Weerd and Ingo Schwarze for helping me with
it.
--- a/tests/test-remotefilelog-gcrepack.t Mon May 20 16:12:27 2019 -0700
+++ b/tests/test-remotefilelog-gcrepack.t Tue May 21 19:23:14 2019 +0200
@@ -43,7 +43,7 @@
$ sleep 0.5
$ hg debugwaitonrepack >/dev/null 2>%1
- $ find $CACHEDIR | sort | grep ".datapack\|.histpack"
+ $ find $CACHEDIR | sort | egrep ".datapack|.histpack"
$TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack
$TESTTMP/hgcache/master/packs/dc8f8fdc76690ce27791ce9f53a18da379e50d37.datapack
@@ -76,7 +76,7 @@
$ sleep 0.5
$ hg debugwaitonrepack >/dev/null 2>%1
- $ find $CACHEDIR | sort | grep ".datapack\|.histpack"
+ $ find $CACHEDIR | sort | egrep ".datapack|.histpack"
$TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack
$TESTTMP/hgcache/master/packs/a4e1d094ec2aee8a08a4d6d95a13c634cc7d7394.datapack
@@ -104,7 +104,7 @@
$ sleep 0.5
$ hg debugwaitonrepack >/dev/null 2>%1
- $ find $CACHEDIR | sort | grep ".datapack\|.histpack"
+ $ find $CACHEDIR | sort | egrep ".datapack|.histpack"
$TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack
$TESTTMP/hgcache/master/packs/dc8f8fdc76690ce27791ce9f53a18da379e50d37.datapack
@@ -138,7 +138,7 @@
$ sleep 0.5
$ hg debugwaitonrepack >/dev/null 2>%1
- $ find $CACHEDIR | sort | grep ".datapack\|.histpack"
+ $ find $CACHEDIR | sort | egrep ".datapack|.histpack"
$TESTTMP/hgcache/master/packs/7bcd2d90b99395ca43172a0dd24e18860b2902f9.histpack
$TESTTMP/hgcache/master/packs/dc8f8fdc76690ce27791ce9f53a18da379e50d37.datapack