Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
testrunner: update to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarzik committed Feb 25, 2024
1 parent 143a6e9 commit 3b282a2
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions testrunner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

import sys
import subprocess
Expand Down Expand Up @@ -55,25 +55,25 @@ def runtest(prog, testparams):
wanted_out = content_file.read()

p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(out_data, err_data) = p.communicate(in_data)
(out_data, err_data) = p.communicate(in_data.encode('utf-8'))

ok=True

if out_data != wanted_out:
print >>sys.stderr, "FAIL " + test_name + " stdout-invalid"
if out_data.decode('utf-8') != wanted_out:
print("FAIL " + test_name + " stdout-invalid", file=sys.stderr)
failures = failures + 1
ok=False
if err_data != wanted_err:
print >>sys.stderr, "FAIL " + test_name + " stderr-invalid"
if err_data.decode('utf-8') != wanted_err:
print("FAIL " + test_name + " stderr-invalid", file=sys.stderr)
failures = failures + 1
ok=False
if p.returncode != wanted_returncode:
print >>sys.stderr, "FAIL " + test_name + " retcode-invalid"
print("FAIL " + test_name + " retcode-invalid", file=sys.stderr)
failures = failures + 1
ok=False

if ok:
print >>sys.stderr, "OK " + test_name
print("OK " + test_name, file=sys.stderr)

def runtests(d):
prog = d['prog']
Expand All @@ -82,7 +82,7 @@ def runtests(d):

if __name__ == '__main__':
if len(sys.argv) != 3:
print "Usage: testrunner.py TEST-DATA-DIR JSON-CONFIG-FILE"
print("Usage: testrunner.py TEST-DATA-DIR JSON-CONFIG-FILE")
sys.exit(1)

srcdir=sys.argv[1]
Expand Down

0 comments on commit 3b282a2

Please sign in to comment.