예제 #1
0
def detect_tests_to_run():
    # Name, subdirectory, skip condition.
    all_tests = [
        ('common', 'common', False),
        ('failing-meson', 'failing', False),
        ('failing-build', 'failing build', False),
        ('failing-tests', 'failing tests', False),

        ('platform-osx', 'osx', not mesonlib.is_osx()),
        ('platform-windows', 'windows', not mesonlib.is_windows() and not mesonlib.is_cygwin()),
        ('platform-linux', 'linuxlike', mesonlib.is_osx() or mesonlib.is_windows()),

        ('java', 'java', backend is not Backend.ninja or mesonlib.is_osx() or not have_java()),
        ('C#', 'csharp', backend is not Backend.ninja or not shutil.which('mcs')),
        ('vala', 'vala', backend is not Backend.ninja or not shutil.which('valac')),
        ('rust', 'rust', backend is not Backend.ninja or not shutil.which('rustc')),
        ('d', 'd', backend is not Backend.ninja or not have_d_compiler()),
        ('objective c', 'objc', backend not in (Backend.ninja, Backend.xcode) or mesonlib.is_windows() or not have_objc_compiler()),
        ('fortran', 'fortran', backend is not Backend.ninja or not shutil.which('gfortran')),
        ('swift', 'swift', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('swiftc')),
        ('python3', 'python3', backend is not Backend.ninja),
    ]
    gathered_tests = [(name, gather_tests('test cases/' + subdir), skip) for name, subdir, skip in all_tests]
    if mesonlib.is_windows():
        # TODO: Set BOOST_ROOT in .appveyor.yml
        gathered_tests += [('framework', ['test cases/frameworks/1 boost'], 'BOOST_ROOT' not in os.environ)]
    elif mesonlib.is_osx() or mesonlib.is_cygwin():
        gathered_tests += [('framework', gather_tests('test cases/frameworks'), True)]
    else:
        gathered_tests += [('framework', gather_tests('test cases/frameworks'), False)]
    return gathered_tests
예제 #2
0
def detect_tests_to_run():
    # Name, subdirectory, skip condition.
    all_tests = [
        ('common', 'common', False),
        ('failing-meson', 'failing', False),
        ('failing-build', 'failing build', False),
        ('failing-tests', 'failing tests', False),
        ('prebuilt', 'prebuilt', False),
        ('platform-osx', 'osx', not mesonlib.is_osx()),
        ('platform-windows', 'windows', not mesonlib.is_windows()
         and not mesonlib.is_cygwin()),
        ('platform-linux', 'linuxlike', mesonlib.is_osx()
         or mesonlib.is_windows()),
        ('framework', 'frameworks', mesonlib.is_osx() or mesonlib.is_windows()
         or mesonlib.is_cygwin()),
        ('java', 'java', backend is not Backend.ninja or mesonlib.is_osx()
         or not have_java()),
        ('C#', 'csharp', backend is not Backend.ninja
         or not shutil.which('mcs')),
        ('vala', 'vala', backend is not Backend.ninja
         or not shutil.which('valac')),
        ('rust', 'rust', backend is not Backend.ninja
         or not shutil.which('rustc')),
        ('d', 'd', backend is not Backend.ninja or not have_d_compiler()),
        ('objective c', 'objc', backend not in (Backend.ninja, Backend.xcode)
         or mesonlib.is_windows()),
        ('fortran', 'fortran', backend is not Backend.ninja
         or not shutil.which('gfortran')),
        ('swift', 'swift', backend not in (Backend.ninja, Backend.xcode)
         or not shutil.which('swiftc')),
        ('python3', 'python3', backend is not Backend.ninja
         or not shutil.which('python3')),
    ]
    return [(name, gather_tests('test cases/' + subdir), skip)
            for name, subdir, skip in all_tests]
예제 #3
0
def detect_tests_to_run():
    # Name, subdirectory, skip condition.
    all_tests = [
        ('common', 'common', False),
        ('failing-meson', 'failing', False),
        ('failing-build', 'failing build', False),
        ('failing-tests', 'failing tests', False),

        ('platform-osx', 'osx', not mesonlib.is_osx()),
        ('platform-windows', 'windows', not mesonlib.is_windows() and not mesonlib.is_cygwin()),
        ('platform-linux', 'linuxlike', mesonlib.is_osx() or mesonlib.is_windows()),

        ('java', 'java', backend is not Backend.ninja or mesonlib.is_osx() or not have_java()),
        ('C#', 'csharp', skip_csharp(backend)),
        ('vala', 'vala', backend is not Backend.ninja or not shutil.which('valac')),
        ('rust', 'rust', backend is not Backend.ninja or not shutil.which('rustc')),
        ('d', 'd', backend is not Backend.ninja or not have_d_compiler()),
        ('objective c', 'objc', backend not in (Backend.ninja, Backend.xcode) or mesonlib.is_windows() or not have_objc_compiler()),
        ('objective c++', 'objcpp', backend not in (Backend.ninja, Backend.xcode) or mesonlib.is_windows() or not have_objcpp_compiler()),
        ('fortran', 'fortran', backend is not Backend.ninja or not shutil.which('gfortran')),
        ('swift', 'swift', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('swiftc')),
        ('python3', 'python3', backend is not Backend.ninja),
        ('fpga', 'fpga', shutil.which('yosys') is None),
        ('frameworks', 'frameworks', False),
    ]
    gathered_tests = [(name, gather_tests('test cases/' + subdir), skip) for name, subdir, skip in all_tests]
    return gathered_tests
예제 #4
0
def detect_tests_to_run(only: List[str]) -> List[Tuple[str, List[Path], bool]]:
    """
    Parameters
    ----------
    only: list of str, optional
        specify names of tests to run

    Returns
    -------
    gathered_tests: list of tuple of str, list of pathlib.Path, bool
        tests to run
    """
    # Name, subdirectory, skip condition.
    all_tests = [
        ('cmake', 'cmake', not shutil.which('cmake')
         or (os.environ.get('compiler') == 'msvc2015' and under_ci)),
        ('common', 'common', False),
        ('warning-meson', 'warning', False),
        ('failing-meson', 'failing', False),
        ('failing-build', 'failing build', False),
        ('failing-test', 'failing test', False),
        ('kconfig', 'kconfig', False),
        ('platform-osx', 'osx', not mesonlib.is_osx()),
        ('platform-windows', 'windows', not mesonlib.is_windows()
         and not mesonlib.is_cygwin()),
        ('platform-linux', 'linuxlike', mesonlib.is_osx()
         or mesonlib.is_windows()),
        ('java', 'java', backend is not Backend.ninja or mesonlib.is_osx()
         or not have_java()),
        ('C#', 'csharp', skip_csharp(backend)),
        ('vala', 'vala', backend is not Backend.ninja
         or not shutil.which('valac')),
        ('rust', 'rust', should_skip_rust()),
        ('d', 'd', backend is not Backend.ninja or not have_d_compiler()),
        ('objective c', 'objc', backend not in (Backend.ninja, Backend.xcode)
         or not have_objc_compiler()),
        ('objective c++', 'objcpp',
         backend not in (Backend.ninja, Backend.xcode)
         or not have_objcpp_compiler()),
        ('fortran', 'fortran', backend is not Backend.ninja
         or not shutil.which('gfortran')),
        ('swift', 'swift', backend not in (Backend.ninja, Backend.xcode)
         or not shutil.which('swiftc')),
        ('cuda', 'cuda', backend not in (Backend.ninja, Backend.xcode)
         or not shutil.which('nvcc')),
        ('python3', 'python3', backend is not Backend.ninja),
        ('python', 'python', backend is not Backend.ninja),
        ('fpga', 'fpga', shutil.which('yosys') is None),
        ('frameworks', 'frameworks', False),
        ('nasm', 'nasm', False),
    ]

    if only:
        names = [t[0] for t in all_tests]
        ind = [names.index(o) for o in only]
        all_tests = [all_tests[i] for i in ind]
    gathered_tests = [(name, gather_tests(Path('test cases', subdir)), skip)
                      for name, subdir, skip in all_tests]
    return gathered_tests
예제 #5
0
def detect_tests_to_run(only: T.List[str]) -> T.List[T.Tuple[str, T.List[TestDef], bool]]:
    """
    Parameters
    ----------
    only: list of str, optional
        specify names of tests to run

    Returns
    -------
    gathered_tests: list of tuple of str, list of TestDef, bool
        tests to run
    """

    skip_fortran = not(shutil.which('gfortran') or
                       shutil.which('flang') or
                       shutil.which('pgfortran') or
                       shutil.which('ifort'))

    # Name, subdirectory, skip condition.
    all_tests = [
        ('cmake', 'cmake', not shutil.which('cmake') or (os.environ.get('compiler') == 'msvc2015' and under_ci)),
        ('common', 'common', False),
        ('warning-meson', 'warning', False),
        ('failing-meson', 'failing', False),
        ('failing-build', 'failing build', False),
        ('failing-test',  'failing test', False),
        ('kconfig', 'kconfig', False),

        ('platform-osx', 'osx', not mesonlib.is_osx()),
        ('platform-windows', 'windows', not mesonlib.is_windows() and not mesonlib.is_cygwin()),
        ('platform-linux', 'linuxlike', mesonlib.is_osx() or mesonlib.is_windows()),

        ('java', 'java', backend is not Backend.ninja or mesonlib.is_osx() or not have_java()),
        ('C#', 'csharp', skip_csharp(backend)),
        ('vala', 'vala', backend is not Backend.ninja or not shutil.which(os.environ.get('VALAC', 'valac'))),
        ('rust', 'rust', should_skip_rust(backend)),
        ('d', 'd', backend is not Backend.ninja or not have_d_compiler()),
        ('objective c', 'objc', backend not in (Backend.ninja, Backend.xcode) or not have_objc_compiler()),
        ('objective c++', 'objcpp', backend not in (Backend.ninja, Backend.xcode) or not have_objcpp_compiler()),
        ('fortran', 'fortran', skip_fortran or backend != Backend.ninja),
        ('swift', 'swift', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('swiftc')),
        # CUDA tests on Windows: use Ninja backend:  python run_project_tests.py --only cuda --backend ninja
        ('cuda', 'cuda', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('nvcc')),
        ('python3', 'python3', backend is not Backend.ninja),
        ('python', 'python', backend is not Backend.ninja),
        ('fpga', 'fpga', shutil.which('yosys') is None),
        ('frameworks', 'frameworks', False),
        ('nasm', 'nasm', False),
        ('wasm', 'wasm', shutil.which('emcc') is None or backend is not Backend.ninja),
    ]

    names = [t[0] for t in all_tests]
    assert names == ALL_TESTS, 'argparse("--only", choices=ALL_TESTS) need to be updated to match all_tests names'
    if only:
        ind = [names.index(o) for o in only]
        all_tests = [all_tests[i] for i in ind]
    gathered_tests = [(name, gather_tests(Path('test cases', subdir)), skip) for name, subdir, skip in all_tests]
    return gathered_tests
예제 #6
0
def detect_tests_to_run():
    all_tests = []
    all_tests.append(('common', gather_tests('test cases/common'), False))
    all_tests.append(
        ('failing-meson', gather_tests('test cases/failing'), False))
    all_tests.append(
        ('failing-build', gather_tests('test cases/failing build'), False))
    all_tests.append(
        ('failing-tests', gather_tests('test cases/failing tests'), False))
    all_tests.append(('prebuilt', gather_tests('test cases/prebuilt'), False))

    all_tests.append(('platform-osx', gather_tests('test cases/osx'),
                      False if mesonlib.is_osx() else True))
    all_tests.append(
        ('platform-windows', gather_tests('test cases/windows'),
         False if mesonlib.is_windows() or mesonlib.is_cygwin() else True))
    all_tests.append(
        ('platform-linux', gather_tests('test cases/linuxlike'),
         False if not (mesonlib.is_osx() or mesonlib.is_windows()) else True))
    all_tests.append(
        ('framework', gather_tests('test cases/frameworks'),
         False if not mesonlib.is_osx() and not mesonlib.is_windows()
         and not mesonlib.is_cygwin() else True))
    all_tests.append(('java', gather_tests('test cases/java'),
                      False if using_backend('ninja')
                      and not mesonlib.is_osx() and have_java() else True))
    all_tests.append(
        ('C#', gather_tests('test cases/csharp'),
         False if using_backend('ninja') and shutil.which('mcs') else True))
    all_tests.append(
        ('vala', gather_tests('test cases/vala'),
         False if using_backend('ninja') and shutil.which('valac') else True))
    all_tests.append(
        ('rust', gather_tests('test cases/rust'),
         False if using_backend('ninja') and shutil.which('rustc') else True))
    all_tests.append(
        ('d', gather_tests('test cases/d'),
         False if using_backend('ninja') and have_d_compiler() else True))
    all_tests.append(
        ('objective c', gather_tests('test cases/objc'),
         False if using_backend(
             ('ninja', 'xcode')) and not mesonlib.is_windows() else True))
    all_tests.append(
        ('fortran', gather_tests('test cases/fortran'), False
         if using_backend('ninja') and shutil.which('gfortran') else True))
    all_tests.append(
        ('swift', gather_tests('test cases/swift'), False if using_backend(
            ('ninja', 'xcode')) and shutil.which('swiftc') else True))
    all_tests.append(
        ('python3', gather_tests('test cases/python3'), False
         if using_backend('ninja') and shutil.which('python3') else True))
    return all_tests
예제 #7
0
def setup_commands(backend):
    global backend_flags, compile_commands, test_commands, install_commands, clean_commands
    msbuild_exe = shutil.which('msbuild')
    if (backend and backend.startswith('vs')) or (backend is None
                                                  and msbuild_exe is not None):
        if backend is None:
            backend = 'vs2010'
        backend_flags = ['--backend=' + backend]
        compile_commands = ['msbuild']
        test_commands = ['msbuild', 'RUN_TESTS.vcxproj']
    elif backend == 'xcode' or (backend is None and mesonlib.is_osx()):
        backend_flags = ['--backend=xcode']
        compile_commands = ['xcodebuild']
        test_commands = ['xcodebuild', '-target', 'RUN_TESTS']
    else:
        backend_flags = []
        # We need at least 1.6 because of -w dupbuild=err
        ninja_command = environment.detect_ninja(version='1.6')
        if ninja_command is None:
            raise RuntimeError('Could not find Ninja v1.6 or newer')
        if do_debug:
            compile_commands = [ninja_command, '-v']
        else:
            compile_commands = [ninja_command]
        compile_commands += ['-w', 'dupbuild=err']
        test_commands = [ninja_command, 'test', 'benchmark']
        install_commands = [ninja_command, 'install']
        clean_commands = [ninja_command, 'clean']
예제 #8
0
def skippable(suite, test):
    if not under_ci:
        return True

    if not suite.endswith('frameworks'):
        return True

    # gtk-doc test may be skipped, pending upstream fixes for spaces in
    # filenames landing in the distro used for CI
    if test.endswith('10 gtk-doc'):
        return True

    # No frameworks test should be skipped on linux CI, as we expect all
    # prerequisites to be installed
    if mesonlib.is_linux():
        return False

    # Boost test should only be skipped for windows CI build matrix entries
    # which don't define BOOST_ROOT
    if test.endswith('1 boost'):
        if mesonlib.is_windows():
            return 'BOOST_ROOT' not in os.environ
        return False

    # Qt is provided on macOS by Homebrew
    if test.endswith('4 qt') and mesonlib.is_osx():
        return False

    # Other framework tests are allowed to be skipped on other platforms
    return True
예제 #9
0
def setup_commands(optbackend):
    global do_debug, backend, backend_flags
    global compile_commands, clean_commands, test_commands, install_commands, uninstall_commands
    backend = optbackend
    msbuild_exe = shutil.which('msbuild')
    # Auto-detect backend if unspecified
    if backend is None:
        if msbuild_exe is not None:
            backend = 'vs' # Meson will auto-detect VS version to use
        elif mesonlib.is_osx():
            backend = 'xcode'
        else:
            backend = 'ninja'
    # Set backend arguments for Meson
    if backend.startswith('vs'):
        backend_flags = ['--backend=' + backend]
        backend = Backend.vs
    elif backend == 'xcode':
        backend_flags = ['--backend=xcode']
        backend = Backend.xcode
    elif backend == 'ninja':
        backend_flags = ['--backend=ninja']
        backend = Backend.ninja
    else:
        raise RuntimeError('Unknown backend: {!r}'.format(backend))
    compile_commands, clean_commands, test_commands, install_commands, \
        uninstall_commands = get_backend_commands(backend, do_debug)
예제 #10
0
def setup_commands(backend):
    global backend_flags, compile_commands, test_commands, install_commands
    msbuild_exe = shutil.which('msbuild')
    if backend == 'vs2010' or (backend is None and msbuild_exe is not None):
        backend_flags = ['--backend=vs2010']
        compile_commands = ['msbuild']
        test_commands = ['msbuild', 'RUN_TESTS.vcxproj']
        install_commands = []
    elif backend == 'vs2015':
        backend_flags = ['--backend=vs2015']
        compile_commands = ['msbuild']
        test_commands = ['msbuild', 'RUN_TESTS.vcxproj']
        install_commands = []
    elif backend == 'xcode' or (backend is None and mesonlib.is_osx()):
        backend_flags = ['--backend=xcode']
        compile_commands = ['xcodebuild']
        test_commands = ['xcodebuild', '-target', 'RUN_TESTS']
        install_commands = []
    else:
        backend_flags = []
        ninja_command = environment.detect_ninja()
        if ninja_command is None:
            raise RuntimeError('Could not find Ninja v1.6 or newer')
        if do_debug:
            compile_commands = [ninja_command, '-v']
        else:
            compile_commands = [ninja_command]
        compile_commands += ['-w', 'dupbuild=err']
        test_commands = [ninja_command, 'test', 'benchmark']
        install_commands = [ninja_command, 'install']
예제 #11
0
파일: failuretests.py 프로젝트: frida/meson
 def test_extraframework_dependency_method(self):
     code = "dependency('metal', method : 'extraframework')"
     if not is_osx():
         self.assertMesonRaises(code, self.dnf)
     else:
         # metal framework is always available on macOS
         self.assertMesonOutputs(code, '[Dd]ependency.*metal.*found.*YES')
예제 #12
0
def ensure_backend_detects_changes(backend):
    global NINJA_1_9_OR_NEWER
    if backend is not Backend.ninja:
        return
    need_workaround = False
    # We're not running on HFS+ which only stores dates in seconds:
    # https://developer.apple.com/legacy/library/technotes/tn/tn1150.html#HFSPlusDates
    # XXX: Upgrade Travis image to Apple FS when that becomes available
    # TODO: Detect HFS+ vs APFS
    if mesonlib.is_osx():
        mlog.warning(
            'Running on HFS+, enabling timestamp resolution workaround',
            once=True)
        need_workaround = True
    # We're using ninja >= 1.9 which has QuLogic's patch for sub-1s resolution
    # timestamps
    if not NINJA_1_9_OR_NEWER:
        mlog.warning(
            'Don\'t have ninja >= 1.9, enabling timestamp resolution workaround',
            once=True)
        need_workaround = True
    # Increase the difference between build.ninja's timestamp and the timestamp
    # of whatever you changed: https://github.com/ninja-build/ninja/issues/371
    if need_workaround:
        time.sleep(1)
예제 #13
0
파일: run_tests.py 프로젝트: ssssam/meson
def setup_commands(backend):
    global backend_flags, compile_commands, test_commands, install_commands
    msbuild_exe = shutil.which('msbuild')
    if backend == 'vs2010' or (backend is None and msbuild_exe is not None):
        backend_flags = ['--backend=vs2010']
        compile_commands = ['msbuild']
        test_commands = ['msbuild', 'RUN_TESTS.vcxproj']
        install_commands = []
    elif backend == 'vs2015':
        backend_flags = ['--backend=vs2015']
        compile_commands = ['msbuild']
        test_commands = ['msbuild', 'RUN_TESTS.vcxproj']
        install_commands = []
    elif backend == 'xcode' or (backend is None and mesonlib.is_osx()):
        backend_flags = ['--backend=xcode']
        compile_commands = ['xcodebuild']
        test_commands = ['xcodebuild', '-target', 'RUN_TESTS']
        install_commands = []
    else:
        backend_flags = []
        ninja_command = environment.detect_ninja()
        if ninja_command is None:
            raise RuntimeError('Could not find Ninja executable.')
        if print_debug:
            compile_commands = [ninja_command, '-v']
        else:
            compile_commands = [ninja_command]
        test_commands = [ninja_command, 'test', 'benchmark']
        install_commands = [ninja_command, 'install']
예제 #14
0
def skippable(suite, test):
    if not under_ci:
        return True

    if not suite.endswith('frameworks'):
        return True

    # gtk-doc test may be skipped, pending upstream fixes for spaces in
    # filenames landing in the distro used for CI
    if test.endswith('10 gtk-doc'):
        return True

    # NetCDF is not in the CI image
    if test.endswith('netcdf'):
        return True

    # No frameworks test should be skipped on linux CI, as we expect all
    # prerequisites to be installed
    if mesonlib.is_linux():
        return False

    # Boost test should only be skipped for windows CI build matrix entries
    # which don't define BOOST_ROOT
    if test.endswith('1 boost'):
        if mesonlib.is_windows():
            return 'BOOST_ROOT' not in os.environ
        return False

    # Qt is provided on macOS by Homebrew
    if test.endswith('4 qt') and mesonlib.is_osx():
        return False

    # Other framework tests are allowed to be skipped on other platforms
    return True
예제 #15
0
def skippable(suite, test):
    # Everything is optional when not running on CI, or on Ubuntu 16.04 CI
    if not under_ci or under_xenial_ci:
        return True

    if not suite.endswith('frameworks'):
        return True

    # this test assumptions aren't valid for Windows paths
    if test.endswith('38 libdir must be inside prefix'):
        return True

    # gtk-doc test may be skipped, pending upstream fixes for spaces in
    # filenames landing in the distro used for CI
    if test.endswith('10 gtk-doc'):
        return True

    # NetCDF is not in the CI Docker image
    if test.endswith('netcdf'):
        return True

    # MSVC doesn't link with GFortran
    if test.endswith('14 fortran links c'):
        return True

    # Blocks are not supported on all compilers
    if test.endswith('29 blocks'):
        return True

    # Scientific libraries are skippable on certain systems
    # See the discussion here: https://github.com/mesonbuild/meson/pull/6562
    if any([x in test for x in ['17 mpi', '25 hdf5', '30 scalapack']
            ]) and skip_scientific:
        return True

    # These create OS specific tests, and need to be skippable
    if any([x in test for x in ['16 sdl', '17 mpi']]):
        return True

    # No frameworks test should be skipped on linux CI, as we expect all
    # prerequisites to be installed
    if mesonlib.is_linux():
        return False

    # Boost test should only be skipped for windows CI build matrix entries
    # which don't define BOOST_ROOT
    if test.endswith('1 boost'):
        if mesonlib.is_windows():
            return 'BOOST_ROOT' not in os.environ
        return False

    # Qt is provided on macOS by Homebrew
    if test.endswith('4 qt') and mesonlib.is_osx():
        return False

    # Other framework tests are allowed to be skipped on other platforms
    return True
예제 #16
0
def detect_tests_to_run():
    all_tests = []
    all_tests.append(('common', gather_tests('test cases/common'), False))
    all_tests.append(('failing', gather_tests('test cases/failing'), False))
    all_tests.append(('prebuilt object', gather_tests('test cases/prebuilt object'), False))

    all_tests.append(('platform-osx', gather_tests('test cases/osx'), False if mesonlib.is_osx() else True))
    all_tests.append(('platform-windows', gather_tests('test cases/windows'), False if mesonlib.is_windows() else True))
    all_tests.append(('platform-linux', gather_tests('test cases/linuxlike'), False if not (mesonlib.is_osx() or mesonlib.is_windows()) else True))
    all_tests.append(('framework', gather_tests('test cases/frameworks'), False if not mesonlib.is_osx() and not mesonlib.is_windows() else True))
    all_tests.append(('java', gather_tests('test cases/java'), False if not mesonlib.is_osx() and shutil.which('javac') else True))
    all_tests.append(('C#', gather_tests('test cases/csharp'), False if shutil.which('mcs') else True))
    all_tests.append(('vala', gather_tests('test cases/vala'), False if shutil.which('valac') else True))
    all_tests.append(('rust', gather_tests('test cases/rust'), False if shutil.which('rustc') else True))
    all_tests.append(('objective c', gather_tests('test cases/objc'), False if not mesonlib.is_windows() else True))
    all_tests.append(('fortran', gather_tests('test cases/fortran'), False if shutil.which('gfortran') else True))
    all_tests.append(('swift', gather_tests('test cases/swift'), False if shutil.which('swiftc') else True))
    return all_tests
예제 #17
0
def detect_tests_to_run():
    # Name, subdirectory, skip condition.
    all_tests = [
        ('cmake', 'cmake', not shutil.which('cmake')
         or (os.environ.get('compiler') == 'msvc2015' and under_ci)),
        ('common', 'common', False),
        ('warning-meson', 'warning', False),
        ('failing-meson', 'failing', False),
        ('failing-build', 'failing build', False),
        ('failing-test', 'failing test', False),
        ('kconfig', 'kconfig', False),
        ('platform-osx', 'osx', not mesonlib.is_osx()),
        ('platform-windows', 'windows', not mesonlib.is_windows()
         and not mesonlib.is_cygwin()),
        ('platform-linux', 'linuxlike', mesonlib.is_osx()
         or mesonlib.is_windows()),
        ('java', 'java', backend is not Backend.ninja or mesonlib.is_osx()
         or not have_java()),
        ('C#', 'csharp', skip_csharp(backend)),
        ('vala', 'vala', backend is not Backend.ninja
         or not shutil.which('valac')),
        ('rust', 'rust', backend is not Backend.ninja
         or not shutil.which('rustc')),
        ('d', 'd', backend is not Backend.ninja or not have_d_compiler()),
        ('objective c', 'objc', backend not in (Backend.ninja, Backend.xcode)
         or not have_objc_compiler()),
        ('objective c++', 'objcpp',
         backend not in (Backend.ninja, Backend.xcode)
         or not have_objcpp_compiler()),
        ('fortran', 'fortran', backend is not Backend.ninja
         or not shutil.which('gfortran')),
        ('swift', 'swift', backend not in (Backend.ninja, Backend.xcode)
         or not shutil.which('swiftc')),
        ('cuda', 'cuda', backend not in (Backend.ninja, Backend.xcode)
         or not shutil.which('nvcc')),
        ('python3', 'python3', backend is not Backend.ninja),
        ('python', 'python', backend is not Backend.ninja),
        ('fpga', 'fpga', shutil.which('yosys') is None),
        ('frameworks', 'frameworks', False),
        ('nasm', 'nasm', False),
    ]
    gathered_tests = [(name, gather_tests(Path('test cases', subdir)), skip)
                      for name, subdir, skip in all_tests]
    return gathered_tests
예제 #18
0
파일: run_tests.py 프로젝트: slash3g/meson
def ensure_backend_detects_changes(backend):
    # We're using a ninja with QuLogic's patch for sub-1s resolution timestamps
    # and not running on HFS+ which only stores dates in seconds:
    # https://developer.apple.com/legacy/library/technotes/tn/tn1150.html#HFSPlusDates
    # FIXME: Upgrade Travis image to Apple FS when that becomes available
    if 'MESON_FIXED_NINJA' in os.environ and not mesonlib.is_osx():
        return
    # This is needed to increase the difference between build.ninja's
    # timestamp and the timestamp of whatever you changed due to a Ninja
    # bug: https://github.com/ninja-build/ninja/issues/371
    if backend is Backend.ninja:
        time.sleep(1)
예제 #19
0
def ensure_backend_detects_changes(backend):
    # We're using a ninja with QuLogic's patch for sub-1s resolution timestamps
    # and not running on HFS+ which only stores dates in seconds:
    # https://developer.apple.com/legacy/library/technotes/tn/tn1150.html#HFSPlusDates
    # FIXME: Upgrade Travis image to Apple FS when that becomes available
    if 'MESON_FIXED_NINJA' in os.environ and not mesonlib.is_osx():
        return
    # This is needed to increase the difference between build.ninja's
    # timestamp and the timestamp of whatever you changed due to a Ninja
    # bug: https://github.com/ninja-build/ninja/issues/371
    if backend is Backend.ninja:
        time.sleep(1)
예제 #20
0
파일: run_tests.py 프로젝트: ssssam/meson
def platform_fix_filename(fname):
    if mesonlib.is_osx():
        if fname.endswith('.so'):
            return fname[:-2] + 'dylib'
        return fname.replace('.so.', '.dylib.')
    elif mesonlib.is_windows():
        if fname.endswith('.so'):
            (p, f) = os.path.split(fname)
            f = f[3:-2] + 'dll'
            return os.path.join(p, f)
        if fname.endswith('.a'):
            return fname[:-1] + 'lib'
    return fname
예제 #21
0
def gen_symbols(libfilename, outfilename, cross_host):
    if cross_host is not None:
        # In case of cross builds just always relink.
        # In theory we could determine the correct
        # toolset but there are more important things
        # to do.
        dummy_syms(outfilename)
    elif mesonlib.is_linux():
        linux_syms(libfilename, outfilename)
    elif mesonlib.is_osx():
        osx_syms(libfilename, outfilename)
    else:
        dummy_syms(outfilename)
예제 #22
0
파일: helpers.py 프로젝트: sthagen/meson
def get_dynamic_section_entry(fname: str, entry: str) -> T.Optional[str]:
    if is_cygwin() or is_osx():
        raise unittest.SkipTest('Test only applicable to ELF platforms')

    try:
        raw_out = subprocess.check_output(['readelf', '-d', fname],
                                          universal_newlines=True)
    except FileNotFoundError:
        # FIXME: Try using depfixer.py:Elf() as a fallback
        raise unittest.SkipTest('readelf not found')
    pattern = re.compile(entry + r': \[(.*?)\]')
    for line in raw_out.split('\n'):
        m = pattern.search(line)
        if m is not None:
            return str(m.group(1))
    return None  # The file did not contain the specified entry.
예제 #23
0
def skippable(suite, test):
    # Everything is optional when not running on CI, or on Ubuntu 16.04 CI
    if not under_ci or under_xenial_ci:
        return True

    if not suite.endswith('frameworks'):
        return True

    # this test assumptions aren't valid for Windows paths
    if test.endswith('38 libdir must be inside prefix'):
        return True

    # gtk-doc test may be skipped, pending upstream fixes for spaces in
    # filenames landing in the distro used for CI
    if test.endswith('10 gtk-doc'):
        return True

    # NetCDF is not in the CI Docker image
    if test.endswith('netcdf'):
        return True

    # MSVC doesn't link with GFortran
    if test.endswith('14 fortran links c'):
        return True

    # Blocks are not supported on all compilers
    if test.endswith('29 blocks'):
        return True

    # No frameworks test should be skipped on linux CI, as we expect all
    # prerequisites to be installed
    if mesonlib.is_linux():
        return False

    # Boost test should only be skipped for windows CI build matrix entries
    # which don't define BOOST_ROOT
    if test.endswith('1 boost'):
        if mesonlib.is_windows():
            return 'BOOST_ROOT' not in os.environ
        return False

    # Qt is provided on macOS by Homebrew
    if test.endswith('4 qt') and mesonlib.is_osx():
        return False

    # Other framework tests are allowed to be skipped on other platforms
    return True
예제 #24
0
    def test_python_module(self):
        if is_windows():
            # Bat adds extra crap to stdout, so the version check logic in the
            # python module breaks. This is fine on other OSes because they
            # don't need the extra indirection.
            raise SkipTest('bat indirection breaks internal sanity checks.')
        elif is_osx():
            binary = 'python'
        else:
            binary = 'python2'

            # We not have python2, check for it
            for v in ['2', '2.7', '-2.7']:
                rc = subprocess.call(['pkg-config', '--cflags', f'python{v}'],
                                     stdout=subprocess.DEVNULL,
                                     stderr=subprocess.DEVNULL)
                if rc == 0:
                    break
            else:
                raise SkipTest(
                    'Not running Python 2 tests because dev packages not installed.'
                )
        self._simple_test('python', binary, entry='python')
예제 #25
0
 def get_buildtype_linker_args(self, buildtype):
     if is_osx():
         return apple_buildtype_linker_args[buildtype]
     return gnulike_buildtype_linker_args[buildtype]
예제 #26
0
파일: fortran.py 프로젝트: nioncode/meson
 def get_buildtype_linker_args(self, buildtype):
     if is_osx():
         return apple_buildtype_linker_args[buildtype]
     return gnulike_buildtype_linker_args[buildtype]
예제 #27
0
파일: failuretests.py 프로젝트: frida/meson
 def test_apple_frameworks_dependency(self):
     if not is_osx():
         raise unittest.SkipTest('only run on macOS')
     self.assertMesonRaises("dependency('appleframeworks')",
                            "requires at least one module")
예제 #28
0
import subprocess
import re
import os
import unittest

from mesonbuild.mesonlib import (MachineChoice, is_osx)
from mesonbuild.compilers import (detect_c_compiler)

from run_tests import (get_fake_env)

from .baseplatformtests import BasePlatformTests
from .helpers import *


@unittest.skipUnless(is_osx(), "requires Darwin")
class DarwinTests(BasePlatformTests):
    '''
    Tests that should run on macOS
    '''
    def setUp(self):
        super().setUp()
        self.platform_test_dir = os.path.join(self.src_root, 'test cases/osx')

    def test_apple_bitcode(self):
        '''
        Test that -fembed-bitcode is correctly added while compiling and
        -bitcode_bundle is added while linking when b_bitcode is true and not
        when it is false.  This can't be an ordinary test case because we need
        to inspect the compiler database.
        '''