source: proto/SymbolTable/test/config.py @ 4183

Last change on this file since 4183 was 1461, checked in by vla24, 8 years ago

SymbolTable?: refactored code.

File size: 3.0 KB
Line 
1import argparse
2from argparse import RawTextHelpFormatter
3
4def implementation_options(string):
5    """Checks if string is a valid symbol table implementation."""
6    if string not in implementations_list:
7        msg = string + " is not a valid Symbol Table implementation. Valid implementations are " + str(implementations_list)
8        raise argparse.ArgumentTypeError(msg)
9    return string
10
11def get_argument_parser(impls_list):
12    """Returns an C{argparse.parse_args} instance tied to this configuration.
13       impls_list is a list of available symbol table implementations"""
14
15    global implementations_list
16    implementations_list = impls_list
17
18    parser = argparse.ArgumentParser(description='Symbol Table test suite for various implementations and test files', formatter_class=RawTextHelpFormatter)
19
20    # Group mode definition
21    parser.add_argument('-I', '--IDISA',
22                        required=False,
23                        dest='use_idisa',
24                        action='store_true',
25                        default=False,
26                        help='Compile with IDISA library (default: false)'
27                        )
28
29    parser.add_argument('-o', '--output',
30            required=False,
31            dest='output_dir',
32            default="output/",
33            help='Output directory. By default all output will be stored in ./output/'
34            )
35
36    parser.add_argument('-t', '--testfiles',
37             required=False,
38             dest='testfiles',
39             nargs='+',
40             help='List of testfiles. If no test file is specified, then default tests will be used.'
41             )
42
43    parser.add_argument('-DT', '--defaultTests',
44             required=False,
45             action='store_true',
46             default=False,
47             dest='use_default_test',
48             help='Run default tests in addition to user provided tests'
49             )
50
51    parser.add_argument('-i', '--implementations',
52             required=False,
53             dest='implementations',
54             nargs='+',
55             type=implementation_options,
56             help='Implementations to be tested include\n'+
57                             'stl \t\t is a standard symbol table implementation using C++ STL\'s hashmap \n' +
58                             'ls \t\t is a symbol table implementation using length sorting algorithm (Ken\'s implementation)\n' +
59                             'hash \t\t is a symbol table implementation using Jestress Hashing Function\n' +
60                             'id \t\t does not use parallel bitstream-based length sorting technique. However, the symbols are stored using identity length grouping.\n' +
61                             'pbgs_id \t is a parallel bitstream-based length sorting symbol table with identity length grouping\n' +
62                             'pbgs_id_adv \t is a parallel bitstream-based length sorting symbol table with identity length grouping. It uses advance32 and interpose32 technique in parabix \n' +
63                             'pbgs_log \t is a parallel bitstream-based length sorting symbol table with log length grouping \n' +
64                             'pbgs_div \t is a parallel bitstream-based length sorting symbol table with division by two length grouping \n' +
65                             'If no implementation is specified, then all available implementations will be tested'
66                        )
67
68    return parser
Note: See TracBrowser for help on using the repository browser.