xref: /aosp_15_r20/external/bazelbuild-rules_android/test/utils/integration_demo/demo_test.sh (revision 9e965d6fece27a77de5377433c2f7e6999b8cc0b)
1#!/bin/bash
2# Copyright 2023 The Bazel Authors. All rights reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#    http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# Short demo of the rules_bazel_integration_test to ensure it works.
17
18# --- begin runfiles.bash initialization v2 ---
19# Copy-pasted from the Bazel Bash runfiles library v2.
20set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash
21source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
22  source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
23  source "$0.runfiles/$f" 2>/dev/null || \
24  source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
25  source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
26  { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
27# --- end runfiles.bash initialization v2 ---
28
29source "$(rlocation rules_android/test/bashunit/unittest.bash)" || \
30  (echo >&2 "Failed to locate bashunit.sh" && exit 1)
31
32function test_bazel_exists() {
33  touch WORKSPACE
34  touch BUILD.bazel
35
36  "${BIT_BAZEL_BINARY}" info >& $TEST_log
37  expect_log "output_base: "
38}
39
40run_suite "Demo of rules_bazel_integration_test"
41