relesetools: Enable releasetools_test in presubmit.

About half of the testcases rely on external tools (i.e. the ones in
`otatools.zip`, which are external to releasetools module, but still
built by Android). It's WAI as releasetools scripts are mostly for
gluing purpose.

However, the current support in Soong doesn't allow packing the helper
modules as part of the built releasetools_test. This CL adds a decorator
that allows declaring external dependencies in testcases, which will be
skipped while running in presubmit. It doesn't affect local invocation
of `atest releasetools_test`.

Fixes: 112080715
Test: `atest releasetools_test`
Test: TreeHugger; check that releasetools_test is invoked (and test
      passes).
Change-Id: I8fdeb6549023cf5ddeb79d610c7c37cf9f13d3cc
This commit is contained in:
Tao Bao
2019-04-09 00:12:30 -07:00
parent 30e31142ce
commit 82490d3de1
10 changed files with 136 additions and 18 deletions

View File

@@ -55,6 +55,7 @@ class ValidateTargetFilesTest(test_utils.ReleaseToolsTestCase):
0, proc.returncode,
"Failed to sign boot image with boot_signer: {}".format(stdoutdata))
@test_utils.SkipIfExternalToolsUnavailable()
def test_ValidateVerifiedBootImages_bootImage(self):
input_tmp = common.MakeTempDir()
os.mkdir(os.path.join(input_tmp, 'IMAGES'))
@@ -69,6 +70,7 @@ class ValidateTargetFilesTest(test_utils.ReleaseToolsTestCase):
}
ValidateVerifiedBootImages(input_tmp, info_dict, options)
@test_utils.SkipIfExternalToolsUnavailable()
def test_ValidateVerifiedBootImages_bootImage_wrongKey(self):
input_tmp = common.MakeTempDir()
os.mkdir(os.path.join(input_tmp, 'IMAGES'))
@@ -85,6 +87,7 @@ class ValidateTargetFilesTest(test_utils.ReleaseToolsTestCase):
AssertionError, ValidateVerifiedBootImages, input_tmp, info_dict,
options)
@test_utils.SkipIfExternalToolsUnavailable()
def test_ValidateVerifiedBootImages_bootImage_corrupted(self):
input_tmp = common.MakeTempDir()
os.mkdir(os.path.join(input_tmp, 'IMAGES'))
@@ -139,6 +142,7 @@ class ValidateTargetFilesTest(test_utils.ReleaseToolsTestCase):
# Append the verity metadata.
verity_image_builder.Build(output_file)
@test_utils.SkipIfExternalToolsUnavailable()
def test_ValidateVerifiedBootImages_systemImage(self):
input_tmp = common.MakeTempDir()
os.mkdir(os.path.join(input_tmp, 'IMAGES'))
@@ -162,6 +166,7 @@ class ValidateTargetFilesTest(test_utils.ReleaseToolsTestCase):
}
ValidateVerifiedBootImages(input_tmp, info_dict, options)
@test_utils.SkipIfExternalToolsUnavailable()
def test_ValidateFileConsistency_incompleteRange(self):
input_tmp = common.MakeTempDir()
os.mkdir(os.path.join(input_tmp, 'IMAGES'))