Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 1 | #!/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. |
| 16 | set -e |
| 17 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 18 | docker build -t build_cpp_image -f tests/docker/Dockerfile.testing.cpp.debian_buster . |
| 19 | # Run tests with sanitizers (--cap-add SYS_PTRACE), both GCC and Clang. |
| 20 | cpp_test_args="--cap-add SYS_PTRACE build_cpp_image sh ./tests/docker/cpp_test.run.sh Debug" |
| 21 | docker run --rm $cpp_test_args |
| 22 | docker run --rm --env CC=/usr/bin/clang --env CXX=/usr/bin/clang++ $cpp_test_args |
| 23 | # Build flatc on debian once to speed up the test loop below. |
| 24 | docker run --name flatc_container build_cpp_image sh ./tests/docker/build_flatc.run.sh Debug |
| 25 | # All dependent dockers refer to 'flatc_debian_stretch'. |
| 26 | docker cp flatc_container:/flatbuffers/flatc flatc_debian_stretch |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 27 | |
| 28 | for f in $(ls tests/docker/languages | sort) |
| 29 | do |
| 30 | # docker pull sometimes fails for unknown reasons, probably travisci-related. this retries the pull we need a few times. |
| 31 | REQUIRED_BASE_IMAGE=$(cat tests/docker/languages/${f} | head -n 1 | awk ' { print $2 } ') |
| 32 | |
| 33 | set +e |
| 34 | n=0 |
| 35 | until [ $n -ge 5 ] |
| 36 | do |
| 37 | docker pull $REQUIRED_BASE_IMAGE && break |
| 38 | n=$[$n+1] |
| 39 | sleep 1 |
| 40 | done |
| 41 | set -e |
| 42 | |
| 43 | docker build -t $(echo ${f} | cut -f 3- -d .) -f tests/docker/languages/${f} . |
| 44 | echo "TEST OK: ${f}" |
| 45 | done |