diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index a4c359d64be..a807e095cb8 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -102,3 +102,11 @@ jobs:
GH_TOKEN: ${{github.token}}
RELEASE_PLEASE_TAG_NAME: ${{steps.release.outputs.tag_name}}
if: steps.release.outputs.release_created
+
+ distcheck-macos:
+ runs-on: macos-latest
+ steps:
+ - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
+ with:
+ persist-credentials: false
+ - run: env PYTESTFLAGS="--verbose -p no:cacheprovider --color=yes" test/macos-script.sh
diff --git a/completions/rsync b/completions/rsync
index 60ba4e0967a..1f38bb1990f 100644
--- a/completions/rsync
+++ b/completions/rsync
@@ -85,11 +85,15 @@ _comp_cmd_rsync()
# meaning before v3.2.0) contain the following unusual line in
# --help:
# "(-h) --help show this help (-h is --help only if used alone)"
- _comp_compgen -Rv tmp help - <<<"$("$1" --help 2>&1 | command sed -e 's/^([^)]*)//')"
+ if _comp_compgen -Rv tmp help - <<<"$("$1" --help 2>&1 | command sed -e 's/^([^)]*)//')"; then
- _comp_compgen -- -W '"${tmp[@]}"
- --daemon --old-d{,irs}
- --no-{blocking-io,detach,whole-file,inc-recursive,i-r}' -X '--no-OPTION'
+ _comp_compgen -- -W '"${tmp[@]}"
+ --daemon --old-d{,irs}
+ --no-{blocking-io,detach,whole-file,inc-recursive,i-r}' -X '--no-OPTION'
+ # We didn't find any options using _comp_compgen_help, try _usage for BSD style usage
+ else
+ _comp_compgen_usage
+ fi
[[ ${COMPREPLY-} == *= ]] || compopt +o nospace
;;
*:*)
diff --git a/test/macos-script.sh b/test/macos-script.sh
new file mode 100755
index 00000000000..d40142f66b4
--- /dev/null
+++ b/test/macos-script.sh
@@ -0,0 +1,24 @@
+#!/bin/sh -eux
+
+# Note that this script is intended to be run only in throwaway environments;
+# it may install undesirable things to system locations (if it succeeds in
+# that).
+
+brew install \
+ automake \
+ bash
+
+python3 -m venv venv
+#shellcheck disable=SC1091
+source venv/bin/activate
+python3 -m pip install -r test/requirements.txt
+
+export bashcomp_bash=bash
+env
+
+autoreconf -i
+./configure
+make -j
+
+make distcheck \
+ PYTESTFLAGS="${PYTESTFLAGS---verbose -p no:cacheprovider --numprocesses=auto --dist=loadfile}"
diff --git a/test/t/conftest.py b/test/t/conftest.py
index 03bde2d6b9c..f57d13a28f2 100644
--- a/test/t/conftest.py
+++ b/test/t/conftest.py
@@ -776,7 +776,9 @@ def startswith(self, prefix: str) -> bool:
return self.output.startswith(prefix)
def _items(self) -> List[str]:
- return [x.strip() for x in self.output.strip().splitlines()]
+ return sorted(
+ [x.strip() for x in self.output.strip().splitlines() if x]
+ )
def __eq__(self, expected: object) -> bool:
"""
@@ -791,7 +793,7 @@ def __eq__(self, expected: object) -> bool:
return False
else:
expiter = expected
- return self._items() == expiter
+ return self._items() == sorted(expiter)
def __contains__(self, item: str) -> bool:
return item in self._items()
diff --git a/test/t/test_rsync.py b/test/t/test_rsync.py
index e440c6ee81c..3ae6ba23e5a 100644
--- a/test/t/test_rsync.py
+++ b/test/t/test_rsync.py
@@ -19,7 +19,8 @@ def test_3(self, completion):
@pytest.mark.complete("rsync --", require_cmd=True)
def test_4(self, completion):
- assert "--help" in completion
+ assert "--compress" in completion
+ assert "--timeout=" in completion
@pytest.mark.parametrize(
"ver1,ver2,result",
diff --git a/test/t/test_tar.py b/test/t/test_tar.py
index 73db7c30905..8d03da296f0 100644
--- a/test/t/test_tar.py
+++ b/test/t/test_tar.py
@@ -129,7 +129,7 @@ def test_24(self, completion):
# Test compression detection of gnu style options
@pytest.mark.complete("tar --extract --xz --file ", cwd="tar")
- def test_25(self, completion):
+ def test_25(self, completion, gnu_tar):
assert completion == "archive.tar.xz dir/ dir2/".split()
# TODO: "tar tf escape.tar a/b"
diff --git a/test/t/test_vipw.py b/test/t/test_vipw.py
index b78fcbda8b0..07b454bff4f 100644
--- a/test/t/test_vipw.py
+++ b/test/t/test_vipw.py
@@ -1,12 +1,7 @@
-import sys
-
import pytest
class TestVipw:
@pytest.mark.complete("vipw -", require_cmd=True)
def test_1(self, completion):
- if sys.platform == "darwin":
- assert not completion # takes no options
- else:
- assert completion
+ assert completion
diff --git a/test/t/unit/test_unit_dequote.py b/test/t/unit/test_unit_dequote.py
index 117a487758d..8b5b3a5ef54 100644
--- a/test/t/unit/test_unit_dequote.py
+++ b/test/t/unit/test_unit_dequote.py
@@ -1,3 +1,5 @@
+import re
+
import pytest
from conftest import assert_bash_exec, bash_env_saved
@@ -38,7 +40,8 @@ def test_5_brace(self, bash, functions):
def test_6_glob(self, bash, functions):
output = assert_bash_exec(bash, "__tester 'a?b'", want_output=True)
- assert output.strip() == ""
+ items = sorted(re.findall(r"<[^>]*>", output))
+ assert "".join(items) == ""
def test_7_quote_1(self, bash, functions):
output = assert_bash_exec(
diff --git a/test/t/unit/test_unit_load.py b/test/t/unit/test_unit_load.py
index 55130414a05..28fa192d2db 100644
--- a/test/t/unit/test_unit_load.py
+++ b/test/t/unit/test_unit_load.py
@@ -1,4 +1,5 @@
import os
+import sys
import pytest
@@ -33,7 +34,11 @@ def fixture_dir(self, request, bash):
assert_bash_exec(
bash, "ln -sf ../prefix1/sbin/cmd2 %s/bin/cmd2" % tmpdir
)
- return str(tmpdir)
+ yield str(tmpdir)
+ if sys.platform == "darwin":
+ assert_bash_exec(bash, "sudo rm -rf %s/*" % tmpdir)
+ else:
+ assert_bash_exec(bash, "rm -rf %s/*" % tmpdir)
def test_userdir_1(self, bash, fixture_dir):
with bash_env_saved(bash) as bash_env: