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