cython: add unittest to verify that depfiles work

pull/11369/head
Eli Schwartz 2 years ago
parent 84dd78e80d
commit 94a190baa2
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 5
      test cases/cython/2 generated sources/meson.build
  2. 1
      test cases/cython/2 generated sources/simpleinclude.pyx
  3. 2
      test cases/cython/2 generated sources/simplestuff.pxi
  4. 21
      unittests/allplatformstests.py

@ -90,6 +90,11 @@ includestuff_ext = py3.extension_module(
dependencies: stuff_pxi_dep
)
simpleinclude_ext = py3.extension_module(
'simpleinclude',
'simpleinclude.pyx',
)
subdir('libdir')
test(

@ -0,0 +1,2 @@
def func2():
print("Hello world")

@ -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')

Loading…
Cancel
Save