From 7d3c51b202744e053bc414e5c7ec7fe8c9e52186 Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Sun, 10 Sep 2023 22:53:32 +0200 Subject: [PATCH] Self-review --- testsuite/drivers/helpers.py | 6 ++++++ testsuite/tests/config/shared-deps/test.py | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/testsuite/drivers/helpers.py b/testsuite/drivers/helpers.py index a7813bcb6..6b3c04bb6 100644 --- a/testsuite/drivers/helpers.py +++ b/testsuite/drivers/helpers.py @@ -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 diff --git a/testsuite/tests/config/shared-deps/test.py b/testsuite/tests/config/shared-deps/test.py index ce247dc90..9adf1a9df 100644 --- a/testsuite/tests/config/shared-deps/test.py +++ b/testsuite/tests/config/shared-deps/test.py @@ -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: @@ -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())