mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-28 04:24:26 +01:00
test-gdb and test-userland: fix --dry-run missing seconds
This commit is contained in:
12
common.py
12
common.py
@@ -770,7 +770,7 @@ Valid emulators: {}
|
|||||||
def log_error(self, msg):
|
def log_error(self, msg):
|
||||||
print('error: {}'.format(msg), file=sys.stdout)
|
print('error: {}'.format(msg), file=sys.stdout)
|
||||||
|
|
||||||
def log_info(self, msg, flush=False, **kwargs):
|
def log_info(self, msg='', flush=False, **kwargs):
|
||||||
if not self.env['quiet']:
|
if not self.env['quiet']:
|
||||||
print('{}'.format(msg), **kwargs)
|
print('{}'.format(msg), **kwargs)
|
||||||
if flush:
|
if flush:
|
||||||
@@ -935,11 +935,19 @@ Valid emulators: {}
|
|||||||
test_id_string = '{} {} {}'.format(self.env['emulator'], self.env['arch'], source)
|
test_id_string = '{} {} {}'.format(self.env['emulator'], self.env['arch'], source)
|
||||||
if self.env['verbose']:
|
if self.env['verbose']:
|
||||||
end = '\n'
|
end = '\n'
|
||||||
else:
|
elif not self.env['dry_run']:
|
||||||
end = ' '
|
end = ' '
|
||||||
|
else:
|
||||||
|
end = ''
|
||||||
self.log_info(test_id_string, flush=True, end=end)
|
self.log_info(test_id_string, flush=True, end=end)
|
||||||
return test_id_string
|
return test_id_string
|
||||||
|
|
||||||
|
def test_teardown(self, run_object):
|
||||||
|
if self.env['dry_run']:
|
||||||
|
self.log_info()
|
||||||
|
else:
|
||||||
|
self.log_info(self.seconds_to_hms(run_object.ellapsed_seconds))
|
||||||
|
|
||||||
def timed_main(self):
|
def timed_main(self):
|
||||||
'''
|
'''
|
||||||
Main action of the derived class.
|
Main action of the derived class.
|
||||||
|
|||||||
2
test-gdb
2
test-gdb
@@ -53,7 +53,7 @@ found by searching for the Python test files.
|
|||||||
gdb_args['test'] = True
|
gdb_args['test'] = True
|
||||||
run_gdb(**gdb_args)
|
run_gdb(**gdb_args)
|
||||||
run_thread.join()
|
run_thread.join()
|
||||||
self.log_info(self.seconds_to_hms(run.ellapsed_seconds))
|
self.test_teardown(run)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
Main().cli()
|
Main().cli()
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ If given, run only the given tests. Otherwise, run all tests.
|
|||||||
run_args['background'] = True
|
run_args['background'] = True
|
||||||
test_id_string = self.test_setup(run_args, source)
|
test_id_string = self.test_setup(run_args, source)
|
||||||
exit_status = run(**run_args)
|
exit_status = run(**run_args)
|
||||||
self.log_info(self.seconds_to_hms(run.ellapsed_seconds))
|
self.test_teardown(run)
|
||||||
if exit_status != 0:
|
if exit_status != 0:
|
||||||
self.log_error('test failed, program exit status: {} test id: {}'.format(exit_status, test_id_string))
|
self.log_error('test failed, program exit status: {} test id: {}'.format(exit_status, test_id_string))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user