r199: This commit was manufactured by cvs2svn to create tag 'hv_1_1_9'.
[cinelerra_cv/ct.git] / hvirtual / libsndfile / check_libsndfile.py
blob841a0d06f781d13eb78ed1e004ed0ed657223a4a
1 #!/usr/bin/env python
3 import commands, os, string, sys
5 # This program tests libsndfile against a user provided list of audio files.
6 # The list is provided as a text file.
7 #
9 _EXE_NAME = 'examples/sndfile-info'
12 def dump_status_output_exit (status, output, msg = None):
13 if msg:
14 print msg
15 print "Status :", status
16 print output
17 sys.exit (0)
19 def sfinfo_check_ok (filename):
20 cmd = '%s %s' % (_EXE_NAME, filename)
21 (status, output) = commands.getstatusoutput (cmd)
22 if status:
23 dump_status_output_exit (status, output, "Bad status. Dumping")
24 if string.find (output, "should") > 0:
25 dump_status_output_exit (status, output, "Found `should'. Dumping")
26 if string.find (output, "*") > 0:
27 dump_status_output_exit (status, output, "Found `*'. Dumping")
28 return
30 def sfinfo_check_not_crash (filename):
31 print filename
33 _USAGE = """
34 This is the usage message.
36 """
38 if len (sys.argv) != 2:
39 print _USAGE
40 sys.exit (0)
43 if not os.path.isfile (_EXE_NAME):
44 print "Could not find required program :", _EXE_NAME
45 sys.exit (0)
47 list_file = open (sys.argv [1])
49 while 1:
50 line = list_file.readline ()
51 if not line:
52 break
53 line = string.strip (line)
54 if len (line) < 1:
55 continue
56 if line [0] == '#':
57 continue
58 print line
59 if os.path.isfile ('/home/erikd/' + line):
60 sfinfo_check_ok ('/home/erikd/' + line)
61 else:
62 print "Bad file name : ", line
63 sys.exit (0)
65 list_file.close ()
67 print "Finished. No errors found."