Changeset 3241 for proto/PDF/test


Ignore:
Timestamp:
May 30, 2013, 1:38:57 PM (6 years ago)
Author:
ksherdy
Message:

Del readme.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/PDF/test/run_tests.py

    r2664 r3241  
    11#
    2 # run_tests.py - Length Sorted Symbol Table Tests
     2# run_tests.py
    33#
    4 # Quick-and-dirty Python symbol table test script
    5 # to generates expected output files for diff and gid tests.
     4# Quick-and-dirty Python PDF test script.
     5# Generates expected output files.
     6# Diffs generated files against expected values.
    67#
    78# Created on: April 12, 2012
    8 # Author: Ken Herdy
     9# Modified: November 2012 - Re-targetted for PDF tests.
     10# Author: Ken Herdy, Ben Hull
    911#
    1012#----------------------------------------------------------------------------
    1113# Edit:
    12 program_dir_path='..'
     14#program_path='../pdf.py'
    1315test_dir_path='../test/data'
    14 out_dir_path='../test/pout'
     16out_dir_path='../test/out'
     17test_suffix='.in'
     18
    1519#----------------------------------------------------------------------------
    1620import sys
     
    2428#----------------------------------------------------------------------------
    2529
    26 def diff_testcase(program, input_file, outfile_root):
     30def gen_test_file(program, input_file, outfile_root):
    2731        (head, tail) = os.path.split(input_file)
    2832        temp = head[head.find('/')+1:]
     
    3539        print head + os.path.sep + tail
    3640        out_f = open(head + os.path.sep + tail, 'w')
    37         if program[-3:]=='.py':
     41        if program.endswith('.py'):
    3842                subprocess.call(['python', program, input_file], stderr=None, stdout=out_f)
    3943        else:
     
    4145        out_f.close()
    4246
    43 def gen_test_files(test_dir_path):
     47def gen_test_file_list(test_dir_path):
    4448    test_files = []
    4549    for dirname, dirnames, filenames in os.walk(test_dir_path):
    4650            for filename in filenames:
    47                     if filename.endswith('.test') and not filename.endswith('.svn-base'):
     51                    if filename.endswith(test_suffix) and not filename.endswith('.svn-base'):
    4852                            test_files.append(os.path.relpath(os.path.join(dirname, filename)))
    4953    return test_files
     
    5660        """Return an C{optparse.OptionParser} instance tied to this configuration."""
    5761       
    58         parser = optparse.OptionParser(usage='python %prog [options] <program>',
    59                                         version='1.0',
    60                                         )
     62        parser = optparse.OptionParser(usage='python %prog', version='1.0')
    6163
    6264        return parser
     
    6567if __name__ == "__main__":
    6668
    67         option_parser = get_option_parser()
     69        option_parser = get_option_parser()
    6870        options, args = option_parser.parse_args(sys.argv[1:])
    6971
     
    7274            sys.exit()
    7375
    74         program = os.path.join(program_dir_path,sys.argv[1])
    75         test_files = gen_test_files(test_dir_path)
     76        if not os.path.isfile(sys.argv[1]):
     77            option_parser.print_usage()
     78            sys.exit()
     79
     80        program = sys.argv[1]
     81
     82        test_files = gen_test_file_list(test_dir_path)
     83
     84        print test_files
    7685
    7786        for test_file in test_files:
    78                 diff_testcase(program, test_file, out_dir_path)
     87                gen_test_file(program, test_file, out_dir_path)
Note: See TracChangeset for help on using the changeset viewer.