From ffc91bd86ee6ff98a1307ddefb84a6b1783c96a9 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 31 Dec 2019 12:56:21 -0800 Subject: tests: move mock config.yaml files to common directory Test configuration files (except modules.yaml) were in the root level of test/data, but should really just be in their own directory. The absence of modules.yaml was also breaking module tests if we got module preferences after tests started, as the mock modules.yaml was not in the test directory. --- lib/spack/spack/test/conftest.py | 23 ++-- lib/spack/spack/test/data/compilers.yaml | 155 ------------------------ lib/spack/spack/test/data/config.yaml | 14 --- lib/spack/spack/test/data/config/compilers.yaml | 155 ++++++++++++++++++++++++ lib/spack/spack/test/data/config/config.yaml | 14 +++ lib/spack/spack/test/data/config/packages.yaml | 15 +++ lib/spack/spack/test/data/config/repos.yaml | 2 + lib/spack/spack/test/data/packages.yaml | 15 --- lib/spack/spack/test/data/repos.yaml | 2 - 9 files changed, 194 insertions(+), 201 deletions(-) delete mode 100644 lib/spack/spack/test/data/compilers.yaml delete mode 100644 lib/spack/spack/test/data/config.yaml create mode 100644 lib/spack/spack/test/data/config/compilers.yaml create mode 100644 lib/spack/spack/test/data/config/config.yaml create mode 100644 lib/spack/spack/test/data/config/packages.yaml create mode 100644 lib/spack/spack/test/data/config/repos.yaml delete mode 100644 lib/spack/spack/test/data/packages.yaml delete mode 100644 lib/spack/spack/test/data/repos.yaml (limited to 'lib') diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py index 572a38c225..7fb99a4147 100644 --- a/lib/spack/spack/test/conftest.py +++ b/lib/spack/spack/test/conftest.py @@ -363,23 +363,16 @@ def configuration_dir(tmpdir_factory, linux_os): """ tmpdir = tmpdir_factory.mktemp('configurations') - # Name of the yaml files in the test/data folder - test_path = py.path.local(spack.paths.test_path) - compilers_yaml = test_path.join('data', 'compilers.yaml') - packages_yaml = test_path.join('data', 'packages.yaml') - config_yaml = test_path.join('data', 'config.yaml') - repos_yaml = test_path.join('data', 'repos.yaml') - - # Create temporary 'site' and 'user' folders - tmpdir.ensure('site', dir=True) - tmpdir.ensure('user', dir=True) + # /data/config has mock config yaml files in it + # copy these to the site config. + test_config = py.path.local(spack.paths.test_path).join('data', 'config') + test_config.copy(tmpdir.join('site')) - # Copy the configurations that don't need further work - packages_yaml.copy(tmpdir.join('site', 'packages.yaml')) - config_yaml.copy(tmpdir.join('site', 'config.yaml')) - repos_yaml.copy(tmpdir.join('site', 'repos.yaml')) + # Create temporary 'defaults', 'site' and 'user' folders + tmpdir.ensure('user', dir=True) - # Write the one that needs modifications + # Slightly modify compilers.yaml to look like Linux + compilers_yaml = test_config.join('compilers.yaml') content = ''.join(compilers_yaml.read()).format(linux_os) t = tmpdir.join('site', 'compilers.yaml') t.write(content) diff --git a/lib/spack/spack/test/data/compilers.yaml b/lib/spack/spack/test/data/compilers.yaml deleted file mode 100644 index 7aec138473..0000000000 --- a/lib/spack/spack/test/data/compilers.yaml +++ /dev/null @@ -1,155 +0,0 @@ -compilers: -- compiler: - spec: clang@3.3 - operating_system: {0.name}{0.version} - paths: - cc: /path/to/clang - cxx: /path/to/clang++ - f77: None - fc: None - modules: 'None' -- compiler: - spec: gcc@4.5.0 - operating_system: {0.name}{0.version} - paths: - cc: /path/to/gcc - cxx: /path/to/g++ - f77: None - fc: None - modules: 'None' -- compiler: - spec: clang@3.3 - operating_system: CNL - paths: - cc: /path/to/clang - cxx: /path/to/clang++ - f77: None - fc: None - modules: 'None' -- compiler: - spec: clang@3.3 - operating_system: SuSE11 - paths: - cc: /path/to/clang - cxx: /path/to/clang++ - f77: None - fc: None - modules: 'None' -- compiler: - spec: clang@3.3 - operating_system: yosemite - paths: - cc: /path/to/clang - cxx: /path/to/clang++ - f77: None - fc: None - modules: 'None' -- compiler: - paths: - cc: /path/to/gcc - cxx: /path/to/g++ - f77: /path/to/gfortran - fc: /path/to/gfortran - operating_system: CNL - spec: gcc@4.5.0 - modules: 'None' -- compiler: - paths: - cc: /path/to/gcc - cxx: /path/to/g++ - f77: /path/to/gfortran - fc: /path/to/gfortran - operating_system: SuSE11 - spec: gcc@4.5.0 - modules: 'None' -- compiler: - paths: - cc: /path/to/gcc - cxx: /path/to/g++ - f77: /path/to/gfortran - fc: /path/to/gfortran - operating_system: yosemite - spec: gcc@4.5.0 - modules: 'None' -- compiler: - paths: - cc: /path/to/gcc - cxx: /path/to/g++ - f77: /path/to/gfortran - fc: /path/to/gfortran - operating_system: elcapitan - spec: gcc@4.5.0 - modules: 'None' -- compiler: - spec: clang@3.3 - operating_system: elcapitan - paths: - cc: /path/to/clang - cxx: /path/to/clang++ - f77: None - fc: None - modules: 'None' -- compiler: - spec: gcc@4.7.2 - operating_system: redhat6 - paths: - cc: /path/to/gcc472 - cxx: /path/to/g++472 - f77: /path/to/gfortran472 - fc: /path/to/gfortran472 - flags: - cflags: -O0 -g - cxxflags: -O0 -g - fflags: -O0 -g - modules: 'None' -- compiler: - spec: clang@3.5 - operating_system: redhat6 - paths: - cc: /path/to/clang35 - cxx: /path/to/clang++35 - f77: None - fc: None - flags: - cflags: -O3 - cxxflags: -O3 - modules: 'None' -- compiler: - spec: clang@8.0.0 - operating_system: redhat7 - paths: - cc: /path/to/clang-8 - cxx: /path/to/clang++-8 - f77: /path/to/gfortran-9 - fc: /path/to/gfortran-9 - flags: - cflags: -O3 - cxxflags: -O3 - modules: 'None' -- compiler: - spec: clang@9.1.0-apple - operating_system: elcapitan - paths: - cc: /path/to/clang - cxx: /path/to/clang++ - f77: None - fc: None - modules: 'None' -- compiler: - spec: gcc@foo - operating_system: redhat6 - paths: - cc: /path/to/gcc - cxx: /path/to/g++ - f77: /path/to/gfortran - fc: /path/to/gfortran - modules: 'None' -- compiler: - spec: gcc@4.4.0-special - operating_system: redhat6 - paths: - cc: /path/to/gcc - cxx: /path/to/g++ - f77: /path/to/gfortran - fc: /path/to/gfortran - modules: 'None' diff --git a/lib/spack/spack/test/data/config.yaml b/lib/spack/spack/test/data/config.yaml deleted file mode 100644 index 0611251189..0000000000 --- a/lib/spack/spack/test/data/config.yaml +++ /dev/null @@ -1,14 +0,0 @@ -config: - install_tree: $spack/opt/spack - template_dirs: - - $spack/share/spack/templates - - $spack/lib/spack/spack/test/data/templates - - $spack/lib/spack/spack/test/data/templates_again - build_stage: - - $tempdir/$user/spack-stage - - ~/.spack/stage - source_cache: $spack/var/spack/cache - misc_cache: ~/.spack/cache - verify_ssl: true - checksum: true - dirty: false diff --git a/lib/spack/spack/test/data/config/compilers.yaml b/lib/spack/spack/test/data/config/compilers.yaml new file mode 100644 index 0000000000..7aec138473 --- /dev/null +++ b/lib/spack/spack/test/data/config/compilers.yaml @@ -0,0 +1,155 @@ +compilers: +- compiler: + spec: clang@3.3 + operating_system: {0.name}{0.version} + paths: + cc: /path/to/clang + cxx: /path/to/clang++ + f77: None + fc: None + modules: 'None' +- compiler: + spec: gcc@4.5.0 + operating_system: {0.name}{0.version} + paths: + cc: /path/to/gcc + cxx: /path/to/g++ + f77: None + fc: None + modules: 'None' +- compiler: + spec: clang@3.3 + operating_system: CNL + paths: + cc: /path/to/clang + cxx: /path/to/clang++ + f77: None + fc: None + modules: 'None' +- compiler: + spec: clang@3.3 + operating_system: SuSE11 + paths: + cc: /path/to/clang + cxx: /path/to/clang++ + f77: None + fc: None + modules: 'None' +- compiler: + spec: clang@3.3 + operating_system: yosemite + paths: + cc: /path/to/clang + cxx: /path/to/clang++ + f77: None + fc: None + modules: 'None' +- compiler: + paths: + cc: /path/to/gcc + cxx: /path/to/g++ + f77: /path/to/gfortran + fc: /path/to/gfortran + operating_system: CNL + spec: gcc@4.5.0 + modules: 'None' +- compiler: + paths: + cc: /path/to/gcc + cxx: /path/to/g++ + f77: /path/to/gfortran + fc: /path/to/gfortran + operating_system: SuSE11 + spec: gcc@4.5.0 + modules: 'None' +- compiler: + paths: + cc: /path/to/gcc + cxx: /path/to/g++ + f77: /path/to/gfortran + fc: /path/to/gfortran + operating_system: yosemite + spec: gcc@4.5.0 + modules: 'None' +- compiler: + paths: + cc: /path/to/gcc + cxx: /path/to/g++ + f77: /path/to/gfortran + fc: /path/to/gfortran + operating_system: elcapitan + spec: gcc@4.5.0 + modules: 'None' +- compiler: + spec: clang@3.3 + operating_system: elcapitan + paths: + cc: /path/to/clang + cxx: /path/to/clang++ + f77: None + fc: None + modules: 'None' +- compiler: + spec: gcc@4.7.2 + operating_system: redhat6 + paths: + cc: /path/to/gcc472 + cxx: /path/to/g++472 + f77: /path/to/gfortran472 + fc: /path/to/gfortran472 + flags: + cflags: -O0 -g + cxxflags: -O0 -g + fflags: -O0 -g + modules: 'None' +- compiler: + spec: clang@3.5 + operating_system: redhat6 + paths: + cc: /path/to/clang35 + cxx: /path/to/clang++35 + f77: None + fc: None + flags: + cflags: -O3 + cxxflags: -O3 + modules: 'None' +- compiler: + spec: clang@8.0.0 + operating_system: redhat7 + paths: + cc: /path/to/clang-8 + cxx: /path/to/clang++-8 + f77: /path/to/gfortran-9 + fc: /path/to/gfortran-9 + flags: + cflags: -O3 + cxxflags: -O3 + modules: 'None' +- compiler: + spec: clang@9.1.0-apple + operating_system: elcapitan + paths: + cc: /path/to/clang + cxx: /path/to/clang++ + f77: None + fc: None + modules: 'None' +- compiler: + spec: gcc@foo + operating_system: redhat6 + paths: + cc: /path/to/gcc + cxx: /path/to/g++ + f77: /path/to/gfortran + fc: /path/to/gfortran + modules: 'None' +- compiler: + spec: gcc@4.4.0-special + operating_system: redhat6 + paths: + cc: /path/to/gcc + cxx: /path/to/g++ + f77: /path/to/gfortran + fc: /path/to/gfortran + modules: 'None' diff --git a/lib/spack/spack/test/data/config/config.yaml b/lib/spack/spack/test/data/config/config.yaml new file mode 100644 index 0000000000..0611251189 --- /dev/null +++ b/lib/spack/spack/test/data/config/config.yaml @@ -0,0 +1,14 @@ +config: + install_tree: $spack/opt/spack + template_dirs: + - $spack/share/spack/templates + - $spack/lib/spack/spack/test/data/templates + - $spack/lib/spack/spack/test/data/templates_again + build_stage: + - $tempdir/$user/spack-stage + - ~/.spack/stage + source_cache: $spack/var/spack/cache + misc_cache: ~/.spack/cache + verify_ssl: true + checksum: true + dirty: false diff --git a/lib/spack/spack/test/data/config/packages.yaml b/lib/spack/spack/test/data/config/packages.yaml new file mode 100644 index 0000000000..c7256ddb33 --- /dev/null +++ b/lib/spack/spack/test/data/config/packages.yaml @@ -0,0 +1,15 @@ +packages: + externaltool: + buildable: False + paths: + externaltool@1.0%gcc@4.5.0: /path/to/external_tool + externaltool@0.9%gcc@4.5.0: /usr + externalvirtual: + buildable: False + paths: + externalvirtual@2.0%clang@3.3: /path/to/external_virtual_clang + externalvirtual@1.0%gcc@4.5.0: /path/to/external_virtual_gcc + externalmodule: + buildable: False + modules: + externalmodule@1.0%gcc@4.5.0: external-module diff --git a/lib/spack/spack/test/data/config/repos.yaml b/lib/spack/spack/test/data/config/repos.yaml new file mode 100644 index 0000000000..4fbbfe9d62 --- /dev/null +++ b/lib/spack/spack/test/data/config/repos.yaml @@ -0,0 +1,2 @@ +repos: + - $spack/var/spack/repos/builtin diff --git a/lib/spack/spack/test/data/packages.yaml b/lib/spack/spack/test/data/packages.yaml deleted file mode 100644 index c7256ddb33..0000000000 --- a/lib/spack/spack/test/data/packages.yaml +++ /dev/null @@ -1,15 +0,0 @@ -packages: - externaltool: - buildable: False - paths: - externaltool@1.0%gcc@4.5.0: /path/to/external_tool - externaltool@0.9%gcc@4.5.0: /usr - externalvirtual: - buildable: False - paths: - externalvirtual@2.0%clang@3.3: /path/to/external_virtual_clang - externalvirtual@1.0%gcc@4.5.0: /path/to/external_virtual_gcc - externalmodule: - buildable: False - modules: - externalmodule@1.0%gcc@4.5.0: external-module diff --git a/lib/spack/spack/test/data/repos.yaml b/lib/spack/spack/test/data/repos.yaml deleted file mode 100644 index 4fbbfe9d62..0000000000 --- a/lib/spack/spack/test/data/repos.yaml +++ /dev/null @@ -1,2 +0,0 @@ -repos: - - $spack/var/spack/repos/builtin -- cgit v1.2.3-70-g09d2