1#!/bin/bash 2# Copyright (C) 2018 The Android Open Source Project 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 17# Initial script invoked by Kokoro continuous integration / presubmit jobs. 18# Sets up Kokoro-specific environment, invoking the test script afterwards. 19# What & how to run is carried by environment variables. 20# 21# You shouldn't need to invoke this when running tests locally. 22 23set -eux 24 25SCRIPT_DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" 26ROOT_DIR="$(realpath ${SCRIPT_DIR}/../..)" 27 28cd ${ROOT_DIR} 29 30# Check that the expected environment variables are present (due to set -u). 31echo PERFETTO_TEST_GN_ARGS: ${PERFETTO_TEST_GN_ARGS} 32echo PERFETTO_TEST_ENTRYPT: ${PERFETTO_TEST_ENTRYPT} 33 34# Make space for docker image by symlinking the hardcoded /var/lib/docker path 35# to a tmpfs mount. Cargo culted from other projects' scripts. 36sudo -n /etc/init.d/docker stop 37sudo -n mv /var/lib/docker /tmpfs/ 38sudo -n ln -s /tmpfs/docker /var/lib/docker 39sudo -n /etc/init.d/docker start 40 41# Invoke the tests within a container. 42${SCRIPT_DIR}/run_test_in_container.sh 43