def test_external_entries_in_db(database): rec = database.get_record('mpileaks ^zmpi') assert rec.spec.external_path is None assert rec.spec.external_module is None rec = database.get_record('externaltool') assert rec.spec.external_path == '/path/to/external_tool' assert rec.spec.external_module is None assert rec.explicit is False rec.spec.package.do_install(fake=True, explicit=True) rec = database.get_record('externaltool') assert rec.spec.external_path == '/path/to/external_tool' assert rec.spec.external_module is None assert rec.explicit is True
def test_090_non_root_ref_counts(database): database.get_record('mpileaks ^mpich') database.get_record('callpath ^mpich') # "force remove" a non-root spec from the DB database.remove('callpath ^mpich') # record still in DB but marked uninstalled assert database.query('callpath ^mpich', installed=True) == [] assert len(database.query('callpath ^mpich', installed=any)) == 1 # record and its deps have same ref_counts assert database.get_record( 'callpath ^mpich', installed=any ).ref_count == 1 assert database.get_record('mpich').ref_count == 2 # remove only dependent of uninstalled callpath record database.remove('mpileaks ^mpich') # record and parent are completely gone. assert database.query('mpileaks ^mpich', installed=any) == [] assert database.query('callpath ^mpich', installed=any) == [] # mpich ref count updated properly. mpich_rec = database.get_record('mpich') assert mpich_rec.ref_count == 0
def test_080_root_ref_counts(database): rec = database.get_record('mpileaks ^mpich') # Remove a top-level spec from the DB database.remove('mpileaks ^mpich') # record no longer in DB assert database.query('mpileaks ^mpich', installed=any) == [] # record's deps have updated ref_counts assert database.get_record('callpath ^mpich').ref_count == 0 assert database.get_record('mpich').ref_count == 1 # Put the spec back database.add(rec.spec, spack.store.layout) # record is present again assert len(database.query('mpileaks ^mpich', installed=any)) == 1 # dependencies have ref counts updated assert database.get_record('callpath ^mpich').ref_count == 1 assert database.get_record('mpich').ref_count == 2
def test_default_queries(database): # Testing a package whose name *doesn't* start with 'lib' # to ensure the library has 'lib' prepended to the name rec = database.get_record('zmpi') spec = rec.spec libraries = spec['zmpi'].libs assert len(libraries) == 1 assert libraries.names[0] == 'zmpi' headers = spec['zmpi'].headers assert len(headers) == 1 assert headers.names[0] == 'zmpi' command = spec['zmpi'].command assert isinstance(command, Executable) assert command.name == 'zmpi' assert os.path.exists(command.path) # Testing a package whose name *does* start with 'lib' # to ensure the library doesn't have a double 'lib' prefix rec = database.get_record('libelf') spec = rec.spec libraries = spec['libelf'].libs assert len(libraries) == 1 assert libraries.names[0] == 'elf' headers = spec['libelf'].headers assert len(headers) == 1 assert headers.names[0] == 'libelf' command = spec['libelf'].command assert isinstance(command, Executable) assert command.name == 'libelf' assert os.path.exists(command.path)