source: trunk/third/gstreamer/testsuite/elements/gst-inspect-check.in @ 21005

Revision 21005, 1.7 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21004, which included commits to RCS files with non-trunk default branches.
  • Property svn:executable set to *
RevLine 
[21004]1#!/usr/bin/perl -w
2
3# checks all built plugins by running gst-inspect on each element
4# and checking for warnings on stderr
5
6### packages
7
8use File::Basename;
9
10print "                  _______\n";
11print "         (__)    /       \\\n";
12print "         (oo)   (  M O O  )\n";
13print "  /-------\\/  --'\\_______/\n";
14print " / |     ||\n";
15print "*  ||----||\n";
16print "   ^^    ^^\n";
17
18my $num_warnings = 0;
19my $path = `dirname $0`;
20chomp $path;
21$path = "../../tools";
22
23$gst_inspect = "$path/gst-inspect-@GST_MAJORMINOR@";
24
25sub check_all_elements
26{
27        #send stderr to /dev/null
28        my $command = "$gst_inspect 2>/dev/null";
29        my @lines = `$command`;
30
31        if (!@lines) {
32                print ("gst-inspect returned nothing\n");
33                return -1;
34        }
35        while ($_ = shift(@lines)){
36                my @matches = m/^\w+:\s+(\w+):/;
37                if(@matches){
38                        check_element($matches[0]);
39                }
40        }
41        if ($num_warnings > 0){
42                print("there are $num_warnings warnings to be fixed\n");
43                return -1;
44        }
45        return 0;
46}
47
48sub check_element($)
49{
50        my ($element) = @_;
51        print "running inspect on $element\n";
52
53        # capture stderr, send stdout to /dev/null
54        my $command = "$gst_inspect $element 2>&1 1>/dev/null";
55       
56        my @lines = `$command`;
57
58        while ($_ = shift(@lines)){
59                # ignore INFO lines, they are ok
60                if (! /INFO/){
61                        print $_;
62                       
63                        # do this to ignore empty lines
64                        if (length > 1){
65                                $num_warnings++;
66                        }
67                }
68        }
69        system("$gst_inspect $element 2>/dev/null 1>/dev/null");
70        if ($? != 0){
71                my $exit_value  = $? >> 8;
72                my $signal_num  = $? & 127;
73                my $dumped_core = $? & 128;
74                if ($exit_value){
75                        print("error value on exit: $exit_value\n");
76                }
77                if ($signal_num){
78                        print("signal caused exit: $signal_num\n");
79                }
80                if ($dumped_core){
81                        print("dumped core: $dumped_core\n");
82                }
83                $num_warnings++
84        }
85}
86
87### main
88
89exit check_all_elements ();
90
Note: See TracBrowser for help on using the repository browser.