1#!/bin/bash -eu
2
3# compat-in-docker.sh
4#
5# Purpose
6# -------
7# This runs compat.sh in a Docker container.
8#
9# Notes for users
10# ---------------
11# If OPENSSL_CMD, GNUTLS_CLI, or GNUTLS_SERV are specified the path must
12# correspond to an executable inside the Docker container. The special
13# values "next" (OpenSSL only) and "legacy" are also allowed as shorthand
14# for the installations inside the container.
15#
16# See also:
17# - scripts/docker_env.sh for general Docker prerequisites and other information.
18# - compat.sh for notes about invocation of that script.
19
20# Copyright The Mbed TLS Contributors
21# SPDX-License-Identifier: Apache-2.0
22#
23# Licensed under the Apache License, Version 2.0 (the "License"); you may
24# not use this file except in compliance with the License.
25# You may obtain a copy of the License at
26#
27#  http://www.apache.org/licenses/LICENSE-2.0
28#
29# Unless required by applicable law or agreed to in writing, software
30# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
31# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32# See the License for the specific language governing permissions and
33# limitations under the License.
34
35source tests/scripts/docker_env.sh
36
37case "${OPENSSL_CMD:-default}" in
38    "legacy")  export OPENSSL_CMD="/usr/local/openssl-1.0.1j/bin/openssl";;
39    "next")    export OPENSSL_CMD="/usr/local/openssl-1.1.1a/bin/openssl";;
40    *) ;;
41esac
42
43case "${GNUTLS_CLI:-default}" in
44    "legacy")  export GNUTLS_CLI="/usr/local/gnutls-3.3.8/bin/gnutls-cli";;
45    "next")  export GNUTLS_CLI="/usr/local/gnutls-3.7.2/bin/gnutls-cli";;
46    *) ;;
47esac
48
49case "${GNUTLS_SERV:-default}" in
50    "legacy")  export GNUTLS_SERV="/usr/local/gnutls-3.3.8/bin/gnutls-serv";;
51    "next")  export GNUTLS_SERV="/usr/local/gnutls-3.7.2/bin/gnutls-serv";;
52    *) ;;
53esac
54
55run_in_docker \
56    -e M_CLI \
57    -e M_SRV \
58    -e GNUTLS_CLI \
59    -e GNUTLS_SERV \
60    -e OPENSSL_CMD \
61    -e OSSL_NO_DTLS \
62    tests/compat.sh \
63    $@
64