blob: 975df97ceb2f1aebb69a9667a63eb9c7967ea7be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/bin/sh
# Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Checks that the initLogger() call uses for unit tests respects the setting of
# the buffer value
# Exit with error if commands exit with non-zero and if undefined variables are
# used.
set -eu
# Include common test library.
# shellcheck disable=SC1091
# SC1091: Not following: ... was not specified as input (see shellcheck -x).
. "@abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh"
tempfile="@abs_builddir@/buffer_logger_test_tempfile_$$"
printf 'Checking that buffer initialization works:\n'
test_start 'buffer-logger.buffer-including-process()-call'
cat > $tempfile << .
INFO [buffertest.log] LOG_BAD_SEVERITY unrecognized log severity: info
INFO [buffertest.log] LOG_BAD_SEVERITY unrecognized log severity: info
.
./buffer_logger_test 2>&1 | \
sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' | \
cut -d' ' -f3- | diff $tempfile -
test_finish 0
test_start 'buffer-logger.buffer-excluding-process()-call'
cat > $tempfile << .
INFO [buffertest.log]: LOG_BAD_SEVERITY unrecognized log severity: info
DEBUG [buffertest.log]: LOG_BAD_DESTINATION unrecognized log destination: debug-50
INFO [buffertest.log]: LOG_BAD_SEVERITY unrecognized log severity: info
.
./buffer_logger_test -n 2>&1 | diff $tempfile -
test_finish 0
# Tidy up.
rm -f $tempfile
|