Exemple #1
0
Fichier : cc.py Projet : LLNL/spack
def test_ccld_with_system_dirs(dep1, dep2, dep3, dep4):
    """Ensure all flags are added in ccld mode."""
    deps = ':'.join((dep1, dep2, dep3, dep4))
    with set_env(SPACK_DEPENDENCIES=deps,
                 SPACK_RPATH_DEPS=deps,
                 SPACK_LINK_DEPS=deps):

        sys_path_args = ['-I/usr/include',
                         '-L/usr/local/lib',
                         '-Wl,-rpath,/usr/lib64',
                         '-I/usr/local/include',
                         '-L/lib64/']
        check_args(
            cc, sys_path_args + test_args,
            [real_cc] +
            test_include_paths +
            ['-I' + dep1 + '/include',
             '-I' + dep3 + '/include',
             '-I' + dep4 + '/include'] +
            ['-I/usr/include',
             '-I/usr/local/include'] +
            test_library_paths +
            ['-L' + dep1 + '/lib',
             '-L' + dep2 + '/lib64',
             '-L' + dep3 + '/lib64'] +
            ['-L/usr/local/lib',
             '-L/lib64/'] +
            test_wl_rpaths +
            pkg_wl_rpaths +
            ['-Wl,-rpath,' + dep1 + '/lib',
             '-Wl,-rpath,' + dep2 + '/lib64',
             '-Wl,-rpath,' + dep3 + '/lib64'] +
            ['-Wl,-rpath,/usr/lib64'] +
            test_args_without_paths)
Exemple #2
0
Fichier : cc.py Projet : LLNL/spack
def test_ld_deps_partial(dep1):
    """Make sure ld -r (partial link) is handled correctly on OS's where it
       doesn't accept rpaths.
    """
    with set_env(SPACK_DEPENDENCIES=dep1,
                 SPACK_RPATH_DEPS=dep1,
                 SPACK_LINK_DEPS=dep1):
        # TODO: do we need to add RPATHs on other platforms like Linux?
        # TODO: Can't we treat them the same?
        os.environ['SPACK_SHORT_SPEC'] = "[email protected]=linux-x86_64"
        check_args(
            ld, ['-r'] + test_args,
            ['ld'] +
            test_include_paths +
            test_library_paths +
            ['-L' + dep1 + '/lib'] +
            test_rpaths +
            pkg_rpaths +
            ['-rpath', dep1 + '/lib'] +
            ['-r'] +
            test_args_without_paths)

        # rpaths from the underlying command will still appear
        # Spack will not add its own rpaths.
        os.environ['SPACK_SHORT_SPEC'] = "[email protected]=darwin-x86_64"
        check_args(
            ld, ['-r'] + test_args,
            ['ld'] +
            test_include_paths +
            test_library_paths +
            ['-L' + dep1 + '/lib'] +
            test_rpaths +
            ['-r'] +
            test_args_without_paths)
Exemple #3
0
Fichier : cc.py Projet : LLNL/spack
def check_args(cc, args, expected):
    """Check output arguments that cc produces when called with args.

    This assumes that cc will print debug command output with one element
    per line, so that we see whether arguments that should (or shouldn't)
    contain spaces are parsed correctly.
    """
    with set_env(SPACK_TEST_COMMAND='dump-args'):
        assert expected == cc(*args, output=str).strip().split('\n')
Exemple #4
0
Fichier : cc.py Projet : LLNL/spack
def wrapper_flags():
    with set_env(
            SPACK_CPPFLAGS=' '.join(spack_cppflags),
            SPACK_CFLAGS=' '.join(spack_cflags),
            SPACK_CXXFLAGS=' '.join(spack_cxxflags),
            SPACK_FFLAGS=' '.join(spack_fflags),
            SPACK_LDFLAGS=' '.join(spack_ldflags),
            SPACK_LDLIBS=' '.join(spack_ldlibs)):
        yield
Exemple #5
0
Fichier : cc.py Projet : LLNL/spack
def test_ccache_prepend_for_cc():
    with set_env(SPACK_CCACHE_BINARY='ccache'):
        check_args(
            cc, test_args,
            ['ccache'] +  # ccache prepended in cc mode
            [real_cc] +
            test_include_paths +
            test_library_paths +
            test_wl_rpaths +
            pkg_wl_rpaths +
            test_args_without_paths)
Exemple #6
0
Fichier : cc.py Projet : LLNL/spack
def test_dep_lib_no_lib(dep2):
    """Ensure a single dependency RPATH is added with no -L."""
    with set_env(SPACK_DEPENDENCIES=dep2,
                 SPACK_RPATH_DEPS=dep2):
        check_args(
            cc, test_args,
            [real_cc] +
            test_include_paths +
            test_library_paths +
            test_wl_rpaths +
            pkg_wl_rpaths +
            ['-Wl,-rpath,' + dep2 + '/lib64'] +
            test_args_without_paths)
Exemple #7
0
Fichier : cc.py Projet : LLNL/spack
def test_dep_lib_no_rpath(dep2):
    """Ensure a single dependency link flag is added with no dep RPATH."""
    with set_env(SPACK_DEPENDENCIES=dep2,
                 SPACK_LINK_DEPS=dep2):
        check_args(
            cc, test_args,
            [real_cc] +
            test_include_paths +
            test_library_paths +
            ['-L' + dep2 + '/lib64'] +
            test_wl_rpaths +
            pkg_wl_rpaths +
            test_args_without_paths)
Exemple #8
0
Fichier : cc.py Projet : LLNL/spack
def test_dep_include(dep4):
    """Ensure a single dependency include directory is added."""
    with set_env(SPACK_DEPENDENCIES=dep4,
                 SPACK_RPATH_DEPS=dep4,
                 SPACK_LINK_DEPS=dep4):
        check_args(
            cc, test_args,
            [real_cc] +
            test_include_paths +
            ['-I' + dep4 + '/include'] +
            test_library_paths +
            test_wl_rpaths +
            pkg_wl_rpaths +
            test_args_without_paths)
Exemple #9
0
Fichier : cc.py Projet : LLNL/spack
def test_ld_deps_no_link(dep1, dep2, dep3, dep4):
    """Ensure SPACK_RPATH_DEPS controls -rpath for ld."""
    deps = ':'.join((dep1, dep2, dep3, dep4))
    with set_env(SPACK_DEPENDENCIES=deps,
                 SPACK_RPATH_DEPS=deps):
        check_args(
            ld, test_args,
            ['ld'] +
            test_include_paths +
            test_library_paths +
            test_rpaths +
            pkg_rpaths +
            ['-rpath', dep1 + '/lib',
             '-rpath', dep2 + '/lib64',
             '-rpath', dep3 + '/lib64'] +
            test_args_without_paths)
Exemple #10
0
Fichier : cc.py Projet : LLNL/spack
def test_cc_deps(dep1, dep2, dep3, dep4):
    """Ensure -L and RPATHs are not added in cc mode."""
    deps = ':'.join((dep1, dep2, dep3, dep4))
    with set_env(SPACK_DEPENDENCIES=deps,
                 SPACK_RPATH_DEPS=deps,
                 SPACK_LINK_DEPS=deps):
        check_args(
            cc, ['-c'] + test_args,
            [real_cc] +
            test_include_paths +
            ['-I' + dep1 + '/include',
             '-I' + dep3 + '/include',
             '-I' + dep4 + '/include'] +
            test_library_paths +
            ['-c'] +
            test_args_without_paths)
Exemple #11
0
Fichier : cc.py Projet : LLNL/spack
def wrapper_environment():
    with set_env(
            SPACK_CC=real_cc,
            SPACK_CXX=real_cc,
            SPACK_FC=real_cc,
            SPACK_PREFIX=pkg_prefix,
            SPACK_ENV_PATH='test',
            SPACK_DEBUG_LOG_DIR='.',
            SPACK_DEBUG_LOG_ID='foo-hashabc',
            SPACK_COMPILER_SPEC='[email protected]',
            SPACK_SHORT_SPEC='[email protected] arch=linux-rhel6-x86_64 /hashabc',
            SPACK_SYSTEM_DIRS=':'.join(system_dirs),
            SPACK_CC_RPATH_ARG='-Wl,-rpath,',
            SPACK_CXX_RPATH_ARG='-Wl,-rpath,',
            SPACK_F77_RPATH_ARG='-Wl,-rpath,',
            SPACK_FC_RPATH_ARG='-Wl,-rpath,',
            SPACK_DEPENDENCIES=None):
        yield
Exemple #12
0
Fichier : cc.py Projet : LLNL/spack
def test_ld_deps(dep1, dep2, dep3, dep4):
    """Ensure no (extra) -I args or -Wl, are passed in ld mode."""
    deps = ':'.join((dep1, dep2, dep3, dep4))
    with set_env(SPACK_DEPENDENCIES=deps,
                 SPACK_RPATH_DEPS=deps,
                 SPACK_LINK_DEPS=deps):
        check_args(
            ld, test_args,
            ['ld'] +
            test_include_paths +
            test_library_paths +
            ['-L' + dep1 + '/lib',
             '-L' + dep2 + '/lib64',
             '-L' + dep3 + '/lib64'] +
            test_rpaths +
            pkg_rpaths +
            ['-rpath', dep1 + '/lib',
             '-rpath', dep2 + '/lib64',
             '-rpath', dep3 + '/lib64'] +
            test_args_without_paths)
Exemple #13
0
def wrapper_environment():
    with set_env(SPACK_CC=real_cc,
                 SPACK_CXX=real_cc,
                 SPACK_FC=real_cc,
                 SPACK_PREFIX=pkg_prefix,
                 SPACK_ENV_PATH='test',
                 SPACK_DEBUG_LOG_DIR='.',
                 SPACK_DEBUG_LOG_ID='foo-hashabc',
                 SPACK_COMPILER_SPEC='[email protected]',
                 SPACK_SHORT_SPEC='[email protected] arch=linux-rhel6-x86_64 /hashabc',
                 SPACK_SYSTEM_DIRS=':'.join(system_dirs),
                 SPACK_CC_RPATH_ARG='-Wl,-rpath,',
                 SPACK_CXX_RPATH_ARG='-Wl,-rpath,',
                 SPACK_F77_RPATH_ARG='-Wl,-rpath,',
                 SPACK_FC_RPATH_ARG='-Wl,-rpath,',
                 SPACK_LINK_DIRS=None,
                 SPACK_INCLUDE_DIRS=None,
                 SPACK_RPATH_DIRS=None,
                 SPACK_TARGET_ARGS='',
                 SPACK_LINKER_ARG='-Wl,',
                 SPACK_DTAGS_TO_ADD='--disable-new-dtags',
                 SPACK_DTAGS_TO_STRIP='--enable-new-dtags'):
        yield
Exemple #14
0
def test_ccld_with_system_dirs_isystem():
    """Ensure all flags are added in ccld mode.
       Ensure that includes are in the proper
       place when a build uses -isystem, and uses
       system directories in the include paths"""
    with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc',
                 SPACK_RPATH_DIRS='xlib:ylib:zlib',
                 SPACK_LINK_DIRS='xlib:ylib:zlib'):

        sys_path_args = [
            '-isystem', '/usr/include', '-L/usr/local/lib',
            '-Wl,-rpath,/usr/lib64', '-isystem', '/usr/local/include',
            '-L/lib64/'
        ]
        check_args(
            cc, sys_path_args + test_args, [real_cc] + test_include_paths +
            ['-isystem', 'xinc', '-isystem', 'yinc', '-isystem', 'zinc'] +
            ['-isystem', '/usr/include', '-isystem', '/usr/local/include'] +
            test_library_paths + ['-Lxlib', '-Lylib', '-Lzlib'] +
            ['-L/usr/local/lib', '-L/lib64/'] + ['-Wl,--disable-new-dtags'] +
            test_wl_rpaths +
            ['-Wl,-rpath,xlib', '-Wl,-rpath,ylib', '-Wl,-rpath,zlib'] +
            ['-Wl,-rpath,/usr/lib64'] + test_args_without_paths)
Exemple #15
0
def test_ccache_prepend_for_cc():
    with set_env(SPACK_CCACHE_BINARY='ccache'):
        os.environ['SPACK_SHORT_SPEC'] = "[email protected]=linux-x86_64"
        check_args(
            cc, test_args,
            ['ccache'] +  # ccache prepended in cc mode
            [real_cc] +
            test_include_paths +
            test_library_paths +
            ['-Wl,--disable-new-dtags'] +
            test_wl_rpaths +
            test_args_without_paths)
        os.environ['SPACK_SHORT_SPEC'] = "[email protected]=darwin-x86_64"
        check_args(
            cc, test_args,
            ['ccache'] +  # ccache prepended in cc mode
            [real_cc] +
            lheaderpad +
            test_include_paths +
            test_library_paths +
            ['-Wl,--disable-new-dtags'] +
            test_wl_rpaths +
            test_args_without_paths)
Exemple #16
0
def test_ccld_deps(wrapper_environment):
    """Ensure all flags are added in ccld mode."""
    with set_env(SPACK_INCLUDE_DIRS='xinc:yinc:zinc',
                 SPACK_RPATH_DIRS='xlib:ylib:zlib',
                 SPACK_LINK_DIRS='xlib:ylib:zlib'):
        check_args(
            cc, test_args,
            [real_cc] +
            target_args +
            test_include_paths +
            ['-Ixinc',
             '-Iyinc',
             '-Izinc'] +
            test_library_paths +
            ['-Lxlib',
             '-Lylib',
             '-Lzlib'] +
            ['-Wl,--disable-new-dtags'] +
            test_wl_rpaths +
            ['-Wl,-rpath,xlib',
             '-Wl,-rpath,ylib',
             '-Wl,-rpath,zlib'] +
            test_args_without_paths)
Exemple #17
0
def test_ccld_with_system_dirs(dep1, dep2, dep3, dep4):
    """Ensure all flags are added in ccld mode."""
    deps = ':'.join((dep1, dep2, dep3, dep4))
    with set_env(SPACK_DEPENDENCIES=deps,
                 SPACK_RPATH_DEPS=deps,
                 SPACK_LINK_DEPS=deps):

        sys_path_args = [
            '-I/usr/include', '-L/usr/local/lib', '-Wl,-rpath,/usr/lib64',
            '-I/usr/local/include', '-L/lib64/'
        ]
        check_args(cc, sys_path_args + test_args,
                   [real_cc] + test_include_paths + [
                       '-I' + dep1 + '/include', '-I' + dep3 + '/include',
                       '-I' + dep4 + '/include'
                   ] + ['-I/usr/include', '-I/usr/local/include'] +
                   test_library_paths + [
                       '-L' + dep1 + '/lib', '-L' + dep2 + '/lib64',
                       '-L' + dep3 + '/lib64'
                   ] + ['-L/usr/local/lib', '-L/lib64/'] + test_wl_rpaths +
                   pkg_wl_rpaths + [
                       '-Wl,-rpath,' + dep1 + '/lib', '-Wl,-rpath,' + dep2 +
                       '/lib64', '-Wl,-rpath,' + dep3 + '/lib64'
                   ] + ['-Wl,-rpath,/usr/lib64'] + test_args_without_paths)
Exemple #18
0
def test_ld_deps_partial():
    """Make sure ld -r (partial link) is handled correctly on OS's where it
       doesn't accept rpaths.
    """
    with set_env(SPACK_INCLUDE_DIRS='xinc',
                 SPACK_RPATH_DIRS='xlib',
                 SPACK_LINK_DIRS='xlib'):
        # TODO: do we need to add RPATHs on other platforms like Linux?
        # TODO: Can't we treat them the same?
        os.environ['SPACK_SHORT_SPEC'] = "[email protected]=linux-x86_64"
        check_args(
            ld, ['-r'] + test_args,
            ['ld'] +
            test_include_paths +
            test_library_paths +
            ['-Lxlib'] +
            ['--disable-new-dtags'] +
            test_rpaths +
            ['-rpath', 'xlib'] +
            ['-r'] +
            test_args_without_paths)

        # rpaths from the underlying command will still appear
        # Spack will not add its own rpaths.
        os.environ['SPACK_SHORT_SPEC'] = "[email protected]=darwin-x86_64"
        check_args(
            ld, ['-r'] + test_args,
            ['ld'] +
            headerpad +
            test_include_paths +
            test_library_paths +
            ['-Lxlib'] +
            ['--disable-new-dtags'] +
            test_rpaths +
            ['-r'] +
            test_args_without_paths)
Exemple #19
0
def test_disable_new_dtags(wrapper_flags):
    with set_env(SPACK_TEST_COMMAND='dump-args'):
        result = ld(*test_args, output=str).strip().split('\n')
        assert '--disable-new-dtags' in result
        result = cc(*test_args, output=str).strip().split('\n')
        assert '-Wl,--disable-new-dtags' in result
Exemple #20
0
def test_dep_lib_no_lib():
    """Ensure a single dependency RPATH is added with no -L."""
    with set_env(SPACK_RPATH_DIRS='x'):
        check_args(cc, test_args, [real_cc] + test_include_paths +
                   test_library_paths + ['-Wl,--disable-new-dtags'] +
                   test_wl_rpaths + ['-Wl,-rpath,x'] + test_args_without_paths)
Exemple #21
0
def test_dep_lib_no_rpath():
    """Ensure a single dependency link flag is added with no dep RPATH."""
    with set_env(SPACK_LINK_DIRS='x'):
        check_args(cc, test_args, [real_cc] + test_include_paths +
                   test_library_paths + ['-Lx'] + ['-Wl,--disable-new-dtags'] +
                   test_wl_rpaths + test_args_without_paths)
Exemple #22
0
def test_dep_include():
    """Ensure a single dependency include directory is added."""
    with set_env(SPACK_INCLUDE_DIRS='x'):
        check_args(cc, test_args, [real_cc] + test_include_paths + ['-Ix'] +
                   test_library_paths + ['-Wl,--disable-new-dtags'] +
                   test_wl_rpaths + test_args_without_paths)
Exemple #23
0
def dump_mode(cc, args):
    """Make cc dump the mode it detects, and return it."""
    with set_env(SPACK_TEST_COMMAND='dump-mode'):
        return cc(*args, output=str).strip()
Exemple #24
0
def test_dep_lib():
    """Ensure a single dependency RPATH is added."""
    with set_env(SPACK_LINK_DIRS='x', SPACK_RPATH_DIRS='x'):
        check_args(cc, test_args, [real_cc] + test_include_paths +
                   test_library_paths + ['-Lx'] + test_wl_rpaths +
                   ['-Wl,-rpath,x'] + test_args_without_paths)
Exemple #25
0
def test_dep_lib_no_rpath(dep2):
    """Ensure a single dependency link flag is added with no dep RPATH."""
    with set_env(SPACK_DEPENDENCIES=dep2, SPACK_LINK_DEPS=dep2):
        check_args(cc, test_args, [real_cc] + test_include_paths +
                   test_library_paths + ['-L' + dep2 + '/lib64'] +
                   test_wl_rpaths + pkg_wl_rpaths + test_args_without_paths)
Exemple #26
0
def test_dep_lib_no_lib(dep2):
    """Ensure a single dependency RPATH is added with no -L."""
    with set_env(SPACK_DEPENDENCIES=dep2, SPACK_RPATH_DEPS=dep2):
        check_args(cc, test_args, [real_cc] + test_include_paths +
                   test_library_paths + test_wl_rpaths + pkg_wl_rpaths +
                   ['-Wl,-rpath,' + dep2 + '/lib64'] + test_args_without_paths)
Exemple #27
0
Fichier : cc.py Projet : LLNL/spack
def dump_mode(cc, args):
    """Make cc dump the mode it detects, and return it."""
    with set_env(SPACK_TEST_COMMAND='dump-mode'):
        return cc(*args, output=str).strip()