| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Run tests for continuous integration. |
| 4 |
# |
| 5 |
# This script is normally run in a test container or VM, such as via GitHub |
| 6 |
# Actions. |
| 7 |
# |
| 8 |
# Copyright 2015-2021 Russ Allbery <[email protected]> |
| 9 |
# |
| 10 |
# SPDX-License-Identifier: MIT |
| 11 |
|
| 12 |
set -eux |
| 13 |
|
| 14 |
# Normally, KERBEROS is set based on the CI matrix, but provide a default in |
| 15 |
# case someone runs this test by hand. |
| 16 |
KERBEROS="${KERBEROS:-mit}" |
| 17 |
|
| 18 |
# Generate Autotools files. |
| 19 |
./bootstrap |
| 20 |
|
| 21 |
# Build everything with Clang first, with warnings enabled. |
| 22 |
if [ "$KERBEROS" = 'heimdal' ]; then |
| 23 |
./configure CC=clang PATH_KRB5_CONFIG=/usr/bin/krb5-config.heimdal |
| 24 |
else |
| 25 |
./configure CC=clang |
| 26 |
fi |
| 27 |
make warnings |
| 28 |
|
| 29 |
# Then rebuild everything with GCC with warnings enabled. |
| 30 |
make distclean |
| 31 |
if [ "$KERBEROS" = 'heimdal' ]; then |
| 32 |
./configure CC=gcc PATH_KRB5_CONFIG=/usr/bin/krb5-config.heimdal |
| 33 |
else |
| 34 |
./configure CC=gcc |
| 35 |
fi |
| 36 |
make warnings |
| 37 |
|
| 38 |
# Run the tests with valgrind. |
| 39 |
make check-valgrind |
| 40 |
|
| 41 |
# Run additional style tests, but only in the MIT build. |
| 42 |
if [ "$KERBEROS" = "mit" ]; then |
| 43 |
make check-cppcheck |
| 44 |
fi |