xref: /freebsd/crypto/openssh/.github/run_test.sh (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
1#!/bin/sh
2
3. .github/configs $1
4
5[ -z "${SUDO}" ] || ${SUDO} mkdir -p /var/empty
6
7set -ex
8
9# If we want to test hostbased auth, set up the host for it.
10if [ ! -z "$SUDO" ] && [ ! -z "$TEST_SSH_HOSTBASED_AUTH" ]; then
11    sshconf=/usr/local/etc
12    hostname | $SUDO tee $sshconf/shosts.equiv >/dev/null
13    echo "EnableSSHKeysign yes" | $SUDO tee $sshconf/ssh_config >/dev/null
14    $SUDO mkdir -p $sshconf
15    $SUDO cp -p /etc/ssh/ssh_host*key* $sshconf
16    $SUDO make install
17    for key in $sshconf/ssh_host*key*.pub; do
18        echo `hostname` `cat $key` | \
19            $SUDO tee -a $sshconf/ssh_known_hosts >/dev/null
20    done
21fi
22
23output_failed_logs() {
24    for i in regress/failed*.log; do
25        if [ -f "$i" ]; then
26            echo -------------------------------------------------------------------------
27            echo LOGFILE $i
28            cat $i
29            echo -------------------------------------------------------------------------
30        fi
31    done
32}
33trap output_failed_logs 0
34
35if [ -z "${LTESTS}" ]; then
36    make ${TEST_TARGET} SKIP_LTESTS="${SKIP_LTESTS}"
37else
38    make ${TEST_TARGET} SKIP_LTESTS="${SKIP_LTESTS}" LTESTS="${LTESTS}"
39fi
40
41if [ ! -z "${SSHD_CONFOPTS}" ]; then
42    echo "rerunning t-exec with TEST_SSH_SSHD_CONFOPTS='${SSHD_CONFOPTS}'"
43    if [ -z "${LTESTS}" ]; then
44        make t-exec SKIP_LTESTS="${SKIP_LTESTS}" TEST_SSH_SSHD_CONFOPTS="${SSHD_CONFOPTS}"
45    else
46        make t-exec SKIP_LTESTS="${SKIP_LTESTS}" LTESTS="${LTESTS}" TEST_SSH_SSHD_CONFOPTS="${SSHD_CONFOPTS}"
47    fi
48fi
49