blob: bfb041b2729f54fa4d5643f7741479bd218c3a16 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import os.path
import platform
import pytest
import spack.architecture as architecture
import spack.config
from spack.main import SpackCommand, get_version
from spack.util.executable import which
debug = SpackCommand('debug')
@pytest.mark.db
def test_create_db_tarball(tmpdir, database):
with tmpdir.as_cwd():
debug('create-db-tarball')
# get the first non-dotfile to avoid coverage files in the directory
files = os.listdir(os.getcwd())
tarball_name = next(f for f in files if not f.startswith('.'))
# debug command made an archive
assert os.path.exists(tarball_name)
# print contents of archive
tar = which('tar')
contents = tar('tzf', tarball_name, output=str)
# DB file is included
assert 'index.json' in contents
# specfiles from all installs are included
for spec in database.query():
# externals won't have a specfile
if spec.external:
continue
spec_suffix = '%s/.spack/spec.json' % spec.dag_hash()
assert spec_suffix in contents
def test_report():
out = debug('report')
arch = architecture.Arch(architecture.platform(), 'frontend', 'frontend')
assert get_version() in out
assert platform.python_version() in out
assert str(arch) in out
assert spack.config.get('config:concretizer') in out
|