bash-completion
bash-completion copied to clipboard
GCC tests fail on non-x86 platforms
Describe the bug
The test_march_native and test_mtune_generic tests fail when run on my 64-bit PowerPC workstation.
To reproduce
- Have a computer running an ISA that doesn't use
-marchin GCC (or supportgenericfor-mtune). - Run the test suite (
make check).
Expected behavior
Passing tests.
Versions (please complete the following information)
- [x] Operating system name/distribution and version: Adélie Linux 1.0-beta5
- [x] bash version,
echo "$BASH_VERSION": 5.1.16(1)-release - [ ] bash-completion version,
(IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}"): affects git HEAD, but testing with 2.13.0.
Additional context
GCC doesn't use -march for every ISA, and -mtune=generic isn't available on every arch either.
Debug trace
============================================================ FAILURES ============================================================
___________________________________________________ TestGcc.test_march_native ____________________________________________________
self = <test_gcc.TestGcc object at 0x3fff89b2a7d0>, completion = <CompletionResult []>, gcc_with_completion = None
@pytest.mark.complete("gcc -march=")
def test_march_native(self, completion, gcc_with_completion):
> assert "native" in completion
E AssertionError: assert 'native' in <CompletionResult []>
/home/awilcox/Code/awilfox/gcc-next/user/bash-completion/src/bash-completion-2.11/test/t/test_gcc.py:60: AssertionError
___________________________________________________ TestGcc.test_mtune_generic ___________________________________________________
self = <test_gcc.TestGcc object at 0x3fff89b0ea90>
completion = <CompletionResult ['401', '403', '405', '405fp', '440', '440fp', '464', '464fp', '476', '476fp', '505', '601', '602', ... 'power5+', 'power6', 'power6x', 'power7', 'power8', 'power9', 'powerpc', 'powerpc64', 'powerpc64le', 'rs64', 'titan']>
gcc_with_completion = None
@pytest.mark.complete("gcc -mtune=")
def test_mtune_generic(self, completion, gcc_with_completion):
> assert "generic" in completion
E AssertionError: assert 'generic' in <CompletionResult ['401', '403', '405', '405fp', '440', '440fp', '464', '464fp', '476', '476fp', '505', '601', '602', ... 'power5+', 'power6', 'power6x', 'power7', 'power8', 'power9', 'powerpc', 'powerpc64', 'powerpc64le', 'rs64', 'titan']>
/home/awilcox/Code/awilfox/gcc-next/user/bash-completion/src/bash-completion-2.11/test/t/test_gcc.py:64: AssertionError
==================================================== short test summary info =====================================================
FAILED test_gcc.py::TestGcc::test_march_native - AssertionError: assert 'native' in <CompletionResult []>
FAILED test_gcc.py::TestGcc::test_mtune_generic - AssertionError: assert 'generic' in <CompletionResult ['401', '403', '405', '...
========================= 2 failed, 1210 passed, 327 skipped, 19 xfailed, 4 xpassed in 789.83s (0:13:09) =========================
I've worked around it in our packaging by extending those two tests with the gcc_x86 fixture, and I would be happy to submit that change as an MR if it is palatable. Technically, -march=native would work on at least aarch64 as well.
Thanks for the report! I would rather add some arch specific expectations than exclude those tests altogether on non-x86. For -mtune, perhaps even do something like this
--- a/test/t/test_gcc.py
+++ b/test/t/test_gcc.py
@@ -60,5 +60,8 @@ class TestGcc:
assert "native" in completion
@pytest.mark.complete("gcc -mtune=")
- def test_mtune_generic(self, completion, gcc_with_completion):
- assert "generic" in completion
+ def test_mtune(self, completion, gcc_with_completion):
+ # generic: x86, some others
+ # power*: ppc
+ assert "generic" in completion or \
+ any(x.startswith("power") for x in completion)
(Aside, when we sometime get the macOS tests to usable state in GitHub CI, we could get a bit of coverage on these.)