diff --git a/tests/main.py b/tests/main.py index 6f9112108bc..d89d17fc582 100644 --- a/tests/main.py +++ b/tests/main.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 import time from datetime import timedelta diff --git a/tests/parser.py b/tests/parser.py index f7255530080..7d62911d9db 100644 --- a/tests/parser.py +++ b/tests/parser.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 from fnmatch import fnmatch from collections import namedtuple diff --git a/tests/runtime-tests.sh b/tests/runtime-tests.sh index d2b39d9222c..4a524d3130b 100755 --- a/tests/runtime-tests.sh +++ b/tests/runtime-tests.sh @@ -7,4 +7,4 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" BPFTRACE_RUNTIME_TEST_EXECUTABLE=${BPFTRACE_RUNTIME_TEST_EXECUTABLE:-$DIR/../src/}; export BPFTRACE_RUNTIME_TEST_EXECUTABLE; -python main.py $@ +python3 main.py $@ diff --git a/tests/runtime/basic b/tests/runtime/basic index 9dc48f59668..305c3417f09 100644 --- a/tests/runtime/basic +++ b/tests/runtime/basic @@ -15,7 +15,7 @@ TIMEOUT 1 NAME errors on non existent file RUN bpftrace non_existent_file.bt -EXPECT Error: Could not open file 'non_existent_file.bt' +EXPECT Error opening file 'non_existent_file.bt': No such file or directory TIMEOUT 1 NAME it lists kprobes diff --git a/tests/utils.py b/tests/utils.py index 533a9520f00..eb1f1632e18 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,3 +1,5 @@ +#!/usr/bin/python3 + import subprocess import signal from os import environ, uname, devnull @@ -101,14 +103,14 @@ def run_test(test): while p.poll() is None: nextline = p.stdout.readline() - output += nextline + output += nextline.decode() if nextline == "Running...\n": signal.alarm(test.timeout or DEFAULT_TIMEOUT) if not after and test.after: after = subprocess.Popen(test.after, shell=True) break - output += p.communicate()[0] + output += p.communicate()[0].decode() signal.alarm(0) result = re.search(test.expect, output) @@ -118,7 +120,7 @@ def run_test(test): # bpftrace process might still be alive if p.poll() is None: p.kill() - output += p.communicate()[0] + output += p.communicate()[0].decode() result = re.search(test.expect, output) if not result: print(fail("[ TIMEOUT ] ") + "%s.%s" % (test.suite, test.name))