Home | History | Annotate | Download | only in DummySubDir
      1 #!/usr/bin/env python
      2 
      3 import sys
      4 import time
      5 
      6 if len(sys.argv) != 2:
      7     raise ValueError("unexpected number of args")
      8 
      9 if sys.argv[1] == "--gtest_list_tests":
     10     print("""\
     11 FirstTest.
     12   subTestA
     13   subTestB
     14   subTestC
     15 """)
     16     sys.exit(0)
     17 elif not sys.argv[1].startswith("--gtest_filter="):
     18     raise ValueError("unexpected argument: %r" % (sys.argv[1]))
     19 
     20 test_name = sys.argv[1].split('=',1)[1]
     21 if test_name == 'FirstTest.subTestA':
     22     print('I am subTest A, I PASS')
     23     print('[  PASSED  ] 1 test.')
     24     sys.exit(0)
     25 elif test_name == 'FirstTest.subTestB':
     26     print('I am subTest B, I am slow')
     27     time.sleep(6)
     28     print('[  PASSED  ] 1 test.')
     29     sys.exit(0)
     30 elif test_name == 'FirstTest.subTestC':
     31     print('I am subTest C, I will hang')
     32     while True:
     33         pass
     34 else:
     35     raise SystemExit("error: invalid test name: %r" % (test_name,))
     36