rsyslog/tests/ksi-verify-short.sh
Rainer Gerhards 69ef6e329b fix bad bash coding style and disable shellcheck false positives
Also now permit interactivly running tests without explicitly setting
$srcdir. This now works if we are inside ./tests and fails, as before,
when we are in a different directory.

Detected by shellcheck via CodeFactor.io
2018-10-23 13:27:37 +02:00

32 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# rsgtutil utility test
# Verifies sample logdata against public ksi verification repository.
#
# This file is part of the rsyslog project, released under ASL 2.0
#
# Copyright 2016 Rainer Gerhards and Adiscon GmbH.
RSYSLOG_KSI_BIN="http://verify.guardtime.com/ksi-publications.bin"
RSYSLOG_KSI_DEBUG="-s"
RSYSLOG_KSI_LOG="ksi-sample.log"
echo \[ksi-verify-short.sh\]: testing rsgtutil verify function - short options
. ${srcdir:=.}/diag.sh init
echo "running rsgtutil command with short options"
../tools/rsgtutil $RSYSLOG_KSI_DEBUG -t -P $RSYSLOG_KSI_BIN $srcdir/testsuites/$RSYSLOG_KSI_LOG
RSYSLOGD_EXIT=$?
if [ "$RSYSLOGD_EXIT" -ne "0" ]; then # EX_OK
if [ "$RSYSLOGD_EXIT" -eq "69" ]; then # EX_UNAVAILABLE
echo "[ksi-verify-short.sh]: rsgtutil verify failed with service unavailable (does not generate an error)"
exit 77;
else
echo "[ksi-verify-short.sh]: rsgtutil verify failed with error: " $RSYSLOGD_EXIT
exit 1;
fi
fi
# Cleanup temp files
rm -f rsgtutil.out*.log
echo SUCCESS: rsgtutil verify function - short options