mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 11:32:38 +00:00
launcher: Print test number in the order they finish
Instead of the test index in the list of tests as it is meaningless to the user and feels weird. Also minor fix in the test name display when running with --forever.
This commit is contained in:
parent
cd1c4eb44d
commit
a70658a464
2 changed files with 17 additions and 17 deletions
|
@ -1561,10 +1561,6 @@ class _TestsLauncher(Loggable):
|
|||
return True
|
||||
return False
|
||||
|
||||
def get_test_num(self, test):
|
||||
cur_test_num = self.tests.index(test) + 1
|
||||
return "[%d / %d] " % (cur_test_num, self.total_num_tests)
|
||||
|
||||
def server_wrapper(self, ready):
|
||||
self.server = GstValidateTCPServer(
|
||||
('localhost', 0), GstValidateListener)
|
||||
|
@ -1656,6 +1652,7 @@ class _TestsLauncher(Loggable):
|
|||
random.shuffle(tests)
|
||||
random.shuffle(alone_tests)
|
||||
|
||||
current_test_num = 1
|
||||
for num_jobs, tests in [(max_num_jobs, tests), (1, alone_tests)]:
|
||||
tests_left = list(tests)
|
||||
for i in range(num_jobs):
|
||||
|
@ -1666,7 +1663,8 @@ class _TestsLauncher(Loggable):
|
|||
while jobs_running != 0:
|
||||
test = self.tests_wait()
|
||||
jobs_running -= 1
|
||||
test.number = self.get_test_num(test)
|
||||
test.number = "[%d / %d] " % (current_test_num, self.total_num_tests)
|
||||
current_test_num += 1
|
||||
res = test.test_end()
|
||||
self.reporter.after_test(test)
|
||||
if res != Result.PASSED and (self.options.forever or
|
||||
|
@ -1687,8 +1685,7 @@ class _TestsLauncher(Loggable):
|
|||
if self.options.forever:
|
||||
r = 1
|
||||
while True:
|
||||
t = "Running iteration %d" % r
|
||||
print("%s\n%s\n%s\n" % ("=" * len(t), t, "=" * len(t)))
|
||||
printc("Running iteration %d" % r, title=True)
|
||||
|
||||
if not self._run_tests():
|
||||
break
|
||||
|
|
|
@ -102,6 +102,7 @@ def desactivate_colors():
|
|||
Colors.FAIL = ''
|
||||
Colors.ENDC = ''
|
||||
|
||||
|
||||
if not supports_ansi_colors():
|
||||
desactivate_colors()
|
||||
|
||||
|
@ -145,8 +146,11 @@ def get_color_for_result(result):
|
|||
return color
|
||||
|
||||
|
||||
last_cariage_return_len = 0
|
||||
last_carriage_return_len = 0
|
||||
|
||||
|
||||
def printc(message, color="", title=False, title_char='', end="\n"):
|
||||
global last_carriage_return_len
|
||||
if title or title_char:
|
||||
length = 0
|
||||
for l in message.split("\n"):
|
||||
|
@ -155,10 +159,13 @@ def printc(message, color="", title=False, title_char='', end="\n"):
|
|||
if length == 0:
|
||||
length = len(message)
|
||||
|
||||
needed_spaces = ' ' * max(0, last_carriage_return_len - length)
|
||||
if title is True:
|
||||
message = length * "=" + "\n" + str(message) + "\n" + length * '='
|
||||
message = length * "=" + needed_spaces + "\n" \
|
||||
+ str(message) + "\n" + length * '='
|
||||
else:
|
||||
message = str(message) + "\n" + length * title_char
|
||||
message = str(message) + needed_spaces + "\n" + \
|
||||
length * title_char
|
||||
|
||||
if hasattr(message, "result") and color == '':
|
||||
color = get_color_for_result(message.result)
|
||||
|
@ -166,13 +173,8 @@ def printc(message, color="", title=False, title_char='', end="\n"):
|
|||
if not sys.stdout.isatty():
|
||||
end = "\n"
|
||||
|
||||
global last_carriage_return_len
|
||||
if end == "\r":
|
||||
message += ' ' * max(0, last_carriage_return_len - len(message))
|
||||
last_carriage_return_len = len(message)
|
||||
else:
|
||||
last_carriage_return_len = 0
|
||||
|
||||
message += ' ' * max(0, last_carriage_return_len - len(message))
|
||||
last_carriage_return_len = len(message) if end == "\r" else 0
|
||||
sys.stdout.write(color + str(message) + Colors.ENDC + end)
|
||||
sys.stdout.flush()
|
||||
|
||||
|
@ -267,6 +269,7 @@ def get_data_file(subdir, name):
|
|||
def gsttime_from_tuple(stime):
|
||||
return int((int(stime[0]) * 3600 + int(stime[1]) * 60 + int(stime[2])) * GST_SECOND + int(stime[3]))
|
||||
|
||||
|
||||
timeregex = re.compile(r'(?P<_0>.+):(?P<_1>.+):(?P<_2>.+)\.(?P<_3>.+)')
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue