From 0938ac8480652e5aa1a543e673d53f49f39dcbeb Mon Sep 17 00:00:00 2001 From: Eric Miotto <1094986+edymtt@users.noreply.github.com> Date: Tue, 30 Mar 2021 22:04:35 +0000 Subject: [PATCH 1/3] [py3] Ensure we are using text streams --- test-snapshot-binaries/linux_load_commands.py | 2 +- test-sourcekit-lsp/test-sourcekit-lsp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test-snapshot-binaries/linux_load_commands.py b/test-snapshot-binaries/linux_load_commands.py index f7d044e..594d388 100644 --- a/test-snapshot-binaries/linux_load_commands.py +++ b/test-snapshot-binaries/linux_load_commands.py @@ -143,7 +143,7 @@ def get_libraries(package_path): "-iname", "*.so" ] - return subprocess.check_output(cmd).split("\n")[:-1] + return subprocess.check_output(cmd, text=True).split("\n")[:-1] def main(): parser = argparse.ArgumentParser() diff --git a/test-sourcekit-lsp/test-sourcekit-lsp.py b/test-sourcekit-lsp/test-sourcekit-lsp.py index 72c9e17..dbad35d 100644 --- a/test-sourcekit-lsp/test-sourcekit-lsp.py +++ b/test-sourcekit-lsp/test-sourcekit-lsp.py @@ -136,7 +136,7 @@ def main(): print('==== OUTPUT ====') skargs = [args.sourcekit_lsp, '--sync', '-Xclangd', '-sync'] - p = subprocess.Popen(skargs, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + p = subprocess.Popen(skargs, stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) out, _ = p.communicate(lsp.script) print(out) print('') From 5403dd5e5b16d40fcd08f09c0ea4cb17fbc499a3 Mon Sep 17 00:00:00 2001 From: Eric Miotto <1094986+edymtt@users.noreply.github.com> Date: Tue, 30 Mar 2021 23:39:30 +0000 Subject: [PATCH 2/3] Use python3 for litTest --- litTest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litTest b/litTest index 2d7b9ba..5a8dacb 100755 --- a/litTest +++ b/litTest @@ -3,4 +3,4 @@ set -ex # Delegate to lit to actually test. -python ../llvm-project/llvm/utils/lit/lit.py -sv "$@" +python3 ../llvm-project/llvm/utils/lit/lit.py -sv "$@" From bd2ee23ae9b272ddaba6519fb8dd170333d73c64 Mon Sep 17 00:00:00 2001 From: Eric Miotto <1094986+edymtt@users.noreply.github.com> Date: Tue, 30 Mar 2021 23:59:09 +0000 Subject: [PATCH 3/3] Use universal_newlines instead of text to be compatible with Python 3.5 --- test-snapshot-binaries/linux_load_commands.py | 2 +- test-sourcekit-lsp/test-sourcekit-lsp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test-snapshot-binaries/linux_load_commands.py b/test-snapshot-binaries/linux_load_commands.py index 594d388..6f7f8ca 100644 --- a/test-snapshot-binaries/linux_load_commands.py +++ b/test-snapshot-binaries/linux_load_commands.py @@ -143,7 +143,7 @@ def get_libraries(package_path): "-iname", "*.so" ] - return subprocess.check_output(cmd, text=True).split("\n")[:-1] + return subprocess.check_output(cmd, universal_newlines=True).split("\n")[:-1] def main(): parser = argparse.ArgumentParser() diff --git a/test-sourcekit-lsp/test-sourcekit-lsp.py b/test-sourcekit-lsp/test-sourcekit-lsp.py index dbad35d..1b1d37e 100644 --- a/test-sourcekit-lsp/test-sourcekit-lsp.py +++ b/test-sourcekit-lsp/test-sourcekit-lsp.py @@ -136,7 +136,7 @@ def main(): print('==== OUTPUT ====') skargs = [args.sourcekit_lsp, '--sync', '-Xclangd', '-sync'] - p = subprocess.Popen(skargs, stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) + p = subprocess.Popen(skargs, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True) out, _ = p.communicate(lsp.script) print(out) print('')