示例#1
0
def _Main():
    """Runs all tests for Google Test."""

    options, args = run_tests_util.ParseArgs('gtest')
    test_runner = run_tests_util.TestRunner(script_dir=SCRIPT_DIR)
    tests = test_runner.GetTestsToRun(args, options.configurations,
                                      options.built_configurations)
    if not tests:
        sys.exit(1)  # Incorrect parameters given, abort execution.

    sys.exit(test_runner.RunTests(tests[0], tests[1]))
示例#2
0
def _Main():
    """Runs all tests for Google Mock."""

    options, args = run_tests_util.ParseArgs('gtest')
    test_runner = run_tests_util.TestRunner(
        script_dir=SCRIPT_DIR,
        build_dir_var_name='GMOCK_BUILD_DIR',
        injected_build_dir_finder=GetGmockBuildDir)
    tests = test_runner.GetTestsToRun(args, options.configurations,
                                      options.built_configurations)
    if not tests:
        sys.exit(1)  # Incorrect parameters given, abort execution.

    sys.exit(test_runner.RunTests(tests[0], tests[1]))
    def testOptionH(self):
        help_called = [False]

        # Suppresses lint warning on unused arguments.  These arguments are
        # required by optparse, even though they are unused.
        # pylint: disable-msg=W0613
        def VerifyHelp(option, opt, value, parser):
            help_called[0] = True

        # Verifies that -h causes the help callback to be called.
        help_called[0] = False
        _, args = run_tests_util.ParseArgs('gtest',
                                           argv=['script.py', '-h'],
                                           help_callback=VerifyHelp)
        self.assertEqual(args, ['script.py'])
        self.assertTrue(help_called[0])

        # Verifies that --help causes the help callback to be called.
        help_called[0] = False
        _, args = run_tests_util.ParseArgs('gtest',
                                           argv=['script.py', '--help'],
                                           help_callback=VerifyHelp)
        self.assertEqual(args, ['script.py'])
        self.assertTrue(help_called[0])
 def testOptionCAndOptionB(self):
     options, args = run_tests_util.ParseArgs(
         'gtest', argv=['script.py', '-c', 'dbg', '-b'])
     self.assertEqual(args, ['script.py'])
     self.assertEqual(options.configurations, 'dbg')
     self.assertTrue(options.built_configurations)
 def testOptionA(self):
     options, args = run_tests_util.ParseArgs('gtest',
                                              argv=['script.py', '-a'])
     self.assertEqual(args, ['script.py'])
     self.assertEqual(options.configurations, 'all')
     self.assertFalse(options.built_configurations)
 def testNoOptions(self):
     options, args = run_tests_util.ParseArgs('gtest', argv=['script.py'])
     self.assertEqual(args, ['script.py'])
     self.assert_(options.configurations is None)
     self.assertFalse(options.built_configurations)