diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index dbd834c0726..a3ac8b686a5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -107,3 +107,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/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 dbd139df7ca..59f27d68dd7 100644 --- a/test/t/conftest.py +++ b/test/t/conftest.py @@ -776,7 +776,7 @@ 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 [x.strip() for x in self.output.strip().splitlines() if x] def __eq__(self, expected: object) -> bool: """ 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..e2a70d85910 100644 --- a/test/t/unit/test_unit_dequote.py +++ b/test/t/unit/test_unit_dequote.py @@ -37,6 +37,8 @@ def test_5_brace(self, bash, functions): assert output.strip() == "" def test_6_glob(self, bash, functions): + LC_out = assert_bash_exec(bash, "env | grep LC_", want_output=True) + print(f"LC_ vars:\n\n{LC_out}\n") output = assert_bash_exec(bash, "__tester 'a?b'", want_output=True) assert output.strip() == "" diff --git a/test/t/unit/test_unit_load.py b/test/t/unit/test_unit_load.py index 5fcfda2dfe6..53ab798570f 100644 --- a/test/t/unit/test_unit_load.py +++ b/test/t/unit/test_unit_load.py @@ -1,4 +1,5 @@ import os +import shutil import pytest @@ -24,15 +25,15 @@ def fixture_dir(self, request, bash): set up symbolic links. """ - tmpdir = prepare_fixture_dir(request, files=[], dirs=[]) - assert_bash_exec(bash, "cp -R %s/* %s/" % (os.getcwd(), tmpdir)) - assert_bash_exec(bash, "mkdir -p %s/bin" % tmpdir) - assert_bash_exec( - bash, "ln -sf ../prefix1/bin/cmd1 %s/bin/cmd1" % tmpdir - ) - assert_bash_exec( - bash, "ln -sf ../prefix1/sbin/cmd2 %s/bin/cmd2" % tmpdir - ) + tmpdir = prepare_fixture_dir(request, files=[], dirs=["bin"]) + try: + shutil.copytree(os.getcwd(), str(tmpdir), dirs_exist_ok=True) + except TypeError: # For python <= 3.7 + from distutils import dir_util # type: ignore[import-not-found] + + dir_util.copy_tree(os.getcwd(), str(tmpdir)) + os.symlink("../prefix1/bin/cmd1", f"{tmpdir}/bin/cmd1") + os.symlink("../prefix1/sbin/cmd2", f"{tmpdir}/bin/cmd2") return str(tmpdir) def test_userdir_1(self, bash, fixture_dir):