diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2018-05-19 13:39:06 +0100 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-06-03 21:06:23 +0000 |
commit | ac480c185722a7f67711c3f3a8d35f81409ee6a3 (patch) | |
tree | 8b398deb204c30450e59c5d18d0430f0350ed61c | |
parent | 7a15214a69891411df6f55a74851d502ef0b24c5 (diff) | |
download | meson-ac480c185722a7f67711c3f3a8d35f81409ee6a3.zip meson-ac480c185722a7f67711c3f3a8d35f81409ee6a3.tar.gz meson-ac480c185722a7f67711c3f3a8d35f81409ee6a3.tar.bz2 |
Extend test_rc_depends_files test case
Extend test_rc_depends_files test case to also cover depfile generation for
a resource file generated by a custom_target
4 files changed, 23 insertions, 5 deletions
diff --git a/run_unittests.py b/run_unittests.py index 0814b34..25fa263 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -2393,19 +2393,35 @@ class WindowsTests(BasePlatformTests): def test_rc_depends_files(self): testdir = os.path.join(self.platform_test_dir, '5 resources') + + # resource compiler depfile generation is not yet implemented for msvc + env = Environment(testdir, self.builddir, get_fake_options(self.prefix), []) + depfile_works = env.detect_c_compiler(False).get_id() != 'msvc' + self.init(testdir) self.build() # Immediately rebuilding should not do anything self.assertBuildIsNoop() + # Test compile_resources(depend_file:) # Changing mtime of sample.ico should rebuild prog self.utime(os.path.join(testdir, 'res', 'sample.ico')) self.assertRebuiltTarget('prog') + # Test depfile generation by compile_resources # Changing mtime of resource.h should rebuild myres.rc and then prog - # (resource compiler depfile generation is not yet implemented for msvc) - env = Environment(testdir, self.builddir, get_fake_options(self.prefix), []) - if env.detect_c_compiler(False).get_id() != 'msvc': + if depfile_works: self.utime(os.path.join(testdir, 'inc', 'resource', 'resource.h')) self.assertRebuiltTarget('prog') + self.wipe() + + if depfile_works: + testdir = os.path.join(self.platform_test_dir, '13 resources with custom targets') + self.init(testdir) + self.build() + # Immediately rebuilding should not do anything + self.assertBuildIsNoop() + # Changing mtime of resource.h should rebuild myres_1.rc and then prog_1 + self.utime(os.path.join(testdir, 'res', 'resource.h')) + self.assertRebuiltTarget('prog_1') class LinuxlikeTests(BasePlatformTests): diff --git a/test cases/windows/13 resources with custom targets/res/meson.build b/test cases/windows/13 resources with custom targets/res/meson.build index c15bd92..9797637 100644 --- a/test cases/windows/13 resources with custom targets/res/meson.build +++ b/test cases/windows/13 resources with custom targets/res/meson.build @@ -10,9 +10,10 @@ foreach id : [1, 2] output : 'myres_@0@.rc'.format(id), command : [rc_writer, '@INPUT@', '@OUTPUT@', files('sample.ico')], install : false, - build_always : true) + build_always : false) endforeach rc_sources += files('myres_static.rc') -res = win.compile_resources(rc_sources) +res = win.compile_resources(rc_sources, + include_directories: include_directories('.')) diff --git a/test cases/windows/13 resources with custom targets/res/myres.rc.in b/test cases/windows/13 resources with custom targets/res/myres.rc.in index 6899bc8..0cff642 100644 --- a/test cases/windows/13 resources with custom targets/res/myres.rc.in +++ b/test cases/windows/13 resources with custom targets/res/myres.rc.in @@ -1,3 +1,4 @@ #include<windows.h> +#include<resource.h> 1 ICON "{icon}" diff --git a/test cases/windows/13 resources with custom targets/res/resource.h b/test cases/windows/13 resources with custom targets/res/resource.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/windows/13 resources with custom targets/res/resource.h |