[test] Add presubmit support for release scripts

This adds one of the release unittests to presubmit.

Different entry points for CI and CQ are required.

More tests will follow in subsequent CLs.

BUG=chromium:701296
NOTRY=true

Change-Id: Ie96fba873f77df14efb1dc54388f075c056b64a6
Reviewed-on: https://chromium-review.googlesource.com/454639
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43831}
This commit is contained in:
Michael Achenbach 2017-03-14 17:06:31 +01:00 committed by Commit Bot
parent ead696dc88
commit 8692e7b86b
3 changed files with 19 additions and 0 deletions

View File

@ -521,6 +521,12 @@ def CheckDeps(workspace):
return subprocess.call([sys.executable, checkdeps_py, workspace]) == 0
def PyTests(workspace):
test_scripts = join(workspace, 'tools', 'release', 'test_scripts.py')
return subprocess.call(
[sys.executable, test_scripts], stdout=subprocess.PIPE) == 0
def GetOptions():
result = optparse.OptionParser()
result.add_option('--no-lint', help="Do not run cpplint", default=False,
@ -543,6 +549,8 @@ def Main():
success &= SourceProcessor().RunOnPath(workspace)
print "Running status-files check..."
success &= StatusFilesProcessor().RunOnPath(workspace)
print "Running python tests..."
success &= PyTests(workspace)
if success:
return 0
else:

View File

@ -0,0 +1,8 @@
# Copyright 2017 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def CheckChangeOnCommit(input_api, output_api):
tests = input_api.canned_checks.GetUnitTestsInDirectory(
input_api, output_api, '.', whitelist=['test_scripts.py$'])
return input_api.RunTests(tests)

3
tools/release/test_scripts.py Normal file → Executable file
View File

@ -1920,3 +1920,6 @@ Cr-Commit-Position: refs/heads/4.2.71@{#1}
},],
}
self.assertEquals(expected_json, json.loads(FileToText(json_output)))
if __name__ == '__main__':
unittest.main()