mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-21 11:52:34 +01:00
auto-t: Do not remove valgrind.log
Right now the --valgrind option logs to a static file named 'valgrind.log'. This means that for any test that run multiple instances of iwd, output is lost for all invocations except the last. Fix that by using a per-process log file and making sure that all log files are printed to stdout when the test ends. This approach isn't perfect since it is possible for the pid to be reused, but better than the current behavior.
This commit is contained in:
parent
edf7294c06
commit
8e68e73c43
@ -672,7 +672,7 @@ class Namespace:
|
|||||||
|
|
||||||
if self.args.valgrind:
|
if self.args.valgrind:
|
||||||
args.extend(['valgrind', '--leak-check=full', '--track-origins=yes',
|
args.extend(['valgrind', '--leak-check=full', '--track-origins=yes',
|
||||||
'--log-file=/tmp/valgrind.log'])
|
'--log-file=/tmp/valgrind.log.%p'])
|
||||||
|
|
||||||
args.extend(['iwd', '-p', iwd_radios])
|
args.extend(['iwd', '-p', iwd_radios])
|
||||||
|
|
||||||
@ -1183,16 +1183,20 @@ def post_test(ctx, to_copy):
|
|||||||
finally:
|
finally:
|
||||||
ctx.stop_test_processes()
|
ctx.stop_test_processes()
|
||||||
|
|
||||||
|
if ctx.args.valgrind:
|
||||||
|
for f in os.listdir('/tmp'):
|
||||||
|
if f.startswith("valgrind.log."):
|
||||||
|
dbg(f)
|
||||||
|
with open('/tmp/' + f, 'r') as v:
|
||||||
|
dbg(v.read())
|
||||||
|
dbg("\n")
|
||||||
|
os.remove('/tmp/' + f)
|
||||||
|
|
||||||
allowed = ['phonesim.conf', 'certs', 'secrets', 'iwd']
|
allowed = ['phonesim.conf', 'certs', 'secrets', 'iwd']
|
||||||
for f in [f for f in os.listdir('/tmp') if f not in allowed]:
|
for f in [f for f in os.listdir('/tmp') if f not in allowed]:
|
||||||
dbg("File %s was not cleaned up!" % f)
|
dbg("File %s was not cleaned up!" % f)
|
||||||
os.remove('/tmp/' + f)
|
os.remove('/tmp/' + f)
|
||||||
|
|
||||||
if ctx.args.valgrind:
|
|
||||||
with open('/tmp/valgrind.log', 'r') as f:
|
|
||||||
dbg(f.read())
|
|
||||||
dbg("\n")
|
|
||||||
|
|
||||||
def print_results(results):
|
def print_results(results):
|
||||||
table = PrettyTable(['Test', colored('Passed', 'green'), colored('Failed', 'red'), \
|
table = PrettyTable(['Test', colored('Passed', 'green'), colored('Failed', 'red'), \
|
||||||
colored('Skipped', 'cyan'), colored('Time', 'yellow')])
|
colored('Skipped', 'cyan'), colored('Time', 'yellow')])
|
||||||
|
Loading…
Reference in New Issue
Block a user