Skip to content

Commit

Permalink
Fix test that inadvertently used virtual crate
Browse files Browse the repository at this point in the history
It should have been real all along without alternatives
  • Loading branch information
mosteo committed Nov 15, 2023
1 parent cc5cb59 commit cf77d1b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
description = "A crate with no providers elsewhere"
name = "crate_non_virt"
version = "1.0.0"
maintainers = ["[email protected]"]
maintainers-logins = ["mylogin"]

[origin]
url = "file:../../../crates/libhello_1.0.0.tgz"
hashes = ["sha512:99fa3a55540d0655c87605b54af732f76a8a363015f183b06e98aa91e54c0e69397872718c5c16f436dd6de0fba506dc50c66d34a0e5c61fb63cb01fa22f35ac"]
8 changes: 5 additions & 3 deletions testsuite/tests/build/hashes/compiler-input/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
from drivers.builds import clear_builds_dir, hash_input
from drivers import builds

target_crate = "crate_non_virt"


def check_hash(signature: str) -> None:
"""
Check that the given signature is present in the hash inputs
"""
assert_match(f".*{signature}.*", hash_input("crate_real"))
assert_match(f".*{signature}.*", hash_input(target_crate))


# The first test is to check that the external compiler is used when no
Expand All @@ -25,7 +27,7 @@ def check_hash(signature: str) -> None:

# Init a crate without explicit compiler dependency
init_local_crate("xxx")
alr_with("crate_real") # A regular crate in the index
alr_with(target_crate) # A regular crate in the index
builds.sync() # Ensure the hash inputs are written to disk

# Check the external compiler is in the hash inputs
Expand All @@ -47,8 +49,8 @@ def check_hash(signature: str) -> None:
# Next, check with an explicit compiler in the dependencies. Note that we give
# the virtual dependency, but the actual native one is used for the hash.

clear_builds_dir()
alr_with("gnat=7777") # Downgrade the compiler with an explicit dependency
clear_builds_dir()
builds.sync()

# Check the expected compiler is in the hash inputs
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/solver/compiler-installed/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
# Check that requesting a version different to the one externally available
# results in a complete solution but with installation warning
alr_with("gnat", delete=True, manual=False)
p = run_alr("with", f"gnat/={version}", quiet=False, force=True)
p = run_alr("with", f"gnat/={version}", quiet=False)
assert_match(".*download of a toolchain not currently installed", p.out)
match_solution(f"gnat=8888.0.0 (gnat_native) (origin: binary_archive)",
escape=True)
Expand Down

0 comments on commit cf77d1b

Please sign in to comment.