blob: 0a469cc12e310bb0962adcff10f40ec70fec978c (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/bin/bash
# check if dlt-daemon is running
daemon_running=`/usr/bin/ps -C dlt-daemon | wc -l`
daemon_pid=0
if [ "$daemon_running" -lt "2" ]; then
echo "No daemon running, starting one myself"
/usr/bin/dlt-daemon > /tmp/dlt_daemon_dlt_receiver_test.txt &
daemon_pid=$!
echo "daemon pid: " ${daemon_pid}
else
echo "dlt-daemon already running"
fi
# create a directory in /tmp where all logs will be stored
output_dir=`mktemp -d /tmp/DLT_TESTING_XXXXXX`
echo "Using directory " ${output_dir}
# start dlt-receive (in background) and store PID
echo "Starting dlt-receive"
/usr/bin/dlt-receive -o ${output_dir}/dlt_test.dlt localhost &
dlt_receive_pid=$!
disown
# start dlt-example-user to create some logs
# sleep time: 100ms
# number of messages: 10
/usr/bin/dlt-example-user -d 100 -n 10 TEST_MESSAGE_ONE
# stop dlt-receive
kill ${dlt_receive_pid}
# show content of /tmp
echo "log-file after first run"
ls -l ${output_dir}
# start dlt-receive (in background) and store PID
echo "Starting dlt-receive"
/usr/bin/dlt-receive -o ${output_dir}/dlt_test_no_log.dlt localhost &
dlt_receive_pid=$!
disown
# start dlt-example-user to create some logs, disable logging through environment variable
DLT_INITIAL_LOG_LEVEL=::-1 /usr/bin/dlt-example-user -d 100 -n 10 TEST_MESSAGE_TWO
# show content of /tmp, log should not contain log messages from dlt-example-user (TEST_MESSAGE_TWO)
kill ${dlt_receive_pid}
echo "log-file after second run"
ls -l ${output_dir}
# directory will not be cleaned up
echo "Used directory " ${output_dir}
if [ "${daemon_pid}" -ne "0" ]; then
sleep 1
kill ${daemon_pid}
fi
|