• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2
3import sys
4import time
5
6if len(sys.argv) != 2:
7    raise ValueError("unexpected number of args")
8
9if sys.argv[1] == "--gtest_list_tests":
10    print("""\
11T.
12  QuickSubTest
13  InfiniteLoopSubTest
14""")
15    sys.exit(0)
16elif not sys.argv[1].startswith("--gtest_filter="):
17    raise ValueError("unexpected argument: %r" % (sys.argv[1]))
18
19test_name = sys.argv[1].split('=',1)[1]
20if test_name == 'T.QuickSubTest':
21    print('I am QuickSubTest, I PASS')
22    print('[  PASSED  ] 1 test.')
23    sys.exit(0)
24elif test_name == 'T.InfiniteLoopSubTest':
25    print('I am InfiniteLoopSubTest, I will hang')
26    while True:
27        pass
28else:
29    raise SystemExit("error: invalid test name: %r" % (test_name,))
30