source: tests/list_missing_tests @ e86676b

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since e86676b was b660fbc, checked in by Paul Brossier <piem@piem.org>, 17 years ago

list_missing_tests: add examples tests

  • Property mode set to 100755
File size: 2.2 KB
Line 
1#! /usr/bin/python
2
3from glob import glob
4from os.path import splitext, exists, join, dirname, basename
5import sys
6
7def check_tst_against_src(src_dir, src_ext, ext_dir, verbose = False, tst_prefix = ''):
8  src_files = [ basename(file) for file in glob( join(src_dir, '*'+src_ext) ) ]
9  src_files.sort()
10  status = 0
11  for src_file in src_files:
12    tst_file = (splitext(src_file)[0] + tst_ext).replace(tst_prefix,"")
13    if not exists(join(tst_dir,tst_prefix+tst_file)):
14      print "%20s [X]" % src_file, "[ ] %s" % tst_file
15      status = 1
16    elif verbose:
17      print "%20s [X]" % src_file, "[X] %s" % tst_file
18  return status
19
20def check_src_against_tst(tst_dir, tst_ext, src_dir, verbose = False, tst_prefix = ''):
21  tst_files = [ basename(file) for file in glob( join(tst_dir, '*'+tst_ext) ) ]
22  tst_files.sort()
23  status = 0
24  for tst_file in tst_files:
25    src_file = (splitext(tst_file)[0] + src_ext).replace(tst_prefix,"")
26    if not exists(join(src_dir,src_file)):
27      print "%20s [ ]" % src_file, "[X] %s" % tst_file
28      status = 2
29    elif verbose:
30      print "%20s [X]" % src_file, "[X] %s" % tst_file
31  return status
32
33def check_two_ways(src_dir, src_ext, tst_dir, tst_ext, verbose = False, tst_prefix = ''):
34  print "%20s    " % (" FILES IN " + src_dir) + "|" + "    FILES IN " + tst_dir
35  status  = check_tst_against_src(src_dir, src_ext, tst_dir, verbose = verbose, tst_prefix = tst_prefix)
36  status += check_src_against_tst(tst_dir, tst_ext, src_dir, verbose = verbose, tst_prefix = tst_prefix)
37  return status
38
39if __name__ == '__main__':
40
41  if len(sys.argv) > 1: verbose = True
42  else: verbose = False
43
44  base_directory = dirname(sys.argv[0])
45
46  status = 0
47
48  src_dir = join(base_directory,'..','src')
49  src_ext = '.c'
50  tst_dir = join(base_directory,'python')
51  tst_ext = '.py'
52  status += check_two_ways(src_dir, src_ext, tst_dir, tst_ext, verbose = verbose)
53
54  tst_dir = join(base_directory,'src')
55  tst_ext = '.c'
56  status += check_two_ways(src_dir, src_ext, tst_dir, tst_ext, verbose = verbose, tst_prefix = 'test-')
57
58  src_dir = join(base_directory,'..','examples')
59  src_ext = '.c'
60  tst_dir = join(base_directory,'python','examples')
61  tst_ext = '.py'
62  status += check_two_ways(src_dir, src_ext, tst_dir, tst_ext, verbose = verbose)
63
64  sys.exit(status)
Note: See TracBrowser for help on using the repository browser.