Commit 8ad75ac3 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

QEMU: updated some test scripts for Python 3

--HG--
branch : qemu
parent 43b9e467ed5a
#!/usr/bin/env python3
import sys
def remove_end_loop(buf):
......
......@@ -792,7 +792,7 @@ function test_calls_from {
# remove infinite loop at the end, if any
ansi2txt < tests/$CAM/$TEST-raw.log \
| grep -E "call |return " \
| python remove_end_loop.py \
| python3 remove_end_loop.py \
> tests/$CAM/$TEST.log
# count some stats
......@@ -1391,7 +1391,7 @@ function test_calls_cstack {
sleep 10
stop_qemu_expect_running
ansi2txt < tests/$CAM/$TEST-raw.log | python tests/test_callstack.py &> tests/$CAM/$TEST-test.log \
ansi2txt < tests/$CAM/$TEST-raw.log | python3 tests/test_callstack.py &> tests/$CAM/$TEST-test.log \
&& (tail -n 1 tests/$CAM/$TEST-test.log | tr -d '\n'; echo " OK" ) \
|| (tail -n 1 tests/$CAM/$TEST-test.log | tr -d '\n'; echo -e " \e[31mFAILED!\e[0m" )
}
......
#!/usr/bin/env python3
from __future__ import print_function
import os, sys, re
from collections import defaultdict
......@@ -49,8 +52,8 @@ def match_stacks(current_stack, printed_stack):
if l[:70].rstrip() != p[:70].rstrip():
warnings += 1
print l
print p
print(l)
print(p)
# only report different arguments as warnings (fixme)
# but don't allow differences on what functions were called
if l.strip().split("(")[0] != p.strip().split("(")[0]:
......@@ -143,6 +146,6 @@ for line in lines:
debug("<%s:%s:%s>", at_task, at_a1, at_a2)
assert stackid == ("interrupt" if at_task.startswith("INT-") else at_task)
print "%d stack traces, %d stacks, %d task switches, %d interrupts" % (call_stacks, len(callstacks.keys()), task_switches, interrupts)
print("%d stack traces, %d stacks, %d task switches, %d interrupts" % (call_stacks, len(callstacks.keys()), task_switches, interrupts))
if warnings:
print "%d warning(s)" % warnings
print("%d warning(s)" % warnings)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment