Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62035d9c authored by Luca Farsi's avatar Luca Farsi Committed by Julien Desprez
Browse files

Add --device-build flag to build_test_suites.py

The flag will be used to differentiate device builds so we can do the appropriate BWYN logic. Also include DIST_DIR as a required env var.

Bug: 378704055
Change-Id: I203645ab82d52024a713c41c6fdc806f8672f7cc
Test: atest build_test_suites_test
parent 3181bdd2
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -euo pipefail

build/soong/soong_ui.bash --make-mode build_test_suites || exit $?
$(build/soong/soong_ui.bash --dumpvar-mode HOST_OUT)/bin/build_test_suites $@ || exit $?
build/soong/soong_ui.bash --make-mode build_test_suites
$(build/soong/soong_ui.bash --dumpvar-mode HOST_OUT)/bin/build_test_suites --device-build $@
+3 −2
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -euo pipefail

build/soong/soong_ui.bash --make-mode build_test_suites || exit $?
$(build/soong/soong_ui.bash --dumpvar-mode HOST_OUT)/bin/build_test_suites $@ || exit $?
build/soong/soong_ui.bash --make-mode build_test_suites
$(build/soong/soong_ui.bash --dumpvar-mode HOST_OUT)/bin/build_test_suites $@
+6 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import metrics_agent
import test_discovery_agent


REQUIRED_ENV_VARS = frozenset(['TARGET_PRODUCT', 'TARGET_RELEASE', 'TOP'])
REQUIRED_ENV_VARS = frozenset(['TARGET_PRODUCT', 'TARGET_RELEASE', 'TOP', 'DIST_DIR'])
SOONG_UI_EXE_REL_PATH = 'build/soong/soong_ui.bash'
LOG_PATH = 'logs/build_test_suites.log'

@@ -197,6 +197,11 @@ def parse_args(argv: list[str]) -> argparse.Namespace:
  argparser.add_argument(
      'extra_targets', nargs='*', help='Extra test suites to build.'
  )
  argparser.add_argument(
      '--device-build',
      action='store_true',
      help='Flag to indicate running a device build.',
  )

  return argparser.parse_args(argv)

+7 −0
Original line number Diff line number Diff line
@@ -78,6 +78,12 @@ class BuildTestSuitesTest(fake_filesystem_unittest.TestCase):
    with self.assert_raises_word(build_test_suites.Error, 'TOP'):
      build_test_suites.main([])

  def test_missing_dist_dir_env_var_raises(self):
    del os.environ['DIST_DIR']

    with self.assert_raises_word(build_test_suites.Error, 'DIST_DIR'):
      build_test_suites.main([])

  def test_invalid_arg_raises(self):
    invalid_args = ['--invalid_arg']

@@ -121,6 +127,7 @@ class BuildTestSuitesTest(fake_filesystem_unittest.TestCase):
        'TARGET_RELEASE': 'release',
        'TARGET_PRODUCT': 'product',
        'TOP': str(self.fake_top),
        'DIST_DIR': str(self.fake_top.joinpath('dist')),
    })

    self.mock_subprocess_run.return_value = 0