From 562750213f382f0c0ac5da3bad508bf210495cfe Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 4 Oct 2019 09:59:57 -0300 Subject: [PATCH] validate: launcher: Make encoding extra check use common code path Reusing the reporting infrastructure instead of shurtcuting it --- validate/launcher/apps/gstvalidate.py | 9 ++--- validate/launcher/baseclasses.py | 48 ++++++++++++++++++++------- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/validate/launcher/apps/gstvalidate.py b/validate/launcher/apps/gstvalidate.py index 02c61f5578..9854dfbaca 100644 --- a/validate/launcher/apps/gstvalidate.py +++ b/validate/launcher/apps/gstvalidate.py @@ -680,13 +680,8 @@ class GstValidateTranscodingTest(GstValidateTest, GstValidateEncodingTestInterfa return size def check_results(self): - if self.result in [Result.FAILED, Result.TIMEOUT] or \ - self.process.returncode != 0: - GstValidateTest.check_results(self) - return - - res, msg = self.check_encoded_file() - self.set_result(res, msg) + self.check_encoded_file() + GstValidateTest.check_results(self) class GstValidateBaseRTSPTest: diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py index bf33f32ed0..b061d6f294 100644 --- a/validate/launcher/baseclasses.py +++ b/validate/launcher/baseclasses.py @@ -1287,10 +1287,17 @@ class GstValidateEncodingTestInterface(object): if orig_duration - tolerance >= duration <= orig_duration + tolerance: os.remove(result_descriptor.get_path()) - return (Result.FAILED, "Duration of encoded file is " - " wrong (%s instead of %s)" % - (utils.TIME_ARGS(duration), - utils.TIME_ARGS(orig_duration))) + self.add_report( + { + 'type': 'report', + 'issue-id': 'transcoded-file-wrong-duration', + 'summary': 'The duration of a transcoded file doesn\'t match the duration of the original file', + 'level': 'critical', + 'detected-on': 'pipeline', + 'details': "Duration of encoded file is " " wrong (%s instead of %s)" % ( + utils.TIME_ARGS(duration), utils.TIME_ARGS(orig_duration)) + } + ) else: all_tracks_caps = result_descriptor.get_tracks_caps() container_caps = result_descriptor.get_caps() @@ -1304,21 +1311,38 @@ class GstValidateEncodingTestInterface(object): if wanted_caps is None: os.remove(result_descriptor.get_path()) - return (Result.FAILED, - "Found a track of type %s in the encoded files" - " but none where wanted in the encoded profile: %s" - % (track_type, self.combination)) + self.add_report( + { + 'type': 'report', + 'issue-id': 'transcoded-file-wrong-stream-type', + 'summary': 'Expected stream types during transcoding do not match expectations', + 'level': 'critical', + 'detected-on': 'pipeline', + 'details': "Found a track of type %s in the encoded files" + " but none where wanted in the encoded profile: %s" % ( + track_type, self.combination) + } + ) + return for c in cwanted_caps: if c not in ccaps: if not self._has_caps_type_variant(c, ccaps): os.remove(result_descriptor.get_path()) - return (Result.FAILED, - "Field: %s (from %s) not in caps of the outputed file %s" - % (wanted_caps, c, ccaps)) + self.add_report( + { + 'type': 'report', + 'issue-id': 'transcoded-file-wrong-caps', + 'summary': 'Expected stream caps during transcoding do not match expectations', + 'level': 'critical', + 'detected-on': 'pipeline', + 'details': "Field: %s (from %s) not in caps of the outputed file %s" % ( + wanted_caps, c, ccaps) + } + ) + return os.remove(result_descriptor.get_path()) - return (Result.PASSED, "") class TestsManager(Loggable):