1#!/bin/sh 2 3# These tests check that the requested configuration can be made and can be built 4# In many cases it will check that the Shairport Sync configuration string 5# contains or omits the relevant string 6# If doesn't check for the presence or absence of products except 7# when it checks for the configuration string 8 9# To get it to work first time, and assuming you have already build Shairport Sync according to the standard 10# you need the following extra libraries in Linux: 11# libmbedtls-dev libpolarssl-dev libjack-dev libsndio-dev libao-dev libpulse-dev libsndfile1-dev libavahi-compat-libdnssd-dev libglib2.0-dev libmosquitto-dev 12# Also, you'll need to build the ALAC library -- see https://github.com/mikebrady/alac. 13 14# At present, it is Linux-only. 15check_configuration_string_includes() 16{ 17 echo -n " checking configuration string includes \"$1\"..." 18 ./shairport-sync -V | grep -q $1 19 if [ "$?" -eq "1" ] ; then 20 echo "\nError: \"$1\" not included in configuration string. See \"../configure_test.log\"." 21 exit 1 22 fi 23 echo -n "ok" 24} 25 26check_configuration_string_excludes() 27{ 28 echo -n " checking configuration string excludes \"$1\"..." 29 ./shairport-sync -V | grep -q $1 30 if [ "$?" -eq "0" ] ; then 31 echo "\nError: \"$1\" is unexpectedly included in the configuration string. See \"../configure_test.log\"." 32 exit 1 33 fi 34 echo -n "ok" 35} 36check_for_success() 37{ 38 if [ "$2" = "x" ] ; then 39 A2="" 40 else 41 A2="$2" 42 fi 43 if [ "$3" = "x" ] ; then 44 A3="" 45 else 46 A3="$3" 47 fi 48 if [ "$4" = "x" ] ; then 49 A4="" 50 else 51 A4="$4" 52 fi 53 if [ "$5" = "x" ] ; then 54 A5="" 55 else 56 A5=$5 57 fi 58 if [ "$1" = "x" -o "$1" = "x$A2" ] ; then 59 TESTCOUNT="$(expr "$TESTCOUNT" '+' '1')" 60 echo -n "Checking \"$A2\": " 61 echo -n "configuring..." 62 echo "./configure $A3 $A2" > $LOGFILE 63 ./configure $A3 $A2 >> $LOGFILE 2>&1 64 if [ "$?" -eq "0" ] ; then 65 echo -n "ok making..." 66 echo "make clean" >> $LOGFILE 67 make clean >> $LOGFILE 2>&1 68 echo "make -j $((`nproc`*2))" >> $LOGFILE 69 make -j $((`nproc`*2)) >> $LOGFILE 2>&1 70 if [ "$?" -ne "0" ] ; then 71 echo "\nError at build step with arg \"$A2\". See \"../configure_test.log\"." 72 exit 1 73 fi 74 echo -n "ok" 75 else 76 echo "\nError at configure step with arg \"$A2\". See \"../configure_test.log\"." 77 exit 1 78 fi 79 if [ "$A4" != "" ] ; then 80 check_configuration_string_includes $A4 81 fi 82 if [ "$A5" != "" ] ; then 83 check_configuration_string_excludes $A5 84 fi 85 echo "." 86 fi 87} 88 89check_for_configuration_fail() 90{ 91 if [ "$1" = "x" -o "$1" = "x$2" ] ; then 92 echo -n "Checking \"$2\" fails during configuration... " 93 TESTCOUNT="$(expr "$TESTCOUNT" '+' '1')" 94 ./configure $3 $2 > $LOGFILE 2>&1 95 if [ "$?" -eq "0" ] ; then 96 echo "\nError: configuration did not fail with arg \"$2\". See \"../configure_test.log\"." 97 exit 1 98 fi 99 echo " done." 100 fi 101 return 0 102} 103 104echo -n "Preparing..." 105LOGFILE=configure_test.log 106CWD=`pwd` 107cd .. 108autoreconf -fi > $LOGFILE 2>&1 109if [ "$?" -ne "0" ] ; then 110 echo " error running \"autoreconf -fi\" -- see \"../configure_test.log\"." 111 exit 1 112fi 113echo "ok." 114TESTCOUNT=0 115check_for_success x$1 --with-pkg-config --with-ssl=mbedtls 116check_for_success x$1 --with-ssl=openssl x OpenSSL 117check_for_success x$1 --with-ssl=mbedtls x mbedTLS 118check_for_success x$1 --with-ssl=polarssl x PolarSSL 119check_for_configuration_fail x$1 --with-ssl 120check_for_configuration_fail x$1 --without-ssl=openssl 121check_for_configuration_fail x$1 --without-ssl=mbedtls 122check_for_configuration_fail x$1 --without-ssl=polarssl 123check_for_configuration_fail x$1 124check_for_success x$1 --with-alsa --with-ssl=mbedtls ALSA 125check_for_success x$1 --without-alsa --with-ssl=mbedtls x ALSA 126 127check_for_success x$1 --with-dummy --with-ssl=mbedtls dummy 128check_for_success x$1 --without-dummy --with-ssl=mbedtls x dummy 129 130check_for_success x$1 --with-stdout --with-ssl=mbedtls stdout 131check_for_success x$1 --without-stdout --with-ssl=mbedtls x stdout 132 133check_for_success x$1 --with-pipe --with-ssl=mbedtls pipe 134check_for_success x$1 --without-pipe --with-ssl=mbedtls x pipe 135 136check_for_success x$1 --with-external-mdns --with-ssl=mbedtls external_mdns 137check_for_success x$1 --without-external-mdns --with-ssl=mbedtls x external_mdns 138 139check_for_success x$1 --with-apple-alac --with-ssl=mbedtls alac 140check_for_success x$1 --without-apple-alac --with-ssl=mbedtls x alac 141 142check_for_success x$1 --with-piddir=/var --with-ssl=mbedtls 143check_for_success x$1 --without-piddir --with-ssl=mbedtls 144 145check_for_success x$1 --with-libdaemon --with-ssl=mbedtls 146check_for_success x$1 --without-libdaemon --with-ssl=mbedtls 147 148check_for_success x$1 --with-soxr --with-ssl=mbedtls soxr 149check_for_success x$1 --without-soxr --with-ssl=mbedtls x soxr 150 151check_for_success x$1 --with-metadata --with-ssl=mbedtls metadata 152check_for_success x$1 --without-metadata --with-ssl=mbedtls x metadata 153 154check_for_success x$1 --with-avahi --with-ssl=mbedtls Avahi 155check_for_success x$1 --without-avahi --with-ssl=mbedtls x Avahi 156 157check_for_success x$1 --with-tinysvcmdns --with-ssl=mbedtls tinysvcmdns 158check_for_success x$1 --without-tinysvcmdns --with-ssl=mbedtls x tinysvcmdns 159 160check_for_success x$1 --with-jack --with-ssl=mbedtls jack 161check_for_success x$1 --without-jack --with-ssl=mbedtls x jack 162 163check_for_success x$1 --with-sndio --with-ssl=mbedtls sndio 164check_for_success x$1 --without-sndio --with-ssl=mbedtls x sndio 165 166check_for_success x$1 --with-ao --with-ssl=mbedtls ao 167check_for_success x$1 --without-ao --with-ssl=mbedtls x ao 168 169# the following is disabled because there is no soundio library for Raspberry OS 170#check_for_success x$1 --with-soundio --with-ssl=mbedtls soundio 171check_for_success x$1 --without-soundio --with-ssl=mbedtls x soundio 172 173check_for_success x$1 --with-pa --with-ssl=mbedtls pa 174check_for_success x$1 --without-pa --with-ssl=mbedtls x pa 175 176check_for_success x$1 --with-convolution --with-ssl=mbedtls convolution 177check_for_success x$1 --without-convolution --with-ssl=mbedtls x convolution 178 179check_for_success x$1 --with-dns_sd --with-ssl=mbedtls dns_sd 180check_for_success x$1 --without-dns_sd --with-ssl=mbedtls x dns_sd 181 182check_for_success x$1 --with-dbus-interface --with-ssl=mbedtls metadata-dbus 183check_for_success x$1 --without-dbus-interface --with-ssl=mbedtls x dbus 184 185check_for_success x$1 --with-dbus-test-client --with-ssl=mbedtls 186check_for_success x$1 --without-dbus-test-client --with-ssl=mbedtls 187 188check_for_success x$1 --with-mpris-interface --with-ssl=mbedtls metadata-mpris 189check_for_success x$1 --without-mpris-interface --with-ssl=mbedtls x mpris 190 191check_for_success x$1 --with-mpris-test-client --with-ssl=mbedtls 192check_for_success x$1 --without-mpris-test-client --with-ssl=mbedtls 193 194check_for_success x$1 --with-mqtt-client --with-ssl=mbedtls metadata-mqtt 195check_for_success x$1 --without-mqtt-client --with-ssl=mbedtls x mqtt 196 197check_for_success x$1 --with-configfiles '--sysconfdir=/etc --with-alsa --with-soxr --with-avahi --with-ssl=openssl --with-systemd' OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc 198check_for_success x$1 --without-configfiles '--sysconfdir=/etc --with-alsa --with-soxr --with-avahi --with-ssl=openssl --with-systemd' OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc 199 200check_for_success x$1 --with-systemd '--sysconfdir=/etc --with-alsa --with-soxr --with-avahi --with-ssl=openssl' OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc 201check_for_success x$1 --without-systemd '--sysconfdir=/etc --with-alsa --with-soxr --with-avahi --with-ssl=openssl' OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc 202check_for_success x$1 --with-systemv '--sysconfdir=/etc --with-libdaemon --with-alsa --with-soxr --with-avahi --with-ssl=openssl' OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc 203check_for_success x$1 --without-systemv '--sysconfdir=/etc --with-libdaemon --with-alsa --with-soxr --with-avahi --with-ssl=openssl' OpenSSL-Avahi-ALSA-soxr-sysconfdir:/etc 204 205cd $CWD 206echo "$TESTCOUNT tests completed." 207 208