cmake: Add cross tests

pull/7816/head
Daniel Mensinger 4 years ago
parent 7e58f33376
commit b27af7e465
No known key found for this signature in database
GPG Key ID: 54DD94C131E277D4
  1. 2
      .github/workflows/nonative.yml
  2. 4
      .travis.yml
  3. 5
      ci/travis_script.sh
  4. 7
      cross/linux-mingw-w64-32bit.json
  5. 8
      cross/linux-mingw-w64-32bit.txt
  6. 7
      cross/linux-mingw-w64-64bit.json
  7. 8
      cross/linux-mingw-w64-64bit.txt
  8. 5
      cross/ubuntu-armhf.json
  9. 20
      run_cross_test.py
  10. 1
      run_project_tests.py
  11. 2
      test cases/cmake/2 advanced/subprojects/cmMod/CMakeLists.txt
  12. 2
      test cases/cmake/2 advanced/test.json
  13. 0
      test cases/cmake/22 cmake module/cmake_project/CMakeLists.txt
  14. 0
      test cases/cmake/22 cmake module/meson.build
  15. 0
      test cases/cmake/22 cmake module/projectConfig.cmake.in
  16. 0
      test cases/cmake/22 cmake module/test.json
  17. 1
      test cases/cmake/23 cmake toolchain/CMakeToolchain.cmake
  18. 9
      test cases/cmake/23 cmake toolchain/meson.build
  19. 8
      test cases/cmake/23 cmake toolchain/nativefile.ini.in
  20. 11
      test cases/cmake/23 cmake toolchain/subprojects/cmMod/CMakeLists.txt
  21. 2
      test cases/cmake/3 advanced no dep/subprojects/cmMod/CMakeLists.txt
  22. 3
      test cases/cmake/3 advanced no dep/test.json
  23. 1
      test cases/cmake/4 code gen/subprojects/cmCodeGen/CMakeLists.txt
  24. 3
      test cases/cmake/7 cmake options/test.json

@ -16,4 +16,4 @@ jobs:
apt-get -y autoremove
- uses: actions/checkout@v2
- name: Run tests
run: bash -c 'source /ci/env_vars.sh; cd $GITHUB_WORKSPACE; ./run_tests.py $CI_ARGS --cross ubuntu-armhf.txt --cross-only'
run: bash -c 'source /ci/env_vars.sh; cd $GITHUB_WORKSPACE; ./run_tests.py $CI_ARGS --cross ubuntu-armhf.json --cross-only'

@ -34,10 +34,10 @@ matrix:
# Also hijack one cross build to test long commandline handling codepath (and avoid overloading Travis)
- os: linux
compiler: gcc
env: RUN_TESTS_ARGS="--cross ubuntu-armhf.txt --cross linux-mingw-w64-64bit.txt" MESON_RSP_THRESHOLD=0
env: RUN_TESTS_ARGS="--cross ubuntu-armhf.json --cross linux-mingw-w64-64bit.json" MESON_RSP_THRESHOLD=0
- os: linux
compiler: gcc
env: RUN_TESTS_ARGS="--cross ubuntu-armhf.txt --cross linux-mingw-w64-64bit.txt" MESON_ARGS="--unity=on"
env: RUN_TESTS_ARGS="--cross ubuntu-armhf.json --cross linux-mingw-w64-64bit.json" MESON_ARGS="--unity=on"
before_install:
- python ./skip_ci.py --base-branch-env=TRAVIS_BRANCH --is-pull-env=TRAVIS_PULL_REQUEST

@ -31,6 +31,11 @@ fi
source /ci/env_vars.sh
cd /root
update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix
update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
./run_tests.py $RUN_TESTS_ARGS -- $MESON_ARGS
#./upload.sh

@ -0,0 +1,7 @@
{
"file": "linux-mingw-w64-32bit.txt",
"tests": ["common", "cmake"],
"env": {
"WINEPATH": "/usr/lib/gcc/i686-w64-mingw32/9.2-posix;/usr/i686-w64-mingw32/bin;/usr/i686-w64-mingw32/lib"
}
}

@ -19,3 +19,11 @@ system = 'windows'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'
[cmake]
CMAKE_BUILD_WITH_INSTALL_RPATH = 'ON'
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = 'NEVER'
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = 'ONLY'
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = 'ONLY'
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = 'ONLY'

@ -0,0 +1,7 @@
{
"file": "linux-mingw-w64-64bit.txt",
"tests": ["common", "cmake"],
"env": {
"WINEPATH": "/usr/lib/gcc/x86_64-w64-mingw32/9.2-posix;/usr/x86_64-w64-mingw32/bin;/usr/x86_64-w64-mingw32/lib"
}
}

@ -18,3 +18,11 @@ system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
[cmake]
CMAKE_BUILD_WITH_INSTALL_RPATH = 'ON'
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = 'NEVER'
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = 'ONLY'
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = 'ONLY'
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = 'ONLY'

@ -0,0 +1,5 @@
{
"file": "ubuntu-armhf.txt",
"tests": ["common"],
"env": {}
}

@ -23,10 +23,13 @@ import argparse
import subprocess
from mesonbuild import mesonlib
from mesonbuild.coredata import version as meson_version
from pathlib import Path
import json
import os
def runtests(cross_file, failfast, cross_only):
tests = ['--only', 'common']
def runtests(cross_file, failfast, cross_only, test_list, env=None):
tests = ['--only'] + test_list
if not cross_only:
tests.append('native')
cmd = mesonlib.python_command + ['run_project_tests.py', '--backend', 'ninja']
@ -36,7 +39,7 @@ def runtests(cross_file, failfast, cross_only):
cmd += ['--cross-file', cross_file]
if cross_only:
cmd += ['--native-file', 'cross/none.txt']
return subprocess.call(cmd)
return subprocess.call(cmd, env=env)
def main():
parser = argparse.ArgumentParser()
@ -44,7 +47,16 @@ def main():
parser.add_argument('--cross-only', action='store_true')
parser.add_argument('cross_file')
options = parser.parse_args()
return runtests(options.cross_file, options.failfast, options.cross_only)
cf_path = Path(options.cross_file)
try:
data = json.loads(cf_path.read_text())
real_cf = cf_path.resolve().parent / data['file']
assert real_cf.exists()
env = os.environ.copy()
env.update(data['env'])
return runtests(real_cf.as_posix(), options.failfast, options.cross_only, data['tests'], env=env)
except Exception:
return runtests(options.cross_file, options.failfast, options.cross_only, ['common'])
if __name__ == '__main__':
print('Meson build system', meson_version, 'Cross Tests')

@ -1163,6 +1163,7 @@ def check_format():
'.dub', # external deps are here
'.pytest_cache',
'meson-logs', 'meson-private',
'work area',
'.eggs', '_cache', # e.g. .mypy_cache
'venv', # virtualenvs have DOS line endings
}

@ -25,4 +25,4 @@ target_link_libraries(testEXE cmModLib)
target_compile_definitions(cmModLibStatic PUBLIC CMMODLIB_STATIC_DEFINE)
install(TARGETS cmModLib testEXE LIBRARY DESTINATION lib RUNTIME DESTINATION bin)
install(TARGETS testEXE LIBRARY DESTINATION lib RUNTIME DESTINATION bin)

@ -1,7 +1,5 @@
{
"installed": [
{"type": "expr", "file": "usr/?lib/libcm_cmModLib?so"},
{"type": "implib", "file": "usr/lib/libcm_cmModLib"},
{"type": "exe", "file": "usr/bin/cm_testEXE"}
],
"tools": {

@ -0,0 +1,9 @@
project('cmake toolchain test', ['c', 'cpp'])
if meson.is_cross_build()
error('MESON_SKIP_TEST: skip this on cross builds')
endif
cm = import('cmake')
sub_pro = cm.subproject('cmMod')

@ -0,0 +1,8 @@
[properties]
cmake_toolchain_file = '@MESON_TEST_ROOT@/CMakeToolchain.cmake'
[cmake]
MESON_TEST_VAR1 = 'VAR1 space'
MESON_TEST_VAR2 = 'VAR2 error'

@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.5)
project(cmMod)
if(NOT "${MESON_TEST_VAR1}" STREQUAL "VAR1 space")
message(FATAL_ERROR "MESON_TEST_VAR1 -- '${MESON_TEST_VAR1}' != 'VAR1 space'")
endif()
if(NOT "${MESON_TEST_VAR2}" STREQUAL "VAR2")
message(FATAL_ERROR "MESON_TEST_VAR2 -- '${MESON_TEST_VAR2}' != 'VAR2'")
endif()

@ -23,4 +23,4 @@ target_link_libraries(testEXE2 cmModLib)
target_compile_definitions(cmModLibStatic PUBLIC CMMODLIB_STATIC_DEFINE)
install(TARGETS cmModLib testEXE testEXE2 LIBRARY DESTINATION lib RUNTIME DESTINATION bin)
install(TARGETS testEXE testEXE2 LIBRARY DESTINATION lib RUNTIME DESTINATION bin)

@ -1,8 +1,5 @@
{
"installed": [
{"type": "expr", "file": "usr/?lib/libcm_cmModLib?so"},
{"type": "implib", "file": "usr/lib/libcm_cmModLib"},
{"type": "pdb", "file": "usr/bin/cm_cmModLib"},
{"type": "pdb", "file": "usr/bin/cm_testEXE"},
{"type": "exe", "file": "usr/bin/cm_testEXE"},
{"type": "pdb", "file": "usr/bin/cm_testEXE2"},

@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 3.7)
project(CMCodeGen)
set(CMAKE_CXX_STANDARD 14)
add_executable(genA main.cpp)

@ -3,6 +3,9 @@
"options": {
"cmake_prefix_path": [
{ "val": ["val1", "val2"] }
],
"build.cmake_prefix_path": [
{ "val": ["val1", "val2"] }
]
}
}

Loading…
Cancel
Save