validate:launcher: Allow specifying timeout as a known issue

And minor cleanups
This commit is contained in:
Thibault Saunier 2016-11-26 10:25:43 -03:00
parent 03453961e8
commit acfdd04e01
3 changed files with 47 additions and 11 deletions

View file

@ -414,7 +414,7 @@ gst_validate_send (JsonNode * root)
if (!res) { if (!res) {
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PENDING)) { if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PENDING)) {
GST_ERROR ("Stream was busy, trying again later."); GST_DEBUG ("Stream was busy, trying again later.");
g_free (message); g_free (message);
g_object_unref (jgen); g_object_unref (jgen);

View file

@ -30,7 +30,6 @@ import time
from . import utils from . import utils
import signal import signal
import urllib.parse import urllib.parse
import tempfile
import subprocess import subprocess
import threading import threading
import queue import queue
@ -251,9 +250,10 @@ class Test(Loggable):
if self.process.returncode == 0: if self.process.returncode == 0:
self.set_result(Result.PASSED) self.set_result(Result.PASSED)
elif self.process.returncode in [-signal.SIGSEGV, -signal.SIGABRT, 139]: elif self.process.returncode in [-signal.SIGSEGV, -signal.SIGABRT, 139]:
result = Result.FAILED
msg = "Application segfaulted "
self.add_stack_trace_to_file() self.add_stack_trace_to_file()
self.set_result(Result.FAILED,
"Application segfaulted, returne code: %d" % (
self.process.returncode))
elif self.process.returncode == VALGRIND_ERROR_CODE: elif self.process.returncode == VALGRIND_ERROR_CODE:
self.set_result(Result.FAILED, "Valgrind reported errors") self.set_result(Result.FAILED, "Valgrind reported errors")
else: else:
@ -761,15 +761,45 @@ class GstValidateTest(Test):
return ret, expected_failures, expected_retcode return ret, expected_failures, expected_retcode
def check_expected_timeout(self, expected_timeout):
msg = "Expected timeout happened. "
result = Result.PASSED
message = expected_timeout.get('message')
if message:
if not re.findall(message, self.message):
result = Result.FAILED
msg = "Expected timeout message: %s got %s " % (
message, self.message)
expected_symbols = expected_timeout.get('stacktrace_symbols')
if expected_symbols:
trace_gatherer = BackTraceGenerator.get_default()
stack_trace = trace_gatherer.get_trace(self)
if stack_trace:
if not isinstance(expected_symbols, list):
expected_symbols = [expected_symbols]
not_found_symbols = [s for s in expected_symbols
if s not in stack_trace]
if not_found_symbols:
result = Result.TIMEOUT
msg = "Expected symbols '%s' not found in stack trace " % (
not_found_symbols)
else:
msg += "No stack trace available, could not verify symbols "
return result, msg
def check_results(self): def check_results(self):
if self.result is Result.FAILED or self.result is Result.PASSED or self.result is Result.TIMEOUT: if self.result in [Result.FAILED, self.result is Result.PASSED]:
return return
self.debug("%s returncode: %s", self, self.process.returncode) self.debug("%s returncode: %s", self, self.process.returncode)
criticals, not_found_expected_failures, expected_returncode = self.check_reported_issues() criticals, not_found_expected_failures, expected_returncode = self.check_reported_issues()
returncode_index = None expected_timeout = None
for i, f in enumerate(not_found_expected_failures): for i, f in enumerate(not_found_expected_failures):
if len(f) == 1 and f.get("returncode"): if len(f) == 1 and f.get("returncode"):
returncode = f['returncode'] returncode = f['returncode']
@ -777,15 +807,21 @@ class GstValidateTest(Test):
returncode = [expected_returncode] returncode = [expected_returncode]
if 'sometimes' in f: if 'sometimes' in f:
returncode.append(0) returncode.append(0)
returncode_index = i elif f.get("timeout"):
break expected_timeout = f
not_found_expected_failures = [f for f in not_found_expected_failures not_found_expected_failures = [f for f in not_found_expected_failures
if not f.get('returncode')] if not f.get('returncode')]
msg = "" msg = ""
result = Result.PASSED result = Result.PASSED
if self.process.returncode in COREDUMP_SIGNALS: if self.result == Result.TIMEOUT:
if expected_timeout:
not_found_expected_failures.remove(expected_timeout)
result, msg = self.check_expected_timeout(expected_timeout)
else:
return
elif self.process.returncode in COREDUMP_SIGNALS:
result = Result.FAILED result = Result.FAILED
msg = "Application segfaulted " msg = "Application segfaulted "
self.add_stack_trace_to_logfile() self.add_stack_trace_to_logfile()
@ -1093,7 +1129,7 @@ class TestsManager(Loggable):
return True return True
def check_expected_failures(self): def check_expected_failures(self):
if not self.blacklisted_tests: if not self.expected_failures or not self.options.check_bugs_status:
return True return True
if self.expected_failures: if self.expected_failures:

View file

@ -137,7 +137,7 @@ def printc(message, color="", title=False, title_char=''):
length = len(message) length = len(message)
if title is True: if title is True:
message = length * title + "\n" + str(message) + "\n" + length * '=' message = length * "=" + "\n" + str(message) + "\n" + length * '='
else: else:
message = str(message) + "\n" + length * title_char message = str(message) + "\n" + length * title_char