Import gst-integration-testsuites
[platform/upstream/gstreamer.git] / subprojects / gst-integration-testsuites / testsuites / validateelements.py
1 # -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
2 #
3 # Copyright (c) 2015,Thibault Saunier <thibault.saunier@collabora.com>
4 #               2015,Vineeth T M <vineeth.tm@samsung.com>
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this program; if not, write to the
18 # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 # Boston, MA 02110-1301, USA.
20
21 """
22 The GstValidate default testsuite
23 """
24
25 import gi
26
27 gi.require_version("Gst", "1.0")
28
29 from gi.repository import Gst  # noqa
30 from gi.repository import GObject  # noqa
31
32 TEST_MANAGER = "validate"
33
34 KNOWN_ISSUES = {
35     "validateelements.launch_pipeline.videocropbottom=2147483647.play_15s issues": {
36         "tests": [
37             "validateelements.launch_pipeline.videocropbottom=2147483647.play_15s"
38         ],
39         "issues": [
40             {
41                 "issue-id": "runtime::not-negotiated",
42                 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
43                 "level": "critical",
44                 "detected-on": "pipeline0",
45                 "sometimes": False,
46             }
47         ]
48     },
49     "validateelements.launch_pipeline.videocropleft=2147483647.play_15s issues": {
50         "tests": [
51             "validateelements.launch_pipeline.videocropleft=2147483647.play_15s"
52         ],
53         "issues": [
54             {
55                 "issue-id": "runtime::not-negotiated",
56                 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
57                 "level": "critical",
58                 "detected-on": "pipeline0",
59                 "sometimes": False,
60             }
61         ]
62     },
63     "validateelements.launch_pipeline.videocropright=2147483647.play_15s issues": {
64         "tests": [
65             "validateelements.launch_pipeline.videocropright=2147483647.play_15s"
66         ],
67         "issues": [
68             {
69                 "issue-id": "runtime::not-negotiated",
70                 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
71                 "level": "critical",
72                 "detected-on": "pipeline0",
73                 "sometimes": False,
74             }
75         ]
76     },
77     "validateelements.launch_pipeline.videocroptop=2147483647.play_15s issues": {
78         "tests": [
79             "validateelements.launch_pipeline.videocroptop=2147483647.play_15s"
80         ],
81         "issues": [
82             {
83                 "issue-id": "runtime::not-negotiated",
84                 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
85                 "level": "critical",
86                 "detected-on": "pipeline0",
87                 "sometimes": False,
88             }
89         ]
90     },
91     "validateelements.launch_pipeline.avwaitrecording=False.play_15s issues": {
92         "tests": [
93             "validateelements.launch_pipeline.avwaitrecording=False.play_15s"
94         ],
95         "issues": [
96             {
97                 "timeout": True,
98                 "sometimes": True,
99             }
100         ]
101     },
102     "validateelements.launch_pipeline.avwaitrecording=True.play_15s issues": {
103         "tests": [
104             "validateelements.launch_pipeline.avwaitrecording=True.play_15s"
105         ],
106         "issues": [
107             {
108                 "timeout": True,
109                 "sometimes": True,
110             }
111         ]
112     },
113     "validateelements.launch_pipeline.avwaittarget-running-time=0.play_15s issues": {
114         "tests": [
115             "validateelements.launch_pipeline.avwaittarget-running-time=0.play_15s"
116         ],
117         "issues": [
118             {
119                 "timeout": True,
120                 "sometimes": True,
121             }
122         ]
123     },
124     "validateelements.launch_pipeline.avwaittarget-running-time=18446744073709551615.play_15s issues": {
125         "tests": [
126             "validateelements.launch_pipeline.avwaittarget-running-time=18446744073709551615.play_15s"
127         ],
128         "issues": [
129             {
130                 "timeout": True,
131                 "sometimes": True,
132             }
133         ]
134     },
135     "validateelements.launch_pipeline.cvsmoothkernel-height=2147483647.play_15s issues": {
136         "tests": ["validateelements.launch_pipeline.cvsmoothkernel-height=2147483647.play_15s issues"],
137         "issues": [
138             {
139                 "timeout": True,
140                 "sometimes": True,
141             }
142         ]
143     },
144     "validateelements.launch_pipeline.cvsmoothkernel-width=2147483647.play_15s issues": {
145         "tests": ["validateelements.launch_pipeline.cvsmoothkernel-width=2147483647.play_15s issues"],
146         "issues": [
147             {
148                 "timeout": True,
149                 "sometimes": True,
150             }
151         ]
152     },
153     "validateelements.launch_pipeline.rawaudioparsenum-channels=2147483647.play_15s issues": {
154         "tests": [
155             "validateelements.launch_pipeline.rawaudioparsenum-channels=2147483647.play_15s"
156         ],
157         "issues": [
158             {
159                 "issue-id": "g-log::critical",
160                 "summary": "We got a g_log critical issue",
161                 "level": "critical",
162                 "detected-on": "pipeline0"
163             },
164             {
165                 "issue-id": "runtime::error-on-bus",
166                 "summary": "We got an ERROR message on the bus",
167                 "level": "critical",
168                 "detected-on": "pipeline0"
169             }
170         ]
171     },
172     "validateelements.launch_pipeline.rawvideoparseframe-size=4294967295.play_15s issues": {
173         "tests": [
174             "validateelements.launch_pipeline.rawvideoparseframe-size=4294967295.play_15s"
175         ],
176         "issues": [
177             {
178                 "issue-id": "runtime::error-on-bus",
179                 "summary": "We got an ERROR message on the bus",
180                 "level": "critical",
181                 "detected-on": "pipeline0"
182             }
183         ]
184     },
185     "validateelements.launch_pipeline.rawvideoparseheight=0.play_15s issues": {
186         "tests": [
187             "validateelements.launch_pipeline.rawvideoparseheight=0.play_15s"
188         ],
189         "issues": [
190             {
191                 "issue-id": "runtime::not-negotiated",
192                 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
193                 "level": "critical",
194                 "detected-on": "pipeline0"
195             },
196             {
197                 "issue-id": "runtime::error-on-bus",
198                 "summary": "We got an ERROR message on the bus",
199                 "level": "critical",
200                 "detected-on": "pipeline0"
201             }
202         ]
203     },
204     "validateelements.launch_pipeline.rawvideoparseheight=2147483647.play_15s issues": {
205         "tests": [
206             "validateelements.launch_pipeline.rawvideoparseheight=2147483647.play_15s"
207         ],
208         "issues": [
209             {
210                 "issue-id": "runtime::not-negotiated",
211                 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
212                 "level": "critical",
213                 "detected-on": "pipeline0"
214             },
215             {
216                 "issue-id": "runtime::error-on-bus",
217                 "summary": "We got an ERROR message on the bus",
218                 "level": "critical",
219                 "detected-on": "pipeline0"
220             }
221         ]
222     },
223     "validateelements.launch_pipeline.rawvideoparsewidth=0.play_15s issues": {
224         "tests": [
225             "validateelements.launch_pipeline.rawvideoparsewidth=0.play_15s"
226         ],
227         "issues": [
228             {
229                 "issue-id": "runtime::not-negotiated",
230                 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
231                 "level": "critical",
232                 "detected-on": "pipeline0"
233             },
234             {
235                 "issue-id": "runtime::error-on-bus",
236                 "summary": "We got an ERROR message on the bus",
237                 "level": "critical",
238                 "detected-on": "pipeline0"
239             }
240         ]
241     },
242     "validateelements.launch_pipeline.rawvideoparsewidth=2147483647.play_15s issues": {
243         "tests": [
244             "validateelements.launch_pipeline.rawvideoparsewidth=2147483647.play_15s"
245         ],
246         "issues": [
247             {
248                 "issue-id": "runtime::not-negotiated",
249                 "summary": "a NOT NEGOTIATED message has been posted on the bus.",
250                 "level": "critical",
251                 "detected-on": "pipeline0"
252             },
253             {
254                 "issue-id": "runtime::error-on-bus",
255                 "summary": "We got an ERROR message on the bus",
256                 "level": "critical",
257                 "detected-on": "pipeline0"
258             }
259         ]
260     },
261     "validateelements.launch_pipeline.shapewipeborder=0.0.play_15s issues": {
262         "tests": [
263             "validateelements.launch_pipeline.shapewipeborder=0.0.play_15s"
264         ],
265         "issues": [
266             {
267                 "timeout": True,
268                 "sometimes": True,
269             }
270         ]
271     },
272     "validateelements.launch_pipeline.shapewipeborder=1.0.play_15s issues": {
273         "tests": [
274             "validateelements.launch_pipeline.shapewipeborder=1.0.play_15s"
275         ],
276         "issues": [
277             {
278                 "timeout": True,
279                 "sometimes": True,
280             }
281         ]
282     },
283     "validateelements.launch_pipeline.shapewipeposition=0.0.play_15s issues": {
284         "tests": [
285             "validateelements.launch_pipeline.shapewipeposition=0.0.play_15s"
286         ],
287         "issues": [
288             {
289                 "timeout": True,
290                 "sometimes": True,
291             }
292         ]
293     },
294     "validateelements.launch_pipeline.shapewipeposition=1.0.play_15s issues": {
295         "tests": [
296             "validateelements.launch_pipeline.shapewipeposition=1.0.play_15s"
297         ],
298         "issues": [
299             {
300                 "timeout": True,
301                 "sometimes": True,
302             }
303         ]
304     },
305     "validateelements.launch_pipeline.videoraterate=0.0.play_15s issues": {
306         "tests": [
307             "validateelements.launch_pipeline.videoraterate=0.0.play_15s"
308         ],
309         "issues": [
310             {
311                 "timeout": True,
312                 "sometimes": True,
313             }
314         ]
315     },
316     "validateelements.launch_pipeline.webrtcdspcompression-gain-db=0.play_15s issues": {
317         "tests": [
318             "validateelements.launch_pipeline.webrtcdspcompression-gain-db=0.play_15s"
319         ],
320         "issues": [
321             {
322                 "issue-id": "runtime::error-on-bus",
323                 "summary": "We got an ERROR message on the bus",
324                 "level": "critical",
325                 "detected-on": "pipeline0"
326             }
327         ]
328     },
329     "validateelements.launch_pipeline.webrtcdspcompression-gain-db=9.play_15s issues": {
330         "tests": [
331             "validateelements.launch_pipeline.webrtcdspcompression-gain-db=9.play_15s"
332         ],
333         "issues": [
334             {
335                 "issue-id": "runtime::error-on-bus",
336                 "summary": "We got an ERROR message on the bus",
337                 "level": "critical",
338                 "detected-on": "pipeline0"
339             }
340         ]
341     },
342     "validateelements.launch_pipeline.webrtcdspcompression-gain-db=90.play_15s issues": {
343         "tests": [
344             "validateelements.launch_pipeline.webrtcdspcompression-gain-db=90.play_15s"
345         ],
346         "issues": [
347             {
348                 "issue-id": "runtime::error-on-bus",
349                 "summary": "We got an ERROR message on the bus",
350                 "level": "critical",
351                 "detected-on": "pipeline0"
352             }
353         ]
354     },
355     "validateelements.launch_pipeline.webrtcdspdelay-agnostic=False.play_15s issues": {
356         "tests": [
357             "validateelements.launch_pipeline.webrtcdspdelay-agnostic=False.play_15s"
358         ],
359         "issues": [
360             {
361                 "issue-id": "runtime::error-on-bus",
362                 "summary": "We got an ERROR message on the bus",
363                 "level": "critical",
364                 "detected-on": "pipeline0"
365             }
366         ]
367     },
368     "validateelements.launch_pipeline.webrtcdspdelay-agnostic=True.play_15s issues": {
369         "tests": [
370             "validateelements.launch_pipeline.webrtcdspdelay-agnostic=True.play_15s"
371         ],
372         "issues": [
373             {
374                 "issue-id": "runtime::error-on-bus",
375                 "summary": "We got an ERROR message on the bus",
376                 "level": "critical",
377                 "detected-on": "pipeline0"
378             }
379         ]
380     },
381     "validateelements.launch_pipeline.webrtcdspecho-cancel=True.play_15s issues": {
382         "tests": [
383             "validateelements.launch_pipeline.webrtcdspecho-cancel=True.play_15s"
384         ],
385         "issues": [
386             {
387                 "issue-id": "runtime::error-on-bus",
388                 "summary": "We got an ERROR message on the bus",
389                 "level": "critical",
390                 "detected-on": "pipeline0"
391             }
392         ]
393     },
394     "validateelements.launch_pipeline.webrtcdspexperimental-agc=False.play_15s issues": {
395         "tests": [
396             "validateelements.launch_pipeline.webrtcdspexperimental-agc=False.play_15s"
397         ],
398         "issues": [
399             {
400                 "issue-id": "runtime::error-on-bus",
401                 "summary": "We got an ERROR message on the bus",
402                 "level": "critical",
403                 "detected-on": "pipeline0"
404             }
405         ]
406     },
407     "validateelements.launch_pipeline.webrtcdspexperimental-agc=True.play_15s issues": {
408         "tests": [
409             "validateelements.launch_pipeline.webrtcdspexperimental-agc=True.play_15s"
410         ],
411         "issues": [
412             {
413                 "issue-id": "runtime::error-on-bus",
414                 "summary": "We got an ERROR message on the bus",
415                 "level": "critical",
416                 "detected-on": "pipeline0"
417             }
418         ]
419     },
420     "validateelements.launch_pipeline.webrtcdspextended-filter=False.play_15s issues": {
421         "tests": [
422             "validateelements.launch_pipeline.webrtcdspextended-filter=False.play_15s"
423         ],
424         "issues": [
425             {
426                 "issue-id": "runtime::error-on-bus",
427                 "summary": "We got an ERROR message on the bus",
428                 "level": "critical",
429                 "detected-on": "pipeline0"
430             }
431         ]
432     },
433     "validateelements.launch_pipeline.webrtcdspextended-filter=True.play_15s issues": {
434         "tests": [
435             "validateelements.launch_pipeline.webrtcdspextended-filter=True.play_15s"
436         ],
437         "issues": [
438             {
439                 "issue-id": "runtime::error-on-bus",
440                 "summary": "We got an ERROR message on the bus",
441                 "level": "critical",
442                 "detected-on": "pipeline0"
443             }
444         ]
445     },
446     "validateelements.launch_pipeline.webrtcdspgain-control=False.play_15s issues": {
447         "tests": [
448             "validateelements.launch_pipeline.webrtcdspgain-control=False.play_15s"
449         ],
450         "issues": [
451             {
452                 "issue-id": "runtime::error-on-bus",
453                 "summary": "We got an ERROR message on the bus",
454                 "level": "critical",
455                 "detected-on": "pipeline0"
456             }
457         ]
458     },
459     "validateelements.launch_pipeline.webrtcdspgain-control=True.play_15s issues": {
460         "tests": [
461             "validateelements.launch_pipeline.webrtcdspgain-control=True.play_15s"
462         ],
463         "issues": [
464             {
465                 "issue-id": "runtime::error-on-bus",
466                 "summary": "We got an ERROR message on the bus",
467                 "level": "critical",
468                 "detected-on": "pipeline0"
469             }
470         ]
471     },
472     "validateelements.launch_pipeline.webrtcdsphigh-pass-filter=False.play_15s issues": {
473         "tests": [
474             "validateelements.launch_pipeline.webrtcdsphigh-pass-filter=False.play_15s"
475         ],
476         "issues": [
477             {
478                 "issue-id": "runtime::error-on-bus",
479                 "summary": "We got an ERROR message on the bus",
480                 "level": "critical",
481                 "detected-on": "pipeline0"
482             }
483         ]
484     },
485     "validateelements.launch_pipeline.webrtcdsphigh-pass-filter=True.play_15s issues": {
486         "tests": [
487             "validateelements.launch_pipeline.webrtcdsphigh-pass-filter=True.play_15s"
488         ],
489         "issues": [
490             {
491                 "issue-id": "runtime::error-on-bus",
492                 "summary": "We got an ERROR message on the bus",
493                 "level": "critical",
494                 "detected-on": "pipeline0"
495             }
496         ]
497     },
498     "validateelements.launch_pipeline.webrtcdsplimiter=False.play_15s issues": {
499         "tests": [
500             "validateelements.launch_pipeline.webrtcdsplimiter=False.play_15s"
501         ],
502         "issues": [
503             {
504                 "issue-id": "runtime::error-on-bus",
505                 "summary": "We got an ERROR message on the bus",
506                 "level": "critical",
507                 "detected-on": "pipeline0"
508             }
509         ]
510     },
511     "validateelements.launch_pipeline.webrtcdsplimiter=True.play_15s issues": {
512         "tests": [
513             "validateelements.launch_pipeline.webrtcdsplimiter=True.play_15s"
514         ],
515         "issues": [
516             {
517                 "issue-id": "runtime::error-on-bus",
518                 "summary": "We got an ERROR message on the bus",
519                 "level": "critical",
520                 "detected-on": "pipeline0"
521             }
522         ]
523     },
524     "validateelements.launch_pipeline.webrtcdspnoise-suppression=False.play_15s issues": {
525         "tests": [
526             "validateelements.launch_pipeline.webrtcdspnoise-suppression=False.play_15s"
527         ],
528         "issues": [
529             {
530                 "issue-id": "runtime::error-on-bus",
531                 "summary": "We got an ERROR message on the bus",
532                 "level": "critical",
533                 "detected-on": "pipeline0"
534             }
535         ]
536     },
537     "validateelements.launch_pipeline.webrtcdspnoise-suppression=True.play_15s issues": {
538         "tests": [
539             "validateelements.launch_pipeline.webrtcdspnoise-suppression=True.play_15s"
540         ],
541         "issues": [
542             {
543                 "issue-id": "runtime::error-on-bus",
544                 "summary": "We got an ERROR message on the bus",
545                 "level": "critical",
546                 "detected-on": "pipeline0"
547             }
548         ]
549     },
550     "validateelements.launch_pipeline.webrtcdspstartup-min-volume=12.play_15s issues": {
551         "tests": [
552             "validateelements.launch_pipeline.webrtcdspstartup-min-volume=12.play_15s"
553         ],
554         "issues": [
555             {
556                 "issue-id": "runtime::error-on-bus",
557                 "summary": "We got an ERROR message on the bus",
558                 "level": "critical",
559                 "detected-on": "pipeline0"
560             }
561         ]
562     },
563     "validateelements.launch_pipeline.webrtcdspstartup-min-volume=255.play_15s issues": {
564         "tests": [
565             "validateelements.launch_pipeline.webrtcdspstartup-min-volume=255.play_15s"
566         ],
567         "issues": [
568             {
569                 "issue-id": "runtime::error-on-bus",
570                 "summary": "We got an ERROR message on the bus",
571                 "level": "critical",
572                 "detected-on": "pipeline0"
573             }
574         ]
575     },
576     "validateelements.launch_pipeline.webrtcdsptarget-level-dbfs=0.play_15s issues": {
577         "tests": [
578             "validateelements.launch_pipeline.webrtcdsptarget-level-dbfs=0.play_15s"
579         ],
580         "issues": [
581             {
582                 "issue-id": "runtime::error-on-bus",
583                 "summary": "We got an ERROR message on the bus",
584                 "level": "critical",
585                 "detected-on": "pipeline0"
586             }
587         ]
588     },
589     "validateelements.launch_pipeline.webrtcdsptarget-level-dbfs=3.play_15s issues": {
590         "tests": [
591             "validateelements.launch_pipeline.webrtcdsptarget-level-dbfs=3.play_15s"
592         ],
593         "issues": [
594             {
595                 "issue-id": "runtime::error-on-bus",
596                 "summary": "We got an ERROR message on the bus",
597                 "level": "critical",
598                 "detected-on": "pipeline0"
599             }
600         ]
601     },
602     "validateelements.launch_pipeline.webrtcdsptarget-level-dbfs=31.play_15s issues": {
603         "tests": [
604             "validateelements.launch_pipeline.webrtcdsptarget-level-dbfs=31.play_15s"
605         ],
606         "issues": [
607             {
608                 "issue-id": "runtime::error-on-bus",
609                 "summary": "We got an ERROR message on the bus",
610                 "level": "critical",
611                 "detected-on": "pipeline0"
612             }
613         ]
614     },
615     "validateelements.launch_pipeline.webrtcdspvoice-detection-frame-size-ms=10.play_15s issues": {
616         "tests": [
617             "validateelements.launch_pipeline.webrtcdspvoice-detection-frame-size-ms=10.play_15s"
618         ],
619         "issues": [
620             {
621                 "issue-id": "runtime::error-on-bus",
622                 "summary": "We got an ERROR message on the bus",
623                 "level": "critical",
624                 "detected-on": "pipeline0"
625             }
626         ]
627     },
628     "validateelements.launch_pipeline.webrtcdspvoice-detection-frame-size-ms=30.play_15s issues": {
629         "tests": [
630             "validateelements.launch_pipeline.webrtcdspvoice-detection-frame-size-ms=30.play_15s"
631         ],
632         "issues": [
633             {
634                 "issue-id": "runtime::error-on-bus",
635                 "summary": "We got an ERROR message on the bus",
636                 "level": "critical",
637                 "detected-on": "pipeline0"
638             }
639         ]
640     },
641     "validateelements.launch_pipeline.webrtcdspvoice-detection=False.play_15s issues": {
642         "tests": [
643             "validateelements.launch_pipeline.webrtcdspvoice-detection=False.play_15s"
644         ],
645         "issues": [
646             {
647                 "issue-id": "runtime::error-on-bus",
648                 "summary": "We got an ERROR message on the bus",
649                 "level": "critical",
650                 "detected-on": "pipeline0"
651             }
652         ]
653     },
654     "validateelements.launch_pipeline.webrtcdspvoice-detection=True.play_15s issues": {
655         "tests": [
656             "validateelements.launch_pipeline.webrtcdspvoice-detection=True.play_15s"
657         ],
658         "issues": [
659             {
660                 "issue-id": "runtime::error-on-bus",
661                 "summary": "We got an ERROR message on the bus",
662                 "level": "critical",
663                 "detected-on": "pipeline0"
664             }
665         ]
666     },
667     "validateelements.launch_pipeline.cameracalibratedelay=2147483647.play_15s issues": {
668         "tests": ["validateelements.launch_pipeline.cameracalibratedelay=2147483647.play_15s issues"],
669         "issues": [
670             {
671                 "signame": "SIGIOT",
672                 "sometimes": True,
673             }
674         ]
675     }
676 }
677
678
679 def pspec_is_numeric(prop):
680     return prop.value_type in [GObject.TYPE_INT, GObject.TYPE_INT64,
681                                GObject.TYPE_UINT, GObject.TYPE_UINT64,
682                                GObject.TYPE_LONG, GObject.TYPE_ULONG,
683                                GObject.TYPE_DOUBLE,
684                                GObject.TYPE_FLOAT]
685
686
687 def get_pipe_and_populate(test_manager, klass, fname, prop, loop):
688     prop_value = Gst.ElementFactory.make(fname, None).get_property(prop.name)
689
690     if prop.value_type == GObject.TYPE_BOOLEAN:
691         if loop is 1:
692             bool_value = False
693         else:
694             bool_value = True
695         cname = fname + " %s=%s" % (prop.name, bool_value)
696         tname = fname + "%s=%s" % (prop.name, bool_value)
697     elif pspec_is_numeric(prop):
698         if loop is 2:
699             int_value = prop.default_value
700         elif loop is 1:
701             int_value = prop.minimum
702         else:
703             int_value = prop.maximum
704         cname = fname + " %s=%s" % (prop.name, int_value)
705         tname = fname + "%s=%s" % (prop.name, int_value)
706     else:
707         cname = fname + " %s=%s" % (prop.name, prop_value)
708         tname = fname + "%s=%s" % (prop.name, prop_value)
709
710     if "Audio" in klass:
711         cpipe = "audiotestsrc num-buffers=20 ! %s " % (cname)
712         sink = "! audioconvert ! %(audiosink)s"
713     elif "Video" in klass:
714         if "gl" in fname:
715             cname = "glfilterbin filter = %s" % (cname)
716         cpipe = "videotestsrc num-buffers=20 ! %s " % (cname)
717         sink = "! videoconvert ! %(videosink)s"
718     else:
719         return None
720
721     if test_manager.options.mute:
722         cpipe += "! fakesink"
723     else:
724         cpipe += "%s" % (sink)
725
726     return (tname, cpipe)
727
728
729 def setup_tests(test_manager, options):
730     print("Setting up tests to validate all elements")
731     pipelines_descriptions = []
732     test_manager.add_expected_issues(KNOWN_ISSUES)
733     test_manager.set_default_blacklist([
734         ("validateelements.launch_pipeline.videobox*",
735          "Those are broken pipelines."),
736         ("validateelements.launch_pipeline.frei0r*",
737          "video filter plugins"),
738         ("validateelements.launch_pipeline.smpte*",
739          "smpte cannot be tested with simple pipeline. Hence excluding"),
740         ("validateelements.launch_pipeline.glfilterbin*",
741          "glfilter bin doesnt launch."),
742         ("validateelements.launch_pipeline.audiomixmatrix*",
743          "Now deprecated and requires specific properties to be set."),
744     ])
745     valid_scenarios = ["play_15s"]
746     Gst.init(None)
747     factories = Gst.Registry.get().get_feature_list(Gst.ElementFactory)
748     for element_factory in factories:
749         audiosrc = False
750         audiosink = False
751         videosrc = False
752         videosink = False
753         klass = element_factory.get_metadata("klass")
754         fname = element_factory.get_name()
755
756         if "Audio" not in klass and "Video" not in klass:
757             continue
758
759         padstemplates = element_factory.get_static_pad_templates()
760         for padtemplate in padstemplates:
761             if padtemplate.static_caps.string:
762                 caps = padtemplate.get_caps()
763                 for i in range(caps.get_size()):
764                     structure = caps.get_structure(i)
765                     if "audio/x-raw" in structure.get_name():
766                         if padtemplate.direction == Gst.PadDirection.SRC:
767                             audiosrc = True
768                         elif padtemplate.direction == Gst.PadDirection.SINK:
769                             audiosink = True
770                     elif "video/x-raw" in structure.get_name():
771                         if padtemplate.direction == Gst.PadDirection.SRC:
772                             videosrc = True
773                         elif padtemplate.direction == Gst.PadDirection.SINK:
774                             videosink = True
775
776         if (audiosink is False and videosink is False) or (audiosrc is False and videosrc is False):
777             continue
778
779         element = Gst.ElementFactory.make(fname, None)
780         if element is None:
781             print("Could not create element: %s" % fname)
782             continue
783
784         props = GObject.list_properties(element)
785         for prop in props:
786             if "name" in prop.name or "parent" in prop.name or "qos" in prop.name or \
787                "latency" in prop.name or "message-forward" in prop.name:
788                 continue
789             if (prop.flags & GObject.ParamFlags.WRITABLE) and \
790                (prop.flags & GObject.ParamFlags.READABLE):
791                 if prop.value_type == GObject.TYPE_BOOLEAN:
792                     loop = 2
793                 elif pspec_is_numeric(prop):
794                     loop = 3
795                 else:
796                     loop = 0
797
798                 while loop:
799                     loop -= 1
800                     description = get_pipe_and_populate(test_manager, klass,
801                                                         fname, prop, loop)
802                     if None is not description:
803                         pipelines_descriptions.append(description)
804
805     # No restriction about scenarios that are potentially used
806     test_manager.add_scenarios(valid_scenarios)
807     test_manager.add_generators(test_manager.GstValidatePipelineTestsGenerator
808                                 ("validate_elements", test_manager,
809                                     pipelines_descriptions=pipelines_descriptions,
810                                     valid_scenarios=valid_scenarios))
811
812     return True