blob: e6039bf623fab5ab9e4dc47ab07b8286e6d1204d [file] [log] [blame]
Austin Schuhe89fa2d2019-08-14 20:24:23 -07001#!/bin/bash
2#
3# Copyright 2018 Google Inc. All rights reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16set -e
17
18# build flatc on debian once to speed up the test loop below
19docker build -t build_flatc_debian_stretch -f tests/docker/Dockerfile.testing.build_flatc_debian_stretch .
20BUILD_CONTAINER_ID=$(docker create --read-only build_flatc_debian_stretch)
21docker cp ${BUILD_CONTAINER_ID}:/code/flatc flatc_debian_stretch
22
23for f in $(ls tests/docker/languages | sort)
24do
25 # docker pull sometimes fails for unknown reasons, probably travisci-related. this retries the pull we need a few times.
26 REQUIRED_BASE_IMAGE=$(cat tests/docker/languages/${f} | head -n 1 | awk ' { print $2 } ')
27
28 set +e
29 n=0
30 until [ $n -ge 5 ]
31 do
32 docker pull $REQUIRED_BASE_IMAGE && break
33 n=$[$n+1]
34 sleep 1
35 done
36 set -e
37
38 docker build -t $(echo ${f} | cut -f 3- -d .) -f tests/docker/languages/${f} .
39 echo "TEST OK: ${f}"
40done