diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-02-09 00:18:18 -0500 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2023-02-19 02:55:58 +0530 |
commit | 530a07c545a931c1df37e6981b9ee8fd24965065 (patch) | |
tree | b644da365a5a7e19bbe39abfd7581075eeed168f | |
parent | 355440287df12d014dfbab69db498ef1277b882c (diff) | |
download | meson-530a07c545a931c1df37e6981b9ee8fd24965065.zip meson-530a07c545a931c1df37e6981b9ee8fd24965065.tar.gz meson-530a07c545a931c1df37e6981b9ee8fd24965065.tar.bz2 |
cython: add unittest to verify that depfiles work
-rw-r--r-- | test cases/cython/2 generated sources/meson.build | 5 | ||||
-rw-r--r-- | test cases/cython/2 generated sources/simpleinclude.pyx | 1 | ||||
-rw-r--r-- | test cases/cython/2 generated sources/simplestuff.pxi | 2 | ||||
-rw-r--r-- | unittests/allplatformstests.py | 21 |
4 files changed, 29 insertions, 0 deletions
diff --git a/test cases/cython/2 generated sources/meson.build b/test cases/cython/2 generated sources/meson.build index cffddd3..498e319 100644 --- a/test cases/cython/2 generated sources/meson.build +++ b/test cases/cython/2 generated sources/meson.build @@ -90,6 +90,11 @@ includestuff_ext = py3.extension_module( dependencies: stuff_pxi_dep ) +simpleinclude_ext = py3.extension_module( + 'simpleinclude', + 'simpleinclude.pyx', +) + subdir('libdir') test( diff --git a/test cases/cython/2 generated sources/simpleinclude.pyx b/test cases/cython/2 generated sources/simpleinclude.pyx new file mode 100644 index 0000000..c110f75 --- /dev/null +++ b/test cases/cython/2 generated sources/simpleinclude.pyx @@ -0,0 +1 @@ +include "simplestuff.pxi" diff --git a/test cases/cython/2 generated sources/simplestuff.pxi b/test cases/cython/2 generated sources/simplestuff.pxi new file mode 100644 index 0000000..2645216 --- /dev/null +++ b/test cases/cython/2 generated sources/simplestuff.pxi @@ -0,0 +1,2 @@ +def func2(): + print("Hello world") diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index 351f79d..d8c74e6 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -859,6 +859,27 @@ class AllPlatformTests(BasePlatformTests): name = "/".join(name) # Glue list into a string self.build(target=name) + def test_build_pyx_depfiles(self): + # building regularly and then touching a depfile dependency should rebuild + testdir = os.path.join("test cases/cython", '2 generated sources') + env = get_fake_env(testdir, self.builddir, self.prefix) + try: + cython = detect_compiler_for(env, "cython", MachineChoice.HOST) + if not version_compare(cython.version, '>=0.29.33'): + raise SkipTest('Cython is too old') + except EnvironmentException: + raise SkipTest("Cython is not installed") + self.init(testdir) + + targets = self.introspect('--targets') + for target in targets: + if target['name'].startswith('simpleinclude'): + name = target['name'] + self.build() + self.utime(os.path.join(testdir, 'simplestuff.pxi')) + self.assertBuildRelinkedOnlyTarget(name) + + def test_internal_include_order(self): if mesonbuild.environment.detect_msys2_arch() and ('MESON_RSP_THRESHOLD' in os.environ): raise SkipTest('Test does not yet support gcc rsp files on msys2') |