Commit b227bf9d authored by adoneria's avatar adoneria Committed by Commit Bot

[updater] pass build dir to tests.

Also changes test case superclass to typ.TestCase.

Bug: 1141577
Change-Id: I0d9b4b38543d1cd904808d9f85b6aa27ab973c5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2496180Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Commit-Queue: Anjali Doneria <adoneria@google.com>
Cr-Commit-Position: refs/heads/master@{#820849}
parent a6aff8a2
...@@ -347,9 +347,13 @@ if (is_win || is_mac) { ...@@ -347,9 +347,13 @@ if (is_win || is_mac) {
script_test("updater_integration_tests") { script_test("updater_integration_tests") {
script = "//testing/scripts/run_isolated_script_test.py" script = "//testing/scripts/run_isolated_script_test.py"
args = [ "@WrappedPath(" + args = [
rebase_path("//chrome/updater/run_updater_tests.py", "@WrappedPath(" +
root_build_dir) + ")" ] rebase_path("//chrome/updater/run_updater_tests.py", root_build_dir) +
")",
"--build-dir",
"@WrappedPath(" + rebase_path(root_build_dir) + ")",
]
data = [ data = [
"//chrome/updater/run_updater_tests.py", "//chrome/updater/run_updater_tests.py",
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import argparse
import logging
import sys import sys
from test.integration_tests.common import path_finder from test.integration_tests.common import path_finder
...@@ -9,12 +11,34 @@ path_finder.add_typ_dir_to_sys_path() ...@@ -9,12 +11,34 @@ path_finder.add_typ_dir_to_sys_path()
import typ import typ
class Context(object):
def __init__(self, build_dir):
self.build_dir = build_dir
def main(): def main():
return typ.main( parser = typ.ArgumentParser()
tests=[path_finder.get_integration_tests_dir()], parser.add_argument('--build-dir',
) help='Specifies chromium build directory.')
runner = typ.Runner()
# Set this when using context that will be passed to tests.
runner.win_multiprocessing = typ.WinMultiprocessing.importable
runner.parse_args(parser,
argv=None,
tests=[path_finder.get_integration_tests_dir()])
# setup logging level
if runner.args.verbose > 1:
level = logging.DEBUG
else:
level = logging.INFO
logging.basicConfig(level=level)
runner.context = Context(runner.args.build_dir)
return runner.run()[0]
if __name__ == "__main__": if __name__ == "__main__":
sys.exit(main()) sys.exit(main())
...@@ -4,13 +4,20 @@ ...@@ -4,13 +4,20 @@
"""Sample test case to run on chromium infra.""" """Sample test case to run on chromium infra."""
import unittest import logging
import typ
class HelloTest(unittest.TestCase): class HelloTest(typ.TestCase):
def test_hello(self): def test_hello(self):
logging.info('Hello World!')
pass pass
def test_build_dir(self):
logging.debug('Build dir = %s', self.context.build_dir)
self.assertTrue(self.context.build_dir is not None)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
...@@ -12,13 +12,12 @@ intended action before test run and after test run respectively. ...@@ -12,13 +12,12 @@ intended action before test run and after test run respectively.
import logging import logging
import os import os
import unittest import typ
from test.integration_tests.common import logger_util from test.integration_tests.common import logger_util
from test.integration_tests.updater.lib import updater_util from test.integration_tests.updater.lib import updater_util
class UpdaterTestBase(unittest.TestCase): class UpdaterTestBase(typ.TestCase):
"""Base test class for updater testing on new infra.""" """Base test class for updater testing on new infra."""
@classmethod @classmethod
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment