Skip to content

Commit

Permalink
Self-review
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Sep 10, 2023
1 parent 010beab commit 7d3c51b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions testsuite/drivers/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ def replace_in_file(filename : str, old : str, new : str):
file.write(old_contents.replace(old, new))


def neutral_path(path : str) -> str:
"""
Return a path with all separators replaced by '/'.
"""
return path.replace('\\', '/')

class FileLock():
"""
A filesystem-level lock for tests executed from different threads but
Expand Down
11 changes: 6 additions & 5 deletions testsuite/tests/config/shared-deps/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from drivers.alr import (alr_builds_dir, alr_vault_dir, alr_with,
alr_workspace_cache, init_local_crate, run_alr)
from drivers.asserts import assert_contents, assert_file_exists
from drivers.helpers import contents, lines_of
from drivers.helpers import contents, lines_of, neutral_path


def check_in(file : str, expected : str) -> bool:
Expand Down Expand Up @@ -52,10 +52,11 @@ def check_in(file : str, expected : str) -> bool:
base = builds.find_dir("hello_1.0.1_filesystem")

# There's too much object files and the like, check a few critical files:
files = contents(base)
check_in(f'{base}/config/hello_config.ads', files) # config wa generated
check_in(f'{base}/alire/flags/post_fetch_done', files) # actions were run
check_in(f'{base}/obj/b__hello.ads', files) # build took place
files = contents(base) # This returns "normalized" paths (with '/' separators)
nbase = neutral_path(base)
check_in(f'{nbase}/config/hello_config.ads', files) # config was generated
check_in(f'{nbase}/alire/flags/post_fetch_done', files) # actions were run
check_in(f'{nbase}/obj/b__hello.ads', files) # build took place

# And that the crate usual cache dir doesn't exist
assert not os.path.exists(alr_workspace_cache())
Expand Down

0 comments on commit 7d3c51b

Please sign in to comment.