| 1134 | |
| 1135 | |
| 1136 | def _main(): |
| 1137 | # Configure the standard streams to be unicode compatible |
| 1138 | sys.stdout.reconfigure(encoding='cp850') |
| 1139 | sys.stderr.reconfigure(encoding='cp850') |
| 1140 | |
| 1141 | start_dt = datetime.now() |
| 1142 | print(f'Starting Surelog Regression Tests @ {str(start_dt)}') |
| 1143 | |
| 1144 | parser = argparse.ArgumentParser() |
| 1145 | |
| 1146 | parser.add_argument( |
| 1147 | 'mode', choices=['run', 'report', 'update', 'extract'], type=str, help='Pick from available choices') |
| 1148 | parser.add_argument( |
| 1149 | '--workspace-dirpath', dest='workspace_dirpath', required=False, default=_default_workspace_dirpath, type=str, |
| 1150 | help='Workspace root, either absolute or relative to current working directory.') |
| 1151 | parser.add_argument( |
| 1152 | '--test-dirpaths', dest='test_dirpaths', required=False, default=_default_test_dirpaths, nargs='*', type=str, |
| 1153 | help='Directories, either absolute or relative to workspace directory, to scan for tests.') |
| 1154 | parser.add_argument( |
| 1155 | '--output-dirpath', dest='output_dirpath', required=False, default=_default_output_dirpath, type=str, |
| 1156 | help='Output directory path, either absolute or relative to the workspace directory.') |
| 1157 | parser.add_argument( |
| 1158 | '--build-dirpath', dest='build_dirpath', required=False, default=_default_build_dirpath, type=str, |
| 1159 | help='Directory, either absolute or relative to workspace directory, to locate surelog binary') |
| 1160 | parser.add_argument( |
| 1161 | '--surelog-filepath', dest='surelog_filepath', required=False, default=_default_surelog_filepath, type=str, |
| 1162 | help='Location, either absolute or relative to build directory, of surelog executable') |
| 1163 | parser.add_argument( |
| 1164 | '--uhdm-lint-filepath', dest='uhdm_lint_filepath', required=False, default=_default_uhdm_lint_filepath, type=str, |
| 1165 | help='Location, either absolute or relative to build directory, of uhdm-lint executable') |
| 1166 | parser.add_argument( |
| 1167 | '--roundtrip-filepath', dest='roundtrip_filepath', required=False, default=_default_roundtrip_filepath, type=str, |
| 1168 | help='Location, either absolute or relative to build directory, of roundtrip executable') |
| 1169 | parser.add_argument( |
| 1170 | '--filters', nargs='+', required=False, default=[], type=str, help='Filter tests matching these regex inputs') |
| 1171 | parser.add_argument( |
| 1172 | '--jobs', nargs='?', required=False, default=multiprocessing.cpu_count(), type=int, |
| 1173 | help='Run tests in parallel, optionally providing max number of concurrent processes. Set 0 to run sequentially.') |
| 1174 | parser.add_argument( |
| 1175 | '--show-diffs', dest='show_diffs', required=False, default=False, action='store_true', |
| 1176 | help='Show file differences when applicable.') |
| 1177 | parser.add_argument( |
| 1178 | '--tool', dest='tool', choices=['ddd', 'valgrind'], required=False, default=None, type=str, |
| 1179 | help='Run regression test using specified tool.') |
| 1180 | parser.add_argument('--mt', dest='mt', default=None, type=str, help='Enable multithreading mode') |
| 1181 | parser.add_argument('--mp', dest='mp', default=None, type=str, help='Enable multiprocessing mode') |
| 1182 | parser.add_argument( |
| 1183 | '--zipfile-path', dest='zipfile_path', required=False, type=str, |
| 1184 | help='Path to zipfile to extract logs from.') |
| 1185 | parser.add_argument('--num_shards', dest='num_shards', required=False, |
| 1186 | type=int, default=1, help='Number of shards') |
| 1187 | parser.add_argument('--shard', dest='shard', required=False, |
| 1188 | type=int, default=0, help='This shard') |
| 1189 | |
| 1190 | args = parser.parse_args() |
| 1191 | |
| 1192 | if (args.shard >= args.num_shards): |
| 1193 | print("Shard %d out of range 0..%d" % (args.shard, args.num_shards - 1)) |