From 2f07f9d619ac86fd35b01f0d630801c885272a92 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 dfcf383bc62de13408520995c519d5ff656b4a1f 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 d64547d8819..a4de7ba0cd3 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 5fa007927b357ead5811833ae34f37b50b2bf9f2 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 a4de7ba0cd3..f00bdd4ce52 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 c4d7992dd9a42fee61fa6147c7c527a7be716d67 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 f00bdd4ce52..c9be0796d0b 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 ad719467e977e8b93733dabdfd6a143e5ad343ed 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 32608f63fcbff5cd536f3ce635be71c4ef11b706 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 0899f1d48c8..f7207018058 100644 --- a/test/t/conftest.py +++ b/test/t/conftest.py @@ -783,7 +783,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: """ @@ -798,7 +798,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 a9cc016f6da798078dbfde3e90a026a3fe66ba59 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 f7207018058..df62285221b 100644 --- a/test/t/conftest.py +++ b/test/t/conftest.py @@ -783,7 +783,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 ae18597ba8cca4dc8e486120685ca82af97c9a69 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 3c3c1442b509096156466073d6604145cea00e6b 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 df62285221b..655a1528c70 100644 --- a/test/t/conftest.py +++ b/test/t/conftest.py @@ -783,9 +783,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: """ @@ -800,7 +798,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 00e6f86ddac7b913ae39c42eaa2c5267424ca710 Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Thu, 28 May 2026 22:57:08 +0300 Subject: [PATCH 10/11] ci(macos): test python sorting --- test/macos-script.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/macos-script.sh b/test/macos-script.sh index d40142f66b4..69566017053 100755 --- a/test/macos-script.sh +++ b/test/macos-script.sh @@ -16,6 +16,8 @@ python3 -m pip install -r test/requirements.txt export bashcomp_bash=bash env +python3 -c "print(sorted(['python3', 'python-3']))" + autoreconf -i ./configure make -j From 5e7546b3b172f39bc59c1cbcf021d0209baacd3c 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 c9be0796d0b..ead192aeaa6 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: