packages/net/nginx-util/src/test-nginx-util.sh
Peter Stadler e247efa254 nginx-util: add tests, clean up and fix issues
Add tests for nginx-ssl-util and nginx-ssl-util-nopcre using (fake)chroot.
Clean the code up making nginx-ssl-util a header file.
Both changes are for better (future) code quality only.

There are minor functional improvements:
* fix compiler error of gcc7 by using std=c++17
* fix error if there is no lan/loopback interface
* notice instead of error message if there is no default server
* add ipv6-prefix-assignment.*.local-address.address for LAN
* add CONFLICTS in Makefile for choosing the right version
* add cast to release of unique_ptr to avoid warning
* add version message to help message

Signed-off-by: Peter Stadler <peter.stadler@student.uibk.ac.at>
2020-02-09 13:02:54 +01:00

38 lines
851 B
Bash
Executable file

#!/bin/bash
printf "Initializing tests ...\n"
fakechroot=""
[ -x /usr/bin/fakechroot ] && fakechroot="/usr/bin/fakechroot" \
|| [ "$(id -u)" -eq 0 ] || { \
printf "Error: Testing needs fakechroot or whoami=root for chroot."
return 1
}
TMPROOT=$(mktemp -d /tmp/test-nginx-util-XXXXXX)
ln -s /bin ${TMPROOT}/bin
mkdir -p ${TMPROOT}/usr/bin/
cp ./test-nginx-util-root.sh ${TMPROOT}/usr/bin/
printf "\n\n******* Testing nginx-ssl-util-noubus *******\n"
cp ./nginx-ssl-util-noubus ${TMPROOT}/usr/bin/nginx-util
${fakechroot} /bin/chroot ${TMPROOT} /bin/sh -c /usr/bin/test-nginx-util-root.sh
echo $?
printf "\n\n******* Testing nginx-ssl-util-nopcre-noubus *******\n"
cp ./nginx-ssl-util-nopcre-noubus ${TMPROOT}/usr/bin/nginx-util
${fakechroot} /bin/chroot ${TMPROOT} /bin/sh -c /usr/bin/test-nginx-util-root.sh
rm -r ${TMPROOT}