xref: /freebsd/contrib/pam-krb5/ci/test (revision bf6873c5786e333d679a7838d28812febf479a8a)
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 <eagle@eyrie.org>
9#
10# SPDX-License-Identifier: MIT
11
12set -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.
16KERBEROS="${KERBEROS:-mit}"
17
18# Generate Autotools files.
19./bootstrap
20
21# Build everything with Clang first, with warnings enabled.
22if [ "$KERBEROS" = 'heimdal' ]; then
23    ./configure CC=clang PATH_KRB5_CONFIG=/usr/bin/krb5-config.heimdal
24else
25    ./configure CC=clang
26fi
27make warnings
28
29# Then rebuild everything with GCC with warnings enabled.
30make distclean
31if [ "$KERBEROS" = 'heimdal' ]; then
32    ./configure CC=gcc PATH_KRB5_CONFIG=/usr/bin/krb5-config.heimdal
33else
34    ./configure CC=gcc
35fi
36make warnings
37
38# Run the tests with valgrind.
39make check-valgrind
40
41# Run additional style tests, but only in the MIT build.
42if [ "$KERBEROS" = "mit" ]; then
43    make check-cppcheck
44fi
45