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
diff --git a/ci/optimized_targets_test.py b/ci/optimized_targets_test.py
index 762b62e..0b0c0ec 100644
--- a/ci/optimized_targets_test.py
+++ b/ci/optimized_targets_test.py
@@ -220,18 +220,6 @@
):
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 @@
"""
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])