aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorRoss Burton <ross@burtonini.com>2018-06-20 13:45:44 +0100
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-06-20 12:45:44 +0000
commitecde1789b2152b3e987b41afc390ffa031a390ec (patch)
tree73c7af92d6e8994499ef20540695ba36f98f6297 /run_unittests.py
parent9fdf4d83e66f27715b1f0e3b7f86ad8c5c997024 (diff)
downloadmeson-ecde1789b2152b3e987b41afc390ffa031a390ec.zip
meson-ecde1789b2152b3e987b41afc390ffa031a390ec.tar.gz
meson-ecde1789b2152b3e987b41afc390ffa031a390ec.tar.bz2
Validate cpu_family (#3753)
* environment: validate cpu_family in cross file * run_unittests: add unittest to ensure CPU family list in docs and environment matches * run_unittests: skip compiler options test if not in a git repository * environment: validate the detected cpu_family * docs: add 32-bit PowerPC and 32/64-bit MIPS to CPU Families table Names gathered by booting Linux in Qemu and running: $ python3 import platform; platform.machine() Partial fix for #3751
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 582d6f5..4cfb743 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -2206,6 +2206,7 @@ recommended as it is not supported on some platforms''')
# they used to fail this test with Meson 0.46 an earlier versions.
pass
+ @unittest.skipIf(not os.path.isdir('docs'), 'Doc dir not found, presumably because this is a tarball release.')
def test_compiler_options_documented(self):
'''
Test that C and C++ compiler options and base options are documented in
@@ -2227,6 +2228,24 @@ recommended as it is not supported on some platforms''')
self.assertIn(opt, md)
self.assertNotIn('b_unknown', md)
+ @unittest.skipIf(not os.path.isdir('docs'), 'Doc dir not found, presumably because this is a tarball release.')
+ def test_cpu_families_documented(self):
+ with open("docs/markdown/Reference-tables.md") as f:
+ md = f.read()
+ self.assertIsNotNone(md)
+
+ sections = list(re.finditer(r"^## (.+)$", md, re.MULTILINE))
+ for s1, s2 in zip(sections[::2], sections[1::2]):
+ if s1.group(1) == "CPU families":
+ # Extract the content for this section
+ content = md[s1.end():s2.start()]
+ # Find the list entries
+ arches = [m.group(1) for m in re.finditer(r"^\| (\w+) +\|", content, re.MULTILINE)]
+ # Drop the header
+ arches = set(arches[1:])
+ self.assertEqual(arches, set(mesonbuild.environment.known_cpu_families))
+
+
class FailureTests(BasePlatformTests):
'''
Tests that test failure conditions. Build files here should be dynamically