diff options
author | John W. Parent <45471568+johnwparent@users.noreply.github.com> | 2022-12-09 08:27:46 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-09 13:27:46 +0000 |
commit | 0e69710f417dce418ca1e3b54ff448493b102c06 (patch) | |
tree | 6858421b0088c8fd158e6425c79c98fc19fc4af3 /lib/spack/llnl | |
parent | ec62150ed7e8c26eff322ffa66f0e7b4c8409734 (diff) | |
download | spack-0e69710f417dce418ca1e3b54ff448493b102c06.tar.gz spack-0e69710f417dce418ca1e3b54ff448493b102c06.tar.bz2 spack-0e69710f417dce418ca1e3b54ff448493b102c06.tar.xz spack-0e69710f417dce418ca1e3b54ff448493b102c06.zip |
Windows: reenable unit tests (#33385)
Unit tests on Windows are supposed to pass for any PR to pass CI.
However, the return code for the unit test command was not being
checked, which meant this check was always passing (effectively
disabled). This PR
* Properly checks the result of the unit tests and fails if the
unit tests fail
* Fixes (or disables on Windows) a number of tests which have
"drifted" out of support on Windows since this check was
effectively disabled
Diffstat (limited to 'lib/spack/llnl')
-rw-r--r-- | lib/spack/llnl/util/filesystem.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index 388c6fd173..8e664cc0a9 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -99,7 +99,9 @@ def getuid(): def rename(src, dst): # On Windows, os.rename will fail if the destination file already exists if is_windows: - if os.path.exists(dst): + # Windows path existence checks will sometimes fail on junctions/links/symlinks + # so check for that case + if os.path.exists(dst) or os.path.islink(dst): os.remove(dst) os.rename(src, dst) @@ -288,7 +290,10 @@ def filter_file(regex, repl, *filenames, **kwargs): shutil.copy(filename, tmp_filename) try: - extra_kwargs = {"errors": "surrogateescape"} + # To avoid translating line endings (\n to \r\n and vis versa) + # we force os.open to ignore translations and use the line endings + # the file comes with + extra_kwargs = {"errors": "surrogateescape", "newline": ""} # Open as a text file and filter until the end of the file is # reached or we found a marker in the line if it was specified |