Skip to content

Commit

Permalink
Test for fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Sep 2, 2024
1 parent 8b99353 commit d674714
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 10 deletions.
2 changes: 1 addition & 1 deletion alire.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ commit = "56bbdc008e16996b6f76e443fd0165a240de1b13"

[pins.den]
url = "https://github.com/mosteo/den"
commit = "35d1f38395b93766dd64bca5901ce3b6a416ba1a"
commit = "681ab5ca522585953f2e1d70763731df34c96012"

[pins.dirty_booleans]
url = "https://github.com/mosteo/dirty_booleans"
Expand Down
2 changes: 1 addition & 1 deletion deps/den
11 changes: 3 additions & 8 deletions testsuite/drivers/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,9 @@ def sync() -> None:
"""
Sync the shared build directory
"""
# We force the sync by running a build, no matter if it succeeds or not
try:
subprocess.run(["alr", "-q", "-d", "build"]
, stdout=subprocess.DEVNULL
, stderr=subprocess.DEVNULL
)
except:
pass
run_alr("build", "--stop-after=generation")
return


def sync_builds() -> None:
sync()
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description = "Example crate"
name = "crate"
version = "0.1.0"
licenses = "GPL-3.0-only"
maintainers = ["[email protected]"]
maintainers-logins = ["mylogin"]
executables=['main']

[origin]
url = "file:../../../crate-0.1.0.tgz"
hashes = ["sha256:e246305107429e936610677bf5244d69510341a7df47cfce9e2278c4ad7da947"]
1 change: 1 addition & 0 deletions testsuite/tests/cache/softlinks/my_index/index/index.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version = "1.1"
60 changes: 60 additions & 0 deletions testsuite/tests/cache/softlinks/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
"""
Test proper syncing of softlinks, even bad ones
This test is Unix-only, as Windows' tar cannot recreate the broken links:
crate-0.1.0
└── crate
├── bin -> subdir/bin
├── broken -> missing
├── lib
│ ├── mock.so -> mock.so.0.0
│ ├── mock.so.0 -> mock.so.0.0
│ ├── mock.so.0.0
│ ├── zzz.so -> mock.so
│ └── zzz.so.0 -> mock.so
├── loop
│ ├── x -> z
│ ├── y -> x
│ └── z -> y
├── order
│ ├── ab -> b
│ ├── af -> d/f
│ ├── b
│ ├── cb -> b
│ ├── d
│ │ └── f
│ └── zf -> d/f
├── self -> self
├── subdir
│ ├── bin
│ │ ├── loop -> ../../subdir
│ │ └── x
│ ├── parent -> ..
│ └── self -> ../subdir
├── that -> this
└── this -> that
"""

import os
import shutil
import drivers.builds as builds
from drivers.alr import alr_with, init_local_crate, run_alr


init_local_crate()

# Make the crate depend on our troublesome crate and ensure syncing
alr_with("crate")
builds.sync()

# Ensure that a copy has been made to the cache
if builds.are_shared():
assert os.path.exists(builds.find_dir("crate"))

# Cleanup
os.chdir("..")
shutil.rmtree("xxx")

print('SUCCESS')
8 changes: 8 additions & 0 deletions testsuite/tests/cache/softlinks/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
driver: python-script
build_mode: both
control:
- [SKIP, "skip_unix", "Test is Unix-only"]
indexes:
my_index:
in_fixtures: false
compiler_only_index: {}

0 comments on commit d674714

Please sign in to comment.