2016-01-02 08:16:38 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-06-25 22:05:06 +02:00
|
|
|
set -o errexit
|
|
|
|
set -o pipefail
|
|
|
|
set -o nounset
|
2019-04-20 23:09:08 +02:00
|
|
|
set -x
|
|
|
|
|
|
|
|
SCRIPT_PATH="$(readlink -f "$0")"
|
|
|
|
SCRIPT_DIR="${SCRIPT_PATH%/*}"
|
|
|
|
|
|
|
|
echo "Running unit tests"
|
2017-06-25 22:05:06 +02:00
|
|
|
|
2018-01-11 09:28:45 +01:00
|
|
|
export LD_LIBRARY_PATH=../src
|
|
|
|
|
2019-04-20 23:09:08 +02:00
|
|
|
pushd "$SCRIPT_DIR"
|
|
|
|
|
2019-04-20 23:24:47 +02:00
|
|
|
setup_mysql() {
|
2022-09-14 20:45:38 +02:00
|
|
|
if [[ "$DISTRO" == "jammy" ]]; then
|
|
|
|
service mariadb start
|
|
|
|
else
|
|
|
|
service mysql start
|
|
|
|
fi
|
|
|
|
|
2019-04-20 23:24:47 +02:00
|
|
|
mysql -u piler -ppiler123 piler1 < ../util/db-mysql.sql
|
|
|
|
}
|
|
|
|
|
2024-03-22 06:02:08 +01:00
|
|
|
run_smtp_tests() {
|
|
|
|
mkdir -p /var/piler/store/00/piler /var/piler/tmp /var/piler/manticore
|
|
|
|
chown -R piler:piler /var/piler/
|
|
|
|
../src/piler-smtp -L 5 -d
|
|
|
|
./smtp -s 127.0.0.1
|
|
|
|
}
|
|
|
|
|
2019-04-20 23:24:47 +02:00
|
|
|
if [[ -v BUILD_NUMBER ]]; then
|
|
|
|
setup_mysql
|
|
|
|
fi
|
|
|
|
|
2018-01-11 09:28:45 +01:00
|
|
|
./check_parser_utils
|
|
|
|
./check_parser
|
|
|
|
./check_rules
|
|
|
|
./check_digest
|
|
|
|
./check_mydomains
|
2018-01-11 10:20:02 +01:00
|
|
|
./check_misc
|
|
|
|
./check_hash
|
|
|
|
./check_decoder
|
2018-02-04 10:58:35 +01:00
|
|
|
./check_attachments
|
2024-03-22 06:02:08 +01:00
|
|
|
|
|
|
|
if [[ -v BUILD_NUMBER ]]; then run_smtp_tests; fi
|