Fix packaging outputs commands

There were a few issues with the output packaging process that were
found during testing of the general-tests optimization.

First and foremost is that the packaging commands were trying to be
created before the build ran, when the outputs don't exist. I've changed
the logic to just collect the methods themselves which will then be run
during build plan execution after the build has completed.

A few other smaller issues include fixing the path to the soong_zip
binary, incorrect execution of the soong dumpvars command, and not
building the shared libs zip.

Test: atest build_test_suites_test; atest optimized_targets_test
Bug: 358215235
Change-Id: I8a3f54738f8bb5d871aadf7423844076c38b54a6
This commit is contained in:
Luca Farsi
2024-09-17 15:48:11 -07:00
parent 75501177a5
commit 8ea6742d05
4 changed files with 59 additions and 52 deletions

View File

@@ -220,18 +220,6 @@ class GeneralTestsOptimizerTest(fake_filesystem_unittest.TestCase):
):
package_commands = optimizer.get_package_outputs_commands()
@mock.patch('subprocess.run')
def test_no_build_outputs_packaging_fails(self, subprocess_run):
subprocess_run.return_value = self._get_soong_vars_output()
optimizer = self._create_general_tests_optimizer()
targets = optimizer.get_build_targets()
with self.assertRaisesRegex(
RuntimeError, 'No items specified to be added to zip'
):
package_commands = optimizer.get_package_outputs_commands()
def _create_general_tests_optimizer(self, build_context: BuildContext = None):
if not build_context:
build_context = self._create_build_context()
@@ -321,7 +309,7 @@ class GeneralTestsOptimizerTest(fake_filesystem_unittest.TestCase):
"""
for command in commands:
self.assertEqual(
'/tmp/top/host_out/prebuilts/build-tools/linux-x86/bin/soong_zip',
'/tmp/top/prebuilts/build-tools/linux-x86/bin/soong_zip',
command[0],
)
self.assertEqual('-d', command[1])