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