File: testCsoundManual.py

package info (click to toggle)
csound 1%3A6.18.1%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 63,220 kB
  • sloc: ansic: 192,643; cpp: 14,149; javascript: 9,654; objc: 9,181; python: 3,376; java: 3,337; sh: 1,840; yacc: 1,255; xml: 985; perl: 635; lisp: 411; tcl: 341; lex: 217; makefile: 128
file content (43 lines) | stat: -rw-r--r-- 999 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python

import os, fnmatch

SRC_DIR="../../manual/examples/"
print SRC_DIR

matches = []
for root, dirnames, filenames in os.walk(SRC_DIR):
  for filename in fnmatch.filter(filenames, '*.csd'):
      matches.append(os.path.join(root, filename))

csoundCommand = "csound -+msg_color=0 --new-parser --syntax-check-only \"%s\" 2> %s"
outputFile = "/tmp/catalog-tmp.txt"
output = ''

success = 0
fail = 0
total = len(matches)

for csd in matches:
  ex = csoundCommand % (csd, outputFile)
  retVal = os.system(ex)
  print csd, '\t', retVal
  if retVal != 0:
    output += "=======================\n"
    output += "%s\t%s\n"%(csd, retVal) 
    output += "=======================\n"
    f = open(outputFile,'r')
    for line in f:
      output += line 
    f.close()
    output += '\n\n'
    fail += 1
  else:
    success += 1

f = open('manual_results.txt', 'w')
f.write(output)
f.flush()
f.close()

print "\nTESTS COMPLETE:\n\tSUCCESS\t%d\n\tFAIL\t%d\n\tTOTAL\t%d"%(success, fail, total)