|
10 | 10 | from fnmatch import fnmatch
|
11 | 11 | from time import sleep
|
12 | 12 | from shutil import which
|
13 |
| -from e3.os.process import Run, STDOUT |
| 13 | +import subprocess |
14 | 14 | from test_util import sort_key_for_errors
|
15 | 15 |
|
16 | 16 |
|
|
54 | 54 | is_mark = re.compile(r"@(\w*):(\w*)")
|
55 | 55 |
|
56 | 56 |
|
| 57 | +def Run(command): |
| 58 | + result = subprocess.run( |
| 59 | + command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True |
| 60 | + ) |
| 61 | + return result |
| 62 | + |
| 63 | + |
57 | 64 | def benchmark_mode():
|
58 | 65 | if "benchmark" in os.environ:
|
59 | 66 | return os.environ["benchmark"]
|
@@ -732,15 +739,15 @@ def gcc(src, opt=None):
|
732 | 739 | cmd += to_list(opt)
|
733 | 740 | cmd += [src]
|
734 | 741 | process = Run(cmd)
|
735 |
| - print_sorted(str.splitlines(process.out)) |
| 742 | + print_sorted(str.splitlines(process.stdout)) |
736 | 743 |
|
737 | 744 |
|
738 | 745 | def gprbuild(opt=None, sort_lines=True):
|
739 | 746 | """Call gprbuld -q **opt. Sort the output if sort_lines is True."""
|
740 | 747 | if opt is None:
|
741 | 748 | opt = []
|
742 |
| - process = Run(["gprbuild", "-q"] + opt, error=STDOUT) |
743 |
| - lines = str.splitlines(process.out) |
| 749 | + process = Run(["gprbuild", "-q"] + opt) |
| 750 | + lines = str.splitlines(process.stdout) |
744 | 751 | if len(lines) == 0:
|
745 | 752 | return
|
746 | 753 |
|
@@ -886,15 +893,15 @@ def gnatprove(
|
886 | 893 | # process = open("test.out", 'r').read()
|
887 | 894 |
|
888 | 895 | # Check marks in source code and print the command output sorted
|
889 |
| - strlist = str.splitlines(process.out) |
| 896 | + strlist = str.splitlines(process.stdout) |
890 | 897 | # Replace line above by the one below for testing the scripts without
|
891 | 898 | # running the tool
|
892 | 899 | # strlist = str.splitlines(process)
|
893 | 900 |
|
894 | 901 | check_marks(strlist)
|
895 | 902 | check_fail(strlist, no_fail)
|
896 | 903 | # Check that the exit status is as expected
|
897 |
| - if exit_status is not None and process.status != exit_status: |
| 904 | + if exit_status is not None and process.returncode != exit_status: |
898 | 905 | print("Unexpected exit status of", process.status)
|
899 | 906 | failure = True
|
900 | 907 | else:
|
@@ -1367,7 +1374,7 @@ def print_version():
|
1367 | 1374 | os.environ["LD_LIBRARY_PATH"] = ""
|
1368 | 1375 |
|
1369 | 1376 | p = Run(["gnatprove", "--version"])
|
1370 |
| - lines = p.out.splitlines() |
| 1377 | + lines = p.stdout.splitlines() |
1371 | 1378 | # drop first line of output
|
1372 | 1379 | lines = lines[1:]
|
1373 | 1380 | for line in lines:
|
|
0 commit comments