tests: Add option --dbus for logging D-Bus messages
Signed-off-by: Vasyl Vavrychuk <vvavrychuk@gmail.com>
This commit is contained in:
parent
2e4707a0a7
commit
2494bcef24
1 changed files with 17 additions and 4 deletions
|
@ -123,11 +123,12 @@ def report(conn, prefill, build, commit, run, test, result, duration, logdir,
|
||||||
logdir + "/" + test + "." + log)
|
logdir + "/" + test + "." + log)
|
||||||
|
|
||||||
class DataCollector(object):
|
class DataCollector(object):
|
||||||
def __init__(self, logdir, testname, tracing, dmesg):
|
def __init__(self, logdir, testname, args):
|
||||||
self._logdir = logdir
|
self._logdir = logdir
|
||||||
self._testname = testname
|
self._testname = testname
|
||||||
self._tracing = tracing
|
self._tracing = args.tracing
|
||||||
self._dmesg = dmesg
|
self._dmesg = args.dmesg
|
||||||
|
self._dbus = args.dbus
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
if self._tracing:
|
if self._tracing:
|
||||||
output = os.path.abspath(os.path.join(self._logdir, '%s.dat' % (self._testname, )))
|
output = os.path.abspath(os.path.join(self._logdir, '%s.dat' % (self._testname, )))
|
||||||
|
@ -143,6 +144,16 @@ class DataCollector(object):
|
||||||
if res:
|
if res:
|
||||||
print "Failed calling trace-cmd: returned exit status %d" % res
|
print "Failed calling trace-cmd: returned exit status %d" % res
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
if self._dbus:
|
||||||
|
output = os.path.abspath(os.path.join(self._logdir, '%s.dbus' % (self._testname, )))
|
||||||
|
self._dbus_cmd = subprocess.Popen(['dbus-monitor', '--system'],
|
||||||
|
stdout=open(output, 'w'),
|
||||||
|
stderr=open('/dev/null', 'w'),
|
||||||
|
cwd=self._logdir)
|
||||||
|
res = self._dbus_cmd.returncode
|
||||||
|
if res:
|
||||||
|
print "Failed calling dbus-monitor: returned exit status %d" % res
|
||||||
|
sys.exit(1)
|
||||||
def __exit__(self, type, value, traceback):
|
def __exit__(self, type, value, traceback):
|
||||||
if self._tracing:
|
if self._tracing:
|
||||||
self._trace_cmd.stdin.write('DONE\n')
|
self._trace_cmd.stdin.write('DONE\n')
|
||||||
|
@ -214,6 +225,8 @@ def main():
|
||||||
help='collect tracing per test case (in log directory)')
|
help='collect tracing per test case (in log directory)')
|
||||||
parser.add_argument('-D', action='store_true', dest='dmesg',
|
parser.add_argument('-D', action='store_true', dest='dmesg',
|
||||||
help='collect dmesg per test case (in log directory)')
|
help='collect dmesg per test case (in log directory)')
|
||||||
|
parser.add_argument('--dbus', action='store_true', dest='dbus',
|
||||||
|
help='collect dbus per test case (in log directory)')
|
||||||
parser.add_argument('--shuffle-tests', action='store_true',
|
parser.add_argument('--shuffle-tests', action='store_true',
|
||||||
dest='shuffle_tests',
|
dest='shuffle_tests',
|
||||||
help='Shuffle test cases to randomize order')
|
help='Shuffle test cases to randomize order')
|
||||||
|
@ -414,7 +427,7 @@ def main():
|
||||||
logger.addHandler(log_handler)
|
logger.addHandler(log_handler)
|
||||||
|
|
||||||
reset_ok = True
|
reset_ok = True
|
||||||
with DataCollector(args.logdir, name, args.tracing, args.dmesg):
|
with DataCollector(args.logdir, name, args):
|
||||||
count = count + 1
|
count = count + 1
|
||||||
msg = "START {} {}/{}".format(name, count, num_tests)
|
msg = "START {} {}/{}".format(name, count, num_tests)
|
||||||
logger.info(msg)
|
logger.info(msg)
|
||||||
|
|
Loading…
Reference in a new issue