xref: /aosp_15_r20/build/make/tests/b_tests.sh (revision 9e94795a3d4ef5c1d47486f9a02bb378756cea8a)
1# Copyright (C) 2022 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# These commands are expected to always return successfully
16
17trap 'exit 1' ERR
18
19source $(dirname $0)/../envsetup.sh
20
21# lunch required to set up PATH to use b
22lunch aosp_arm64
23
24test_target=//build/bazel/scripts/difftool:difftool
25
26if b build //build/bazel:nonexistent_module &>/dev/null ; then
27    echo "b did not fail when building a nonexistent module" >&2
28    exit 1
29fi
30b build "$test_target"
31b build -- "$test_target"
32b build "$test_target" --run-soong-tests
33b build --run-soong-tests "$test_target"
34b --run-soong-tests build "$test_target"
35# Test that the bazel server can be restarted once shut down. If run in a
36# docker container, you need to run the docker container with --init or
37# have some other process as PID 1 that can reap zombies.
38b shutdown
39b cquery 'kind(test, //build/bazel/examples/android_app/...)' --config=android
40b run $test_target -- --help >/dev/null
41
42# Workflow tests for bmod
43bmod libm
44b run $(bmod fastboot) -- help
45b build $(bmod libm) $(bmod libcutils) --config=android
46