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

Commit

Permalink
Merge pull request #33 from jgarzik/buildtest
Browse files Browse the repository at this point in the history
testrunner: update to python3
  • Loading branch information
jgarzik authored Feb 25, 2024
2 parents 143a6e9 + 9768eeb commit 3500de0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/TestingCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ jobs:
run: ./autogen.sh && ./configure
- name: Build
run: make -s
- name: Run tests
run: make -s check

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 3500de0

Please sign in to comment.