diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-03-28 15:51:35 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-03-28 15:51:35 +0530 |
commit | 87f35d71184722aede59516f31de50411892599b (patch) | |
tree | 2e4abe317a3073009643366b15cb6c29ba822b7f | |
parent | dc5b0a62f61c2854aa9d7fe454fc861ac6000fb8 (diff) | |
download | meson-87f35d71184722aede59516f31de50411892599b.zip meson-87f35d71184722aede59516f31de50411892599b.tar.gz meson-87f35d71184722aede59516f31de50411892599b.tar.bz2 |
tests/windows/5: Skip if build_to_src has spaces
In this case, the arguments to MinGW windres will contain spaces and
the test will definitely fail, so just skip it.
This effectively means that manually running the test will be fine, but
running it via run_project_tests.py will always fail (skip).
-rw-r--r-- | test cases/windows/5 resources/meson.build | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/test cases/windows/5 resources/meson.build b/test cases/windows/5 resources/meson.build index 30bfbbf..e92a43c 100644 --- a/test cases/windows/5 resources/meson.build +++ b/test cases/windows/5 resources/meson.build @@ -1,5 +1,64 @@ project('winmain', 'c') +# MinGW windres has a bug due to which it doesn't parse args with space properly: +# https://github.com/mesonbuild/meson/pull/1346 +# https://sourceware.org/bugzilla/show_bug.cgi?id=4933 +if meson.get_compiler('c').get_id() == 'gcc' + # Construct build_to_src and skip this test if it has spaces + # because then the -I flag to windres will also have spaces + # and we know the test will fail + src_parts = meson.source_root().split('/') + build_parts = meson.build_root().split('/') + + # Get the common path (which might just be '/' or 'C:/') + common = [] + done = false + count = 0 + if src_parts.length() > build_parts.length() + parts = build_parts + other = src_parts + else + parts = src_parts + other = build_parts + endif + foreach part : parts + if not done and part == other.get(count) + common += [part] + else + done = true + endif + count += 1 + endforeach + + # Create path components to go down from the build root to the common path + count = 0 + rel = build_parts + foreach build : build_parts + if count < build_parts.length() - common.length() + rel += ['..'] + endif + count += 1 + endforeach + + # Create path components to go up from the common path to the build root + count = 0 + foreach src : src_parts + if count >= common.length() + rel += [src] + endif + count += 1 + endforeach + + build_to_src = '/'.join(rel) + + if build_to_src.contains(' ') + message('build_to_src is: ' + build_to_src) + error('MESON_SKIP_TEST build_to_src has spaces') + endif + # Welcome to the end of this conditional. + # We hope you never have to implement something like this. +endif + subdir('inc') subdir('res') |