def test_dep_spec_by_hash(self, database): mpileaks_zmpi = database.query_one('mpileaks ^zmpi') zmpi = database.query_one('zmpi') fake = database.query_one('fake') assert 'fake' in mpileaks_zmpi assert 'zmpi' in mpileaks_zmpi mpileaks_hash_fake = sp.Spec('mpileaks ^/' + fake.dag_hash()) assert 'fake' in mpileaks_hash_fake assert mpileaks_hash_fake['fake'] == fake mpileaks_hash_zmpi = sp.Spec('mpileaks %' + str(mpileaks_zmpi.compiler) + ' ^ / ' + zmpi.dag_hash()) assert 'zmpi' in mpileaks_hash_zmpi assert mpileaks_hash_zmpi['zmpi'] == zmpi assert mpileaks_hash_zmpi.compiler == mpileaks_zmpi.compiler mpileaks_hash_fake_and_zmpi = sp.Spec('mpileaks ^/' + fake.dag_hash()[:4] + '^ / ' + zmpi.dag_hash()[:5]) assert 'zmpi' in mpileaks_hash_fake_and_zmpi assert mpileaks_hash_fake_and_zmpi['zmpi'] == zmpi assert 'fake' in mpileaks_hash_fake_and_zmpi assert mpileaks_hash_fake_and_zmpi['fake'] == fake
def test_get_concrete_specs(config, mutable_mock_env_path, mock_packages): e = ev.create('test1') e.add('dyninst') e.concretize() dyninst_hash = None hash_dict = {} with e as active_env: for s in active_env.all_specs(): hash_dict[s.name] = s.build_hash() if s.name == 'dyninst': dyninst_hash = s.build_hash() assert (dyninst_hash) dep_builds = 'libdwarf;libelf' spec_map = ci.get_concrete_specs(active_env, dyninst_hash, 'dyninst', dep_builds, 'NONE') assert ('root' in spec_map and 'deps' in spec_map) concrete_root = spec_map['root'] assert (concrete_root.build_hash() == dyninst_hash) concrete_deps = spec_map['deps'] for key, obj in concrete_deps.items(): assert (obj.build_hash() == hash_dict[key]) s = spec.Spec('dyninst') print('nonconc spec name: {0}'.format(s.name)) spec_map = ci.get_concrete_specs(active_env, s.name, s.name, dep_builds, 'FIND_ANY') assert ('root' in spec_map and 'deps' in spec_map)
def test_get_concrete_specs(config, mutable_mock_env_path, mock_packages): e = ev.create('test1') e.add('dyninst') e.concretize() dyninst_hash = None hash_dict = {} with e as active_env: for s in active_env.all_specs(): hash_dict[s.name] = s.dag_hash() if s.name == 'dyninst': dyninst_hash = s.dag_hash() assert (dyninst_hash) spec_map = ci.get_concrete_specs(active_env, dyninst_hash, 'dyninst', 'NONE') assert 'root' in spec_map concrete_root = spec_map['root'] assert (concrete_root.dag_hash() == dyninst_hash) s = spec.Spec('dyninst') print('nonconc spec name: {0}'.format(s.name)) spec_map = ci.get_concrete_specs(active_env, s.name, s.name, 'FIND_ANY') assert 'root' in spec_map
def test_read_write_cdash_ids(config, tmp_scope, tmpdir, mock_packages): working_dir = tmpdir.join('working_dir') mirror_dir = working_dir.join('mirror') mirror_url = 'file://{0}'.format(mirror_dir.strpath) mirror_cmd = spack_main.SpackCommand('mirror') mirror_cmd('add', '--scope', tmp_scope, 'test_mirror', mirror_url) mock_spec = spec.Spec('archive-files').concretized() orig_cdashid = '42' ci.write_cdashid_to_mirror(orig_cdashid, mock_spec, mirror_url) # Now read it back read_cdashid = ci.read_cdashid_from_mirror(mock_spec, mirror_url) assert (str(read_cdashid) == orig_cdashid)
#!/usr/bin/env python import sys import spack.spec as s import spack.modules.tcl as t for package in sys.argv[1:]: tmp = s.Spec(package) tmp.concretize() print((t.TclModulefileWriter(tmp)).layout.use_name) print tmp.format("${prefix}")