From e15e105c9b43eb31445761a67ff5143597d6f314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 31 May 2021 23:13:02 +0300 Subject: [PATCH 01/11] test: add macOS test script --- test/macos-script.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 test/macos-script.sh diff --git a/test/macos-script.sh b/test/macos-script.sh new file mode 100755 index 00000000000..d1480312fce --- /dev/null +++ b/test/macos-script.sh @@ -0,0 +1,22 @@ +#!/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 pip install -r test/requirements.txt + +export bashcomp_bash=bash +env + +autoreconf -i +./configure +make -j + +make distcheck \ + PYTESTFLAGS="${PYTESTFLAGS---verbose --numprocesses=auto --dist=loadfile}" +cp -p bash-completion-*.tar.* "$oldpwd/" From 3409046a7052b49e88d84f3d19f2b8a056df209d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 4 Apr 2024 21:46:12 +0000 Subject: [PATCH 02/11] ci(macos): add macOS CI test config --- .github/workflows/ci.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index afa8b05957d..c38d4ea46cb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -80,3 +80,11 @@ jobs: with: path: bash-completion-*.tar.xz if: matrix.dist == 'alpine' + + distcheck-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + persist-credentials: false + - run: env PYTESTFLAGS=--verbose test/macos-script.sh From 8c24520ccf9e04664734a0ea621668353d570081 Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Mon, 24 Feb 2025 22:36:34 +0200 Subject: [PATCH 03/11] ci(macos): Align macos script with current linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also use venv instead of global install brew/python doesn't like installing python packages globally: ``` error: externally-managed-environment × This environment is externally managed ``` --- .github/workflows/ci.yaml | 2 +- test/macos-script.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c38d4ea46cb..46b411cdd1f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -87,4 +87,4 @@ jobs: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - - run: env PYTESTFLAGS=--verbose test/macos-script.sh + - run: env PYTESTFLAGS="--verbose -p no:cacheprovider" test/macos-script.sh diff --git a/test/macos-script.sh b/test/macos-script.sh index d1480312fce..d40142f66b4 100755 --- a/test/macos-script.sh +++ b/test/macos-script.sh @@ -8,6 +8,9 @@ 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 @@ -18,5 +21,4 @@ autoreconf -i make -j make distcheck \ - PYTESTFLAGS="${PYTESTFLAGS---verbose --numprocesses=auto --dist=loadfile}" -cp -p bash-completion-*.tar.* "$oldpwd/" + PYTESTFLAGS="${PYTESTFLAGS---verbose -p no:cacheprovider --numprocesses=auto --dist=loadfile}" From 37da78d8d09d58e899c85fa50613d265a2790fc5 Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Tue, 25 Feb 2025 21:30:50 +0200 Subject: [PATCH 04/11] ci(macos): Force colored output --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 46b411cdd1f..ff34bcb9148 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -87,4 +87,4 @@ jobs: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: persist-credentials: false - - run: env PYTESTFLAGS="--verbose -p no:cacheprovider" test/macos-script.sh + - run: env PYTESTFLAGS="--verbose -p no:cacheprovider --color=yes" test/macos-script.sh From 72b8092b9b08916a41753e70be2ab5f7f392ec48 Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Fri, 4 Jul 2025 17:08:34 +0300 Subject: [PATCH 05/11] test(vipw): Drop exception for macos vipw seems to have -d as an option on macos now. Partially reverts ccf7bf69d "test(dmesg,vipw): expect no options on macOS" --- test/t/test_vipw.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) 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 From e54f997604aec9dcff013f995b1b4701a0d95223 Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Thu, 18 Sep 2025 20:26:36 +0300 Subject: [PATCH 06/11] test: Sort completion results items It seems there is some behaviour differences regarding the order completions are returned in between linux and macos, specifically regarding sorting of upper case and lowercase letters. Sorting them ourselves in the tests makes it consistent. --- test/t/conftest.py | 4 ++-- test/t/unit/test_unit_dequote.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/t/conftest.py b/test/t/conftest.py index 803d57cf69f..bf5a1cde3a7 100644 --- a/test/t/conftest.py +++ b/test/t/conftest.py @@ -784,7 +784,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 sorted([x.strip() for x in self.output.strip().splitlines()]) def __eq__(self, expected: object) -> bool: """ @@ -799,7 +799,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/unit/test_unit_dequote.py b/test/t/unit/test_unit_dequote.py index 392b54266f7..a8a311ec361 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( From d935a7bee0cdbe7c915f5c3e6fd9a88d284a307c Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Sun, 21 Sep 2025 16:10:15 +0300 Subject: [PATCH 07/11] test: Remove empty strings from completion results --- test/t/conftest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/t/conftest.py b/test/t/conftest.py index bf5a1cde3a7..3143f6a048a 100644 --- a/test/t/conftest.py +++ b/test/t/conftest.py @@ -784,7 +784,9 @@ def startswith(self, prefix: str) -> bool: return self.output.startswith(prefix) def _items(self) -> List[str]: - return sorted([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: """ From 65f084299507df972440971e5c203671423b0359 Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Tue, 7 Oct 2025 22:21:04 +0300 Subject: [PATCH 08/11] test(tar): skip test_25 for non-gnu tar --- test/t/test_tar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From 912a9e97efb07ec9d3ad480527bea3c33b87a6d2 Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Sat, 18 Oct 2025 21:43:45 +0300 Subject: [PATCH 09/11] Revert "test: Sort completion results items" This reverts commit 8074741e7a7830a295f0c1ddbfd4115d3a0f7f3d. --- test/t/conftest.py | 6 ++---- test/t/unit/test_unit_dequote.py | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/test/t/conftest.py b/test/t/conftest.py index 3143f6a048a..5fa73820bcf 100644 --- a/test/t/conftest.py +++ b/test/t/conftest.py @@ -784,9 +784,7 @@ def startswith(self, prefix: str) -> bool: return self.output.startswith(prefix) def _items(self) -> List[str]: - return sorted( - [x.strip() for x in self.output.strip().splitlines() if x] - ) + return [x.strip() for x in self.output.strip().splitlines() if x] def __eq__(self, expected: object) -> bool: """ @@ -801,7 +799,7 @@ def __eq__(self, expected: object) -> bool: return False else: expiter = expected - return self._items() == sorted(expiter) + return self._items() == expiter def __contains__(self, item: str) -> bool: return item in self._items() diff --git a/test/t/unit/test_unit_dequote.py b/test/t/unit/test_unit_dequote.py index a8a311ec361..102c3470c80 100644 --- a/test/t/unit/test_unit_dequote.py +++ b/test/t/unit/test_unit_dequote.py @@ -1,5 +1,3 @@ -import re - import pytest from conftest import assert_bash_exec, bash_env_saved @@ -39,9 +37,10 @@ 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) - items = sorted(re.findall(r"<[^>]*>", output)) - assert "".join(items) == "" + assert output.strip() == "" def test_7_quote_1(self, bash, functions): output = assert_bash_exec( From bab4c58e948cdd758284893798f114949a7e9c13 Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Sun, 30 Nov 2025 21:38:10 +0200 Subject: [PATCH 10/11] test sorting with LC_COLLATE --- test/macos-script.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/macos-script.sh b/test/macos-script.sh index d40142f66b4..959d182d8fe 100755 --- a/test/macos-script.sh +++ b/test/macos-script.sh @@ -15,6 +15,11 @@ python3 -m pip install -r test/requirements.txt export bashcomp_bash=bash env +LC_ALL=C sort <<<$'python-dev\npython3-dev' +LC_COLLATE=C sort <<<$'python-dev\npython3-dev' +LC_ALL=en_US.UTF-8 sort <<<$'python-dev\npython3-dev' +LC_COLLATE=en_US.UTF-8 sort <<<$'python-dev\npython3-dev' + autoreconf -i ./configure From 0706ae9090b50a136b8b211cd086e41a782c287d Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Thu, 28 May 2026 22:24:27 +0300 Subject: [PATCH 11/11] ci(macos): Try macos-26 --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ff34bcb9148..53d8afdb30d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -82,7 +82,7 @@ jobs: if: matrix.dist == 'alpine' distcheck-macos: - runs-on: macos-latest + runs-on: macos-26 steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: