Repository: mesonbuild/meson

Issue:
Test suite fails to pass on ppc64le
Reference: https://github.com/mesonbuild/meson/commit/001cf52c3a10aa4d2b0db5ec008fb5d2160ce23e

This causes the test to ERR on a ppc64le - which seems to be intended; but the MESON_SKIP_TEST statement seems not to be interpreted even and the test is simply marked as ERROR

> [   70s] test_always_prefer_c_compiler_for_asm (__main__.AllPlatformTests) ... ERROR

further logs available

```
[  109s] ERROR: test_always_prefer_c_compiler_for_asm (__main__.AllPlatformTests)
[  109s] ----------------------------------------------------------------------
[  109s] Traceback (most recent call last):
[  109s]   File "run_unittests.py", line 948, in test_always_prefer_c_compiler_for_asm
[  109s]     self.init(testdir)
[  109s]   File "run_unittests.py", line 403, in init
[  109s]     self._run(self.meson_command + args + extra_args)
[  109s]   File "run_unittests.py", line 389, in _run
[  109s]     raise subprocess.CalledProcessError(p.returncode, command)
[  109s] subprocess.CalledProcessError: Command '['/usr/bin/python3', '/home/abuild/rpmbuild/BUILD/meson-0.40.1/meson.py', '--backend=ninja', '/home/abuild/rpmbuild/BUILD/meson-0.40.1/test cases/common/141 c cpp and asm', '/tmp/tmpktab6nul', '--prefix', '/usr', '--libdir', '/usr/lib']' returned non-zero exit status 1.
[  109s] 
[  109s] Stdout:
[  109s] WARNING: You are using 'ANSI_X3.4-1968' which is not a a Unicode-compatible locale.
[  109s] WARNING: You might see errors if you use UTF-8 strings as filenames, as strings, or as file contents.
[  109s] WARNING: Please switch to a UTF-8 locale for your platform.
[  109s] The Meson build system
[  109s] Version: 0.40.1
[  109s] Source dir: /home/abuild/rpmbuild/BUILD/meson-0.40.1/test cases/common/141 c cpp and asm
[  109s] Build dir: /tmp/tmpktab6nul
[  109s] Build type: native build
[  109s] Project name: c cpp and asm
[  109s] Native c compiler: cc (gcc 6.3.1)
[  109s] Native cpp compiler: c++ (gcc 6.3.1)
[  109s] Build machine cpu family: ppc64le
[  109s] Build machine cpu: ppc64le
[  109s] 
[  109s] Meson encountered an error in file meson.build, line 9, column 2:
[  109s] Error encountered: MESON_SKIP_TEST unsupported cpu:ppc64le
[  109s] 
[  109s] Build started at 2017-05-16T13:07:19.940230
[  109s] Python binary: /usr/bin/python3
[  109s] Python system: Linux
[  109s] The Meson build system
[  109s] Version: 0.40.1
[  109s] Source dir: /home/abuild/rpmbuild/BUILD/meson-0.40.1/test cases/common/141 c cpp and asm
[  109s] Build dir: /tmp/tmpktab6nul
[  109s] Build type: native build
[  109s] Project name: c cpp and asm
[  109s] Sanity testing c compiler: cc
[  109s] Is cross compiler: False.
[  109s] Sanity check compiler command line: cc /tmp/tmpktab6nul/meson-private/sanitycheckc.c -o /tmp/tmpktab6nul/meson-private/sanitycheckc.exe
[  109s] Sanity check compile stdout:
[  109s] 
[  109s] -----
[  109s] Sanity check compile stderr:
[  109s] 
[  109s] -----
[  109s] Running test binary command: /tmp/tmpktab6nul/meson-private/sanitycheckc.exe
[  109s] Native c compiler: cc (gcc 6.3.1)
[  109s] Sanity testing cpp compiler: c++
[  109s] Is cross compiler: False.
[  109s] Sanity check compiler command line: c++ /tmp/tmpktab6nul/meson-private/sanitycheckcpp.cc -o /tmp/tmpktab6nul/meson-private/sanitycheckcpp.exe
[  109s] Sanity check compile stdout:
[  109s] 
[  109s] -----
[  109s] Sanity check compile stderr:
[  109s] 
[  109s] -----
[  109s] Running test binary command: /tmp/tmpktab6nul/meson-private/sanitycheckcpp.exe
[  109s] Native cpp compiler: c++ (gcc 6.3.1)
[  109s] Build machine cpu family: ppc64le
[  109s] Build machine cpu: ppc64le
[  109s] 
[  109s] Meson encountered an error in file meson.build, line 9, column 2:
[  109s] Error encountered: MESON_SKIP_TEST unsupported cpu:ppc64le
[  109s] 
[  109s] 
[  109s] ----------------------------------------------------------------------
[  109s] Ran 40 tests in 39.965s
[  109s] 
[  109s] FAILED (errors=1, skipped=2)
```


Discussion:
Before going into this issue, if you are also running the test suite on ARM and it passes, could you please post your platform information (especially compiler version) in #1776?

As for the actual bug, that makes no sense. The log says that other tests were skipped which means that they printed `MESON_SKIP_TEST` and that was detected correctly.

Is it possible for you to print out the full contents of result.stdout variable in `run_project_tests.py`? Search for `MESON_SKIP_TEST` (there is only one match) and add the print above that line.
Let me enable aarch64 building of meson - just to get you the answer for #1776 

As for the log: sure - I'll have to patch the sources a bit in the build system, but that's ok-ish; will follow up tomorrow with more info
aarch64 failes the exact same way as this bug report for me:

> [  636s] test_always_prefer_c_compiler_for_asm (__main__.AllPlatformTests) ... ERROR
By arm I meant 32 bit arm. x86, x86_64 and arm32 are the only ones for which we provide an asm implementation. All other CPUs should behave identically to ppc64le (as aarch64 does here).

Resolving patch:
diff --git a/run_unittests.py b/run_unittests.py
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -381,6 +381,8 @@ def _run(self, command, workdir=None):
         output = p.communicate()[0]
         print(output)
         if p.returncode != 0:
+            if 'MESON_SKIP_TEST' in output:
+                raise unittest.SkipTest('Project requested skipping.')
             raise subprocess.CalledProcessError(p.returncode, command)
         return output
 
@@ -396,6 +398,8 @@ def init(self, srcdir, extra_args=None, default_args=True):
                      '--libdir', self.libdir]
         try:
             self._run(self.meson_command + args + extra_args)
+        except unittest.SkipTest:
+            raise unittest.SkipTest('Project requested skipping: ' + srcdir)
         except:
             self._print_meson_log()
             raise


Test patch: