artiq/test/{not,harness}.py: usual CLI handling

This commit is contained in:
Robert Jördens 2016-01-18 15:43:57 -07:00
parent d7e4783cae
commit a1201252e2
2 changed files with 26 additions and 17 deletions

View File

@ -11,6 +11,7 @@ emulate the same behavior when invoked under lit.
import sys, os, argparse, importlib import sys, os, argparse, importlib
def main():
parser = argparse.ArgumentParser(description=__doc__) parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('-m', metavar='mod', type=str, parser.add_argument('-m', metavar='mod', type=str,
help='run library module as a script') help='run library module as a script')
@ -29,3 +30,6 @@ else:
with open(args.args[0]) as f: with open(args.args[0]) as f:
code = compile(f.read(), args.args[0], 'exec') code = compile(f.read(), args.args[0], 'exec')
exec(code) exec(code)
if __name__ == "__main__":
main()

View File

@ -1,2 +1,7 @@
import sys, subprocess import sys, subprocess
def main():
exit(not subprocess.call(sys.argv[1:])) exit(not subprocess.call(sys.argv[1:]))
if __name__ == "__main__":
main()