aboutsummaryrefslogtreecommitdiffstats
path: root/.travis/run.sh
blob: 8f8dd6871bd477b297b91567c3f3db37b50ea7b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash -ex

if [[ "${TOXENV}" == "pypy" ]]; then
    PYENV_ROOT="$HOME/.pyenv"
    PATH="$PYENV_ROOT/bin:$PATH"
    eval "$(pyenv init -)"
fi
if [ -n "${LIBRESSL}" ]; then
    OPENSSL=$LIBRESSL
    export CFLAGS="-Werror -Wno-error=deprecated-declarations -Wno-error=discarded-qualifiers -Wno-error=unused-function"
fi

if [ -n "${OPENSSL}" ]; then
    OPENSSL_DIR="ossl-2/${OPENSSL}"

    export PATH="$HOME/$OPENSSL_DIR/bin:$PATH"
    export CFLAGS="${CFLAGS} -I$HOME/$OPENSSL_DIR/include"
    # rpath on linux will cause it to use an absolute path so we don't need to
    # do LD_LIBRARY_PATH
    export LDFLAGS="-L$HOME/$OPENSSL_DIR/lib -Wl,-rpath=$HOME/$OPENSSL_DIR/lib"
fi

source ~/.venv/bin/activate

if [ -n "${DOCKER}" ]; then
    # We will be able to drop the -u once we switch the default container user in the
    # dockerfiles.
    docker run --rm -u 2000:2000 \
        -v "${TRAVIS_BUILD_DIR}":"${TRAVIS_BUILD_DIR}" \
        -v "${HOME}/wycheproof":/wycheproof \
        -w "${TRAVIS_BUILD_DIR}" \
        -e TOXENV "${DOCKER}" \
        /bin/sh -c "tox -- --wycheproof-root='/wycheproof'"
elif [ -n "${TOXENV}" ]; then
    tox -- --wycheproof-root="$HOME/wycheproof"
else
    downstream_script="${TRAVIS_BUILD_DIR}/.travis/downstream.d/${DOWNSTREAM}.sh"
    if [ ! -x "$downstream_script" ]; then
        exit 1
    fi
    $downstream_script install
    pip install .
    $downstream_script run
fi