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

[updater] pass build-dir to test case.

Fix broken Windows Deterministic builder issue that caused revert
crrev.com/c/2502022.
Change test cases to use typ.TestCase instead of unittest.TestCase.

Bug: 1141577
Change-Id: I79d6c93dd15c2e3e727c5368a97142d5572c1c51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2503396Reviewed-by: default avatarSorin Jianu <sorin@chromium.org>
Reviewed-by: default avatarDirk Pranke <dpranke@google.com>
Commit-Queue: Anjali Doneria <adoneria@google.com>
Cr-Commit-Position: refs/heads/master@{#821824}
parent 05f7a92e
......@@ -347,9 +347,13 @@ if (is_win || is_mac) {
script_test("updater_integration_tests") {
script = "//testing/scripts/run_isolated_script_test.py"
args = [ "@WrappedPath(" +
rebase_path("//chrome/updater/run_updater_tests.py",
root_build_dir) + ")" ]
args = [
"@WrappedPath(" +
rebase_path("//chrome/updater/run_updater_tests.py", root_build_dir) +
")",
"--build-dir",
"@WrappedPath(" + rebase_path(root_build_dir, root_build_dir) + ")",
]
data = [
"//chrome/updater/run_updater_tests.py",
......
......@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import logging
import sys
from test.integration_tests.common import path_finder
......@@ -9,12 +11,34 @@ path_finder.add_typ_dir_to_sys_path()
import typ
class Context(object):
def __init__(self, build_dir):
self.build_dir = build_dir
def main():
return typ.main(
tests=[path_finder.get_integration_tests_dir()],
)
parser = typ.ArgumentParser()
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__":
sys.exit(main())
sys.exit(main())
......@@ -4,13 +4,19 @@
"""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):
logging.info('Hello World!')
pass
def test_build_dir(self):
logging.info('Build dir = %s', self.context.build_dir)
self.assertTrue(self.context.build_dir is not None)
if __name__ == '__main__':
unittest.main()
......@@ -23,6 +23,7 @@ class InstallTest(test_base.UpdaterTestBase):
super(InstallTest, self).tearDown()
def test_install(self):
logging.info('Build dir: %s', self.context.build_dir)
updater_util.Install()
......
......@@ -12,13 +12,13 @@ intended action before test run and after test run respectively.
import logging
import os
import unittest
import typ
from test.integration_tests.common import logger_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."""
@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