diff --git a/.github/workflows/lint_mypy.yml b/.github/workflows/lint_mypy.yml index b76a751fb8de..54535b3b1433 100644 --- a/.github/workflows/lint_mypy.yml +++ b/.github/workflows/lint_mypy.yml @@ -30,4 +30,4 @@ jobs: with: python-version: '3.x' - run: python -m pip install mypy - - run: mypy --follow-imports=skip mesonbuild/mtest.py mesonbuild/minit.py mesonbuild/mintro.py mesonbuild/msetup.py mesonbuild/wrap tools/ mesonbuild/modules/fs.py mesonbuild/dependencies/mpi.py mesonbuild/dependencies/hdf5.py mesonbuild/compilers/mixins/intel.py + - run: mypy --follow-imports=skip mesonbuild/mtest.py mesonbuild/minit.py mesonbuild/mintro.py mesonbuild/msetup.py mesonbuild/wrap tools/ mesonbuild/modules/fs.py mesonbuild/dependencies/boost.py mesonbuild/dependencies/mpi.py mesonbuild/dependencies/hdf5.py mesonbuild/compilers/mixins/intel.py diff --git a/.github/workflows/os_comp.yml b/.github/workflows/os_comp.yml index dcbbdde89b5a..19281c997ffc 100644 --- a/.github/workflows/os_comp.yml +++ b/.github/workflows/os_comp.yml @@ -11,9 +11,7 @@ jobs: - name: Install Dependencies run: | sudo apt update -yq - sudo apt install -yq --no-install-recommends python3-setuptools python3-pip g++ gfortran gobjc gobjc++ zlib1g-dev python-dev python3-dev libboost-all-dev - - name: Remove GitHub boost version - run: sudo rm -rf /usr/local/share/boost + sudo apt install -yq --no-install-recommends python3-setuptools python3-pip g++ gfortran gobjc gobjc++ zlib1g-dev python-dev python3-dev - name: Install ninja-build tool uses: seanmiddleditch/gha-setup-ninja@v1 - name: Python version @@ -21,7 +19,7 @@ jobs: - name: Ninja version run: ninja --version - name: Run tests - run: python3 run_tests.py + run: LD_LIBRARY_PATH=/usr/local/share/boost/1.69.0/lib/:$LD_LIBRARY_PATH python3 run_tests.py env: CI: '1' XENIAL: '1' @@ -48,6 +46,7 @@ jobs: env: CI: '1' SKIP_SCIENTIFIC: '1' + SKIP_STATIC_BOOST: '1' opensuse: name: OpenSUSE @@ -60,3 +59,4 @@ jobs: env: CI: '1' SKIP_SCIENTIFIC: '1' + SKIP_STATIC_BOOST: '1' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1a9de56d15a5..40d422d059ef 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -105,7 +105,10 @@ jobs: - script: | set BOOST_ROOT= set PATH=%CYGWIN_ROOT%\bin;%SYSTEMROOT%\system32 + set SKIP_STATIC_BOOST=1 env.exe -- python3 run_tests.py --backend=ninja + # Cygwin's static boost installation is broken (some static library + # variants such as boost_thread are not present) displayName: Run Tests - task: CopyFiles@2 condition: not(canceled()) diff --git a/ci/azure-steps.yml b/ci/azure-steps.yml index 1c861e77c329..fa280467524a 100644 --- a/ci/azure-steps.yml +++ b/ci/azure-steps.yml @@ -49,8 +49,8 @@ steps: # install boost (except for clang-cl) if ($env:arch -eq 'x86') { $boost_bitness = '32' } else { $boost_bitness = '64' } - if ($env:compiler -eq 'msvc2017') { - $boost_version = '1.64.0' ; $boost_abi_tag = '14.1' + if ($env:compiler -eq 'msvc2017' -Or $env:compiler -eq 'msvc2019' -Or $env:compiler -eq 'clang-cl') { + $boost_version = '1.72.0' ; $boost_abi_tag = '14.1' } if ($boost_version) { $boost_filename = $boost_version.Replace('.', '_') diff --git a/ci/ciimage/eoan/Dockerfile b/ci/ciimage/eoan/Dockerfile index a98662cb0eca..dcc854939c48 100644 --- a/ci/ciimage/eoan/Dockerfile +++ b/ci/ciimage/eoan/Dockerfile @@ -24,7 +24,7 @@ RUN sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list" \ && eatmydata apt-get -y install libgcrypt20-dev \ && eatmydata apt-get -y install libgpgme-dev \ && eatmydata apt-get -y install libhdf5-dev \ -&& eatmydata apt-get -y install libboost-python-dev \ +&& eatmydata apt-get -y install libboost-python-dev libboost-regex-dev \ && eatmydata apt-get -y install libblocksruntime-dev \ && eatmydata apt-get -y install libperl-dev \ && eatmydata apt-get -y install liblapack-dev libscalapack-mpi-dev \ diff --git a/run_project_tests.py b/run_project_tests.py index 65e1d0cd8734..1194abf495bb 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -136,6 +136,7 @@ def __exit__(self, _type, value, traceback): no_meson_log_msg = 'No meson-log.txt found.' system_compiler = None +compiler_id_map = {} # type: T.Dict[str, str] class StopException(Exception): def __init__(self): @@ -544,12 +545,24 @@ def gather_tests(testdir: Path) -> T.Iterator[TestDef]: assert "val" in i skip = False + # Add an empty matrix entry + if i['val'] is None: + tmp_opts += [(None, False)] + continue + # Skip the matrix entry if environment variable is present if 'skip_on_env' in i: for env in i['skip_on_env']: if env in os.environ: skip = True + # Only run the test if all compiler ID's match + if 'compilers' in i: + for lang, id_list in i['compilers'].items(): + if lang not in compiler_id_map or compiler_id_map[lang] not in id_list: + skip = True + break + tmp_opts += [('{}={}'.format(key, i['val']), skip)] if opt_list: @@ -561,9 +574,27 @@ def gather_tests(testdir: Path) -> T.Iterator[TestDef]: else: opt_list = [[x] for x in tmp_opts] + # Exclude specific configurations + if 'exclude' in matrix: + assert isinstance(matrix['exclude'], list) + new_opt_list = [] # type: T.List[T.List[T.Tuple[str, bool]]] + for i in opt_list: + exclude = False + opt_names = [x[0] for x in i] + for j in matrix['exclude']: + ex_list = ['{}={}'.format(k, v) for k, v in j.items()] + if all([x in opt_names for x in ex_list]): + exclude = True + break + + if not exclude: + new_opt_list += [i] + + opt_list = new_opt_list + for i in opt_list: - name = ' '.join([x[0] for x in i]) - opts = ['-D' + x[0] for x in i] + name = ' '.join([x[0] for x in i if x[0] is not None]) + opts = ['-D' + x[0] for x in i if x[0] is not None] skip = any([x[1] for x in i]) all_tests += [TestDef(t.path, name, opts, skip)] @@ -991,7 +1022,7 @@ def check_meson_commands_work(options): def detect_system_compiler(options): - global system_compiler + global system_compiler, compiler_id_map with AutoDeletedDir(tempfile.mkdtemp(prefix='b ', dir='.')) as build_dir: fake_opts = get_fake_options('/') @@ -1002,7 +1033,8 @@ def detect_system_compiler(options): for lang in sorted(compilers.all_languages): try: comp = env.compiler_from_language(lang, MachineChoice.HOST) - details = '%s %s' % (' '.join(comp.get_exelist()), comp.get_version_string()) + details = '{} {} [{}]'.format(' '.join(comp.get_exelist()), comp.get_version_string(), comp.get_id()) + compiler_id_map[lang] = comp.get_id() except mesonlib.MesonException: comp = None details = 'not found' diff --git a/test cases/frameworks/1 boost/meson.build b/test cases/frameworks/1 boost/meson.build index eec8728ebfd7..ccfaa6647c72 100644 --- a/test cases/frameworks/1 boost/meson.build +++ b/test cases/frameworks/1 boost/meson.build @@ -1,31 +1,25 @@ # this test requires the following on Ubuntu: libboost-{system,python,log,thread,test}-dev project('boosttest', 'cpp', - default_options : ['cpp_std=c++11']) + default_options : ['cpp_std=c++14']) -add_project_arguments(['-DBOOST_LOG_DYN_LINK'], - language : 'cpp' -) +s = get_option('static') -dep = dependency('boost', required: false) +dep = dependency('boost', static: s, required: false) if not dep.found() error('MESON_SKIP_TEST boost not found.') endif -compiler = meson.get_compiler('cpp') -if compiler.has_argument('-permissive') - # boost 1.64, the version we test against, doesn't work with -permissive - add_project_arguments('-permissive', language: 'cpp') -endif - # We want to have multiple separate configurations of Boost # within one project. The need to be independent of each other. # Use one without a library dependency and one with it. -linkdep = dependency('boost', modules : ['thread', 'system', 'test']) -staticdep = dependency('boost', modules : ['thread', 'system'], static : true) -testdep = dependency('boost', modules : ['unit_test_framework']) -nomoddep = dependency('boost') -extralibdep = dependency('boost', modules : ['thread', 'system', 'log_setup', 'log']) +linkdep = dependency('boost', static: s, modules : ['thread', 'system']) +testdep = dependency('boost', static: s, modules : ['unit_test_framework']) +nomoddep = dependency('boost', static: s) +extralibdep = dependency('boost', static: s, modules : ['thread', 'system', 'date_time', 'log_setup', 'log', 'filesystem', 'regex']) +notfound = dependency('boost', static: s, modules : ['this_should_not_exist_on_any_systen'], required: false) + +assert(not notfound.found()) pymod = import('python') python2 = pymod.find_installation('python2', required: host_machine.system() == 'linux', disabler: true) @@ -34,28 +28,28 @@ python2dep = python2.dependency(required: host_machine.system() == 'linux', embe python3dep = python3.dependency(required: host_machine.system() == 'linux', embed: true, disabler: true) # compile python 2/3 modules only if we found a corresponding python version -if(python2dep.found() and host_machine.system() == 'linux') +if(python2dep.found() and host_machine.system() == 'linux' and not s) if(dep.version().version_compare('>=1.67')) # if we have a new version of boost, we need to construct the module name based # on the installed version of python (and hope that they match the version boost # was compiled against) py2version_string = ''.join(python2dep.version().split('.')) - bpython2dep = dependency('boost', modules : ['python' + py2version_string], required: false, disabler: true) + bpython2dep = dependency('boost', static: s, modules : ['python' + py2version_string], required: false, disabler: true) else # if we have an older version of boost, we need to use the old module names - bpython2dep = dependency('boost', modules : ['python'], required: false, disabler: true) + bpython2dep = dependency('boost', static: s, modules : ['python'], required: false, disabler: true) endif else python2dep = disabler() bpython2dep = disabler() endif -if(python3dep.found() and host_machine.system() == 'linux') +if(python3dep.found() and host_machine.system() == 'linux' and not s) if(dep.version().version_compare('>=1.67')) py3version_string = ''.join(python3dep.version().split('.')) - bpython3dep = dependency('boost', modules : ['python' + py3version_string], required: false, disabler: true) + bpython3dep = dependency('boost', static: s, modules : ['python' + py3version_string], required: false, disabler: true) else - bpython3dep = dependency('boost', modules : ['python3'], required: false, disabler: true) + bpython3dep = dependency('boost', static: s, modules : ['python3'], required: false, disabler: true) endif else python3dep = disabler() @@ -63,7 +57,6 @@ else endif linkexe = executable('linkedexe', 'linkexe.cc', dependencies : linkdep) -staticexe = executable('staticlinkedexe', 'linkexe.cc', dependencies : staticdep) unitexe = executable('utf', 'unit_test.cpp', dependencies: testdep) nomodexe = executable('nomod', 'nomod.cpp', dependencies : nomoddep) extralibexe = executable('extralibexe', 'extralib.cpp', dependencies : extralibdep) @@ -73,7 +66,6 @@ python2module = shared_library('python2_module', ['python_module.cpp'], dependen python3module = shared_library('python3_module', ['python_module.cpp'], dependencies: [python3dep, bpython3dep], name_prefix: '', cpp_args: ['-DMOD_NAME=python3_module']) test('Boost linktest', linkexe) -test('Boost statictest', staticexe) test('Boost UTF test', unitexe) test('Boost nomod', nomodexe) test('Boost extralib test', extralibexe) @@ -87,4 +79,4 @@ test('Boost Python3', python3interpreter, args: ['./test_python_module.py', meso subdir('partial_dep') # check we can apply a version constraint -dependency('boost', version: '>=@0@'.format(dep.version())) +dependency('boost', static: s, version: '>=@0@'.format(dep.version())) diff --git a/test cases/frameworks/1 boost/meson_options.txt b/test cases/frameworks/1 boost/meson_options.txt new file mode 100644 index 000000000000..019feaf383f6 --- /dev/null +++ b/test cases/frameworks/1 boost/meson_options.txt @@ -0,0 +1 @@ +option('static', type: 'boolean', value: false) diff --git a/test cases/frameworks/1 boost/test_matrix.json b/test cases/frameworks/1 boost/test_matrix.json new file mode 100644 index 000000000000..730610ee5963 --- /dev/null +++ b/test cases/frameworks/1 boost/test_matrix.json @@ -0,0 +1,19 @@ +{ + "options": { + "static": [ + { "val": "true", "skip_on_env": [ "SKIP_STATIC_BOOST" ] }, + { "val": "false" } + ], + "b_vscrt": [ + { "val": null }, + { "val": "md", "compilers": { "cpp": [ "msvc" ] } }, + { "val": "mdd", "compilers": { "cpp": [ "msvc" ] } }, + { "val": "mt", "compilers": { "cpp": [ "msvc" ] } }, + { "val": "mtd", "compilers": { "cpp": [ "msvc" ] } } + ] + }, + "exclude": [ + { "static": "false", "b_vscrt": "mt" }, + { "static": "false", "b_vscrt": "mtd" } + ] +} diff --git a/test cases/frameworks/1 boost/unit_test.cpp b/test cases/frameworks/1 boost/unit_test.cpp index 35059997d713..fa1fbaa5855c 100644 --- a/test cases/frameworks/1 boost/unit_test.cpp +++ b/test cases/frameworks/1 boost/unit_test.cpp @@ -1,4 +1,3 @@ -#define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE "MesonTest" #define BOOST_TEST_MAIN #include