From f764029b0a5e79beacf8e2a5894dc69f3f99421b Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Tue, 12 Nov 2024 13:03:25 +0100 Subject: [PATCH] unit-tests: remove a few FIXMEs --- lib/spack/spack/test/concretization/core.py | 18 ---------- lib/spack/spack/test/package_class.py | 8 ++--- lib/spack/spack/test/provider_index.py | 3 -- lib/spack/spack/test/spec_semantics.py | 37 ++++++++++----------- 4 files changed, 20 insertions(+), 46 deletions(-) diff --git a/lib/spack/spack/test/concretization/core.py b/lib/spack/spack/test/concretization/core.py index 08d7f63f709..e533a2d1989 100644 --- a/lib/spack/spack/test/concretization/core.py +++ b/lib/spack/spack/test/concretization/core.py @@ -400,24 +400,6 @@ def test_spec_flags_maintain_order(self, mutable_config, gcc11_with_flags): s.compiler_flags[x] == ["-O0", "-g"] for x in ("cflags", "cxxflags", "fflags") ) - # FIXME (compiler as nodes): revisit this test - # def test_compiler_flags_differ_identical_compilers(self, mutable_config, clang12_with_flags): - # mutable_config.set("compilers", [clang12_with_flags]) - # # Correct arch to use test compiler that has flags - # spec = Spec("pkg-a %clang@12.2.0 platform=test os=fe target=fe") - # - # # Get the compiler that matches the spec ( - # compiler = spack.compilers.config.compiler_for_spec("clang@=12.2.0", spec.architecture) - # - # # Configure spack to have two identical compilers with different flags - # default_dict = spack.compilers.config._to_dict(compiler) - # different_dict = copy.deepcopy(default_dict) - # different_dict["compiler"]["flags"] = {"cflags": "-O2"} - # - # with spack.config.override("compilers", [different_dict]): - # spec.concretize() - # assert spec.satisfies("cflags=-O2") - @pytest.mark.parametrize( "spec_str,expected,not_expected", [ diff --git a/lib/spack/spack/test/package_class.py b/lib/spack/spack/test/package_class.py index 19e1e1d239a..0cefd69d05e 100644 --- a/lib/spack/spack/test/package_class.py +++ b/lib/spack/spack/test/package_class.py @@ -287,11 +287,9 @@ def test_package_fetcher_fails(): def test_package_test_no_compilers(mock_packages, monkeypatch, capfd): - def compilers(compiler, arch_spec): - return None - - monkeypatch.setattr(spack.compilers.config, "compilers_for_spec", compilers) - + """Ensures that a test which needs the compiler, and build dependencies, to run, is skipped + if no compiler is available. + """ s = spack.spec.Spec("pkg-a") pkg = BaseTestPackage(s) pkg.test_requires_compiler = True diff --git a/lib/spack/spack/test/provider_index.py b/lib/spack/spack/test/provider_index.py index 3a9dec095ee..9bc2298ce50 100644 --- a/lib/spack/spack/test/provider_index.py +++ b/lib/spack/spack/test/provider_index.py @@ -20,14 +20,11 @@ """ import io -import pytest - import spack.repo from spack.provider_index import ProviderIndex from spack.spec import Spec -@pytest.mark.xfail(reason="FIXME (compiler as nodes): revisit this test") def test_provider_index_round_trip(mock_packages): p = ProviderIndex(specs=spack.repo.all_package_names(), repository=spack.repo.PATH) diff --git a/lib/spack/spack/test/spec_semantics.py b/lib/spack/spack/test/spec_semantics.py index 98d5abe158b..4556557613d 100644 --- a/lib/spack/spack/test/spec_semantics.py +++ b/lib/spack/spack/test/spec_semantics.py @@ -858,21 +858,18 @@ def test_spec_formatting(self, default_mock_concretization): package_segments = [ ("{NAME}", "", "name", lambda spec: spec), ("{VERSION}", "", "version", lambda spec: spec), - # FIXME (compiler as nodes): recover this semantic - # ("{compiler}", "", "compiler", lambda spec: spec), + ("{compiler}", "", "compiler", lambda spec: spec), ("{compiler_flags}", "", "compiler_flags", lambda spec: spec), ("{variants}", "", "variants", lambda spec: spec), ("{architecture}", "", "architecture", lambda spec: spec), ("{@VERSIONS}", "@", "versions", lambda spec: spec), - # FIXME (compiler as nodes): recover this semantic - # ("{%compiler}", "%", "compiler", lambda spec: spec), + ("{%compiler}", "%", "compiler", lambda spec: spec), ("{arch=architecture}", "arch=", "architecture", lambda spec: spec), ("{namespace=namespace}", "namespace=", "namespace", lambda spec: spec), - # FIXME (compiler as nodes): recover this semantic - # ("{compiler.name}", "", "name", lambda spec: spec.compiler), - # ("{compiler.version}", "", "version", lambda spec: spec.compiler), - # ("{%compiler.name}", "%", "name", lambda spec: spec.compiler), - # ("{@compiler.version}", "@", "version", lambda spec: spec.compiler), + ("{compiler.name}", "", "name", lambda spec: spec.compiler), + ("{compiler.version}", "", "version", lambda spec: spec.compiler), + ("{%compiler.name}", "%", "name", lambda spec: spec.compiler), + ("{@compiler.version}", "@", "version", lambda spec: spec.compiler), ("{architecture.platform}", "", "platform", lambda spec: spec.architecture), ("{architecture.os}", "", "os", lambda spec: spec.architecture), ("{architecture.target}", "", "target", lambda spec: spec.architecture), @@ -1512,17 +1509,17 @@ def test_unsatisfiable_virtual_deps_bindings(self, spec_str): ("git-test@git.foo/bar", "{name}-{version}", str(pathlib.Path("git-test-git.foo_bar"))), ("git-test@git.foo/bar", "{name}-{version}-{/hash}", None), ("git-test@git.foo/bar", "{name}/{version}", str(pathlib.Path("git-test", "git.foo_bar"))), - # FIXME (compiler as nodes): revisit these tests - # ( - # "git-test@{0}=1.0%gcc".format("a" * 40), - # "{name}/{version}/{compiler}", - # str(pathlib.Path("git-test", "{0}_1.0".format("a" * 40), "gcc")), - # ), - # ( - # "git-test@git.foo/bar=1.0%gcc", - # "{name}/{version}/{compiler}", - # str(pathlib.Path("git-test", "git.foo_bar_1.0", "gcc")), - # ), + # {compiler} is 'none' if a package does not depend on C, C++, or Fortran + ( + f"git-test@{'a' * 40}=1.0%gcc", + "{name}/{version}/{compiler}", + str(pathlib.Path("git-test", f"{'a' * 40}_1.0", "none")), + ), + ( + "git-test@git.foo/bar=1.0%gcc", + "{name}/{version}/{compiler}", + str(pathlib.Path("git-test", "git.foo_bar_1.0", "none")), + ), ], ) def test_spec_format_path(spec_str, format_str, expected, mock_git_test_package):