aboutsummaryrefslogtreecommitdiff
path: root/run_project_tests.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2021-06-22 22:59:16 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2021-06-29 11:28:08 +0200
commit3e396b3782813d36d46195564cd0e111422bcaf5 (patch)
treef315e990f71984745fcb8f22dac2f0e400fecadb /run_project_tests.py
parent28175bbee2c111cf41b80c97bbadd7dbabaa8990 (diff)
downloadmeson-3e396b3782813d36d46195564cd0e111422bcaf5.zip
meson-3e396b3782813d36d46195564cd0e111422bcaf5.tar.gz
meson-3e396b3782813d36d46195564cd0e111422bcaf5.tar.bz2
fix: Always explicitly set encoding for text files (fixes #8263)
Diffstat (limited to 'run_project_tests.py')
-rwxr-xr-xrun_project_tests.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/run_project_tests.py b/run_project_tests.py
index fcd856f..7631b84 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -522,7 +522,7 @@ def run_test_inprocess(testdir: str) -> T.Tuple[int, str, str, str]:
try:
returncode_test = mtest.run_with_args(['--no-rebuild'])
if test_log_fname.exists():
- test_log = test_log_fname.open(errors='ignore').read()
+ test_log = test_log_fname.open(encoding='utf-8', errors='ignore').read()
else:
test_log = ''
returncode_benchmark = mtest.run_with_args(['--no-rebuild', '--benchmark', '--logbase', 'benchmarklog'])
@@ -736,7 +736,7 @@ def load_test_json(t: TestDef, stdout_mandatory: bool) -> T.List[TestDef]:
test_def = {}
test_def_file = t.path / 'test.json'
if test_def_file.is_file():
- test_def = json.loads(test_def_file.read_text())
+ test_def = json.loads(test_def_file.read_text(encoding='utf-8'))
# Handle additional environment variables
env = {} # type: T.Dict[str, str]
@@ -1022,18 +1022,17 @@ def skip_csharp(backend: Backend) -> bool:
# on all compilation attempts.
def has_broken_rustc() -> bool:
- dirname = 'brokenrusttest'
- if os.path.exists(dirname):
- mesonlib.windows_proof_rmtree(dirname)
- os.mkdir(dirname)
- open(dirname + '/sanity.rs', 'w').write('''fn main() {
-}
-''')
+ dirname = Path('brokenrusttest')
+ if dirname.exists():
+ mesonlib.windows_proof_rmtree(dirname.as_posix())
+ dirname.mkdir()
+ sanity_file = dirname / 'sanity.rs'
+ sanity_file.write_text('fn main() {\n}\n', encoding='utf-8')
pc = subprocess.run(['rustc', '-o', 'sanity.exe', 'sanity.rs'],
- cwd=dirname,
+ cwd=dirname.as_posix(),
stdout = subprocess.DEVNULL,
stderr = subprocess.DEVNULL)
- mesonlib.windows_proof_rmtree(dirname)
+ mesonlib.windows_proof_rmtree(dirname.as_posix())
return pc.returncode != 0
def should_skip_rust(backend: Backend) -> bool: