Changeset 807 for tester


Ignore:
Timestamp:
06/09/18 15:51:37 (7 years ago)
Author:
Maciej Komosinski
Message:

The -f/--file argument is now mandatory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester/tester.py

    r798 r807  
    152152
    153153
    154 def main(main_test_filename):
     154def main():
    155155        global input_text, name_template, test_name, exe_prog, exeargs
    156156        name_template = ""
     
    160160        parser.add_argument("-val", "--valgrind", help="Use valgrind", action="store_true")
    161161        parser.add_argument("-c", "--nocolor", help="Don't use color output", action="store_true")
    162         parser.add_argument("-f", "--file", help="File name with tests, default is '" + main_test_filename + "'")
     162        parser.add_argument("-f", "--file", help="File name with tests", required=True)
    163163        parser.add_argument("-tp", "--tests-path", help="tests directory, files containing test definitions, inputs and outputs are relative to this directory, default is '" + globals.THISDIR + "'")
    164164        parser.add_argument("-fp", "--files-path", help="files directory, files tested by OUTFILECOMPARE are referenced relative to this directory, default is '" + globals.FILESDIR + "'")
     
    168168        parser.add_argument("-ds", "--diffslashes", help="Discriminate between slashes (consider / and \\ different)", action="store_true")
    169169        parser.add_argument("-err", "--always-show-stderr", help="Always print stderr (by default it is hidden if 0 errors in valgrind)", action="store_true")
    170         parser.add_argument("-e", "--exe", help="Regexp 'search=replace' rule(s) transforming executable name(s) into paths (eg. '(.*)=path/to/\\1.exe')", action='append') #in the exaxmple, double backslash is just for printing
     170        parser.add_argument("-e", "--exe", help="Regexp 'search=replace' rule(s) transforming executable name(s) into paths (eg. '(.*)=path/to/\\1.exe')", action='append')  # in the example, double backslash is just for printing
    171171        parser.add_argument("-p", "--platform", help="Override platform identifier (referencing platform specific files " + globals.SPEC_INSERTPLATFORMDEPENDENTFILE + "), default:sys.platform (win32,linux2)")
    172172        args = parser.parse_args()
     
    178178                main_test_filename = args.file
    179179        if args.tests_path:
    180                 globals.THISDIR=args.tests_path
     180                globals.THISDIR = args.tests_path
    181181        if args.files_path:
    182                 globals.FILESDIR=args.files_path
     182                globals.FILESDIR = args.files_path
    183183        if args.working_path:
    184                 globals.EXEDIR=args.working_path
     184                globals.EXEDIR = args.working_path
    185185        if args.name:
    186186                name_template = args.name
     
    196196        globals.init_colors(args)
    197197
    198         fin = open(os.path.join(globals.THISDIR, main_test_filename))
     198        fin = open(os.path.join(globals.THISDIR, args.file))
    199199        reset_values()
    200         exe_prog = "default" # no longer in reset_values (exe: persists across tests)
     200        exe_prog = "default"  # no longer in reset_values (exe: persists across tests)
    201201        outfile = []
    202202        tests_failed = 0
     
    255255
    256256if __name__ == "__main__":
    257         tests_failed, tests_total = main("testy.txt")
     257        tests_failed, tests_total = main()
    258258        print("%d / %d failed tests" % (tests_failed, tests_total))
    259259        sys.exit(tests_failed)  # return the number of failed tests as exit code ("error level") to shell
Note: See TracChangeset for help on using the changeset viewer.