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.
9 _EXE_NAME
= 'examples/sndfile-info'
12 def dump_status_output_exit (status
, output
, msg
= None):
15 print "Status :", status
19 def sfinfo_check_ok (filename
):
20 cmd
= '%s %s' % (_EXE_NAME
, filename
)
21 (status
, output
) = commands
.getstatusoutput (cmd
)
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")
30 def sfinfo_check_not_crash (filename
):
34 This is the usage message.
38 if len (sys
.argv
) != 2:
43 if not os
.path
.isfile (_EXE_NAME
):
44 print "Could not find required program :", _EXE_NAME
47 list_file
= open (sys
.argv
[1])
50 line
= list_file
.readline ()
53 line
= string
.strip (line
)
59 if os
.path
.isfile ('/home/erikd/' + line
):
60 sfinfo_check_ok ('/home/erikd/' + line
)
62 print "Bad file name : ", line
67 print "Finished. No errors found."