From 0461026b85ee79371c2f6e2e98f013a8b05ad48a Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Sun, 12 Nov 2023 15:14:02 +0100 Subject: [PATCH] New test --- .../gp/gprbuild/gprbuild-external.toml | 11 ++++++++ .../solver/unsatisfying-external/test.py | 25 +++++++++++++++++++ .../solver/unsatisfying-external/test.yaml | 4 +++ 3 files changed, 40 insertions(+) create mode 100644 testsuite/fixtures/compiler_only_index/gp/gprbuild/gprbuild-external.toml create mode 100644 testsuite/tests/solver/unsatisfying-external/test.py create mode 100644 testsuite/tests/solver/unsatisfying-external/test.yaml diff --git a/testsuite/fixtures/compiler_only_index/gp/gprbuild/gprbuild-external.toml b/testsuite/fixtures/compiler_only_index/gp/gprbuild/gprbuild-external.toml new file mode 100644 index 000000000..dfc7bb3a7 --- /dev/null +++ b/testsuite/fixtures/compiler_only_index/gp/gprbuild/gprbuild-external.toml @@ -0,0 +1,11 @@ +description = "Fake gprbuild external" +name = "gprbuild" + +maintainers = ["alejandro@mosteo.com"] +maintainers-logins = ["mosteo"] + +[[external]] +kind = "version-output" +# We look for make instead, that should be always installed. +version-command = ["make", "--version"] +version-regexp = ".*Make ([\\d\\.]+).*" diff --git a/testsuite/tests/solver/unsatisfying-external/test.py b/testsuite/tests/solver/unsatisfying-external/test.py new file mode 100644 index 000000000..922165a78 --- /dev/null +++ b/testsuite/tests/solver/unsatisfying-external/test.py @@ -0,0 +1,25 @@ +""" +When an external compiler is explicitly configured, no other compiler will be +attempted to be added to the solution. This may be counterintuitive, so we emit +an special warning in this case. +""" + +from drivers.alr import run_alr, init_local_crate +from drivers.asserts import assert_match + + +init_local_crate() + +# Select the external compiler +run_alr("toolchain", "--select", "gnat_external", "gprbuild") + +# Add a different version to the solution +p = run_alr("with", "gnat^9999", force=True, quiet=False) + +# Check that the warning is emitted +assert_match(".*The explicitly configured external compiler gnat_external=.*" + "cannot satisfy dependency in solution gnat\^9999", + p.out) + + +print("SUCCESS") diff --git a/testsuite/tests/solver/unsatisfying-external/test.yaml b/testsuite/tests/solver/unsatisfying-external/test.yaml new file mode 100644 index 000000000..88f746961 --- /dev/null +++ b/testsuite/tests/solver/unsatisfying-external/test.yaml @@ -0,0 +1,4 @@ +driver: python-script +build_mode: both +indexes: + compiler_only_index: {} \ No newline at end of file