dlogutil -c -b radio -b system -b main
LOG_DETAILS="dlogctl --disable (no args)"
dlogctl --disable
- [ "$(dlogctl -g | grep ENABLED | wc -l)" -eq 0 ] && ok || fail
+ [ "$(dlogctl -g | grep -c ENABLED)" -eq 0 ] && ok || fail
LOG_DETAILS="testing if filters were applied"
dlogsend -b system -t TEST test
dlogsend -b main -t TEST test
LOG_DETAILS="dlogctl --enable (no args)"
dlogctl --enable
- [ "$(dlogctl -g | grep DISABLED | wc -l)" -eq 0 ] && ok || fail
+ [ "$(dlogctl -g | grep -c DISABLED)" -eq 0 ] && ok || fail
LOG_DETAILS="testing if filters were applied"
dlogutil -c -b radio -b system -b main
dlogsend -b system -t TEST test
LOG_DETAILS="dlogctl --disable (1 arg)"
dlogctl --disable -b system
- [ "$(dlogctl -g | grep DISABLED | grep system | wc -l)" -eq 1 ] &&
- [ "$(dlogctl -g | grep DISABLED | wc -l)" -eq 1 ] && ok || fail
+ [ "$(dlogctl -g | grep DISABLED | grep -c system)" -eq 1 ] &&
+ [ "$(dlogctl -g | grep -c DISABLED )" -eq 1 ] && ok || fail
LOG_DETAILS="testing if filters were applied"
dlogutil -c -b radio -b system -b main
dlogsend -b system -t TEST test
LOG_DETAILS="dlogctl --disable (multiple args)"
dlogctl --disable -b main -b radio
- [ "$(dlogctl -g | grep DISABLED | grep -v system | wc -l)" -eq 2 ] &&
- [ "$(dlogctl -g | grep DISABLED | grep radio | wc -l)" -eq 1 ] &&
- [ "$(dlogctl -g | grep DISABLED | grep main | wc -l)" -eq 1 ] && ok || fail
+ [ "$(dlogctl -g | grep DISABLED | grep -cv system)" -eq 2 ] &&
+ [ "$(dlogctl -g | grep DISABLED | grep -c radio)" -eq 1 ] &&
+ [ "$(dlogctl -g | grep DISABLED | grep -c main)" -eq 1 ] && ok || fail
LOG_DETAILS="testing if filters were applied"
dlogutil -c -b radio -b system -b main
dlogsend -b system -t TEST test
LOG_DETAILS="dlogctl --enable (multiple args)"
dlogctl --enable -b radio -b system
- [ "$(dlogctl -g | grep DISABLED | wc -l)" -eq 1 ] &&
- [ "$(dlogctl -g | grep DISABLED | grep main | wc -l)" -eq 1 ] &&
- [ "$(dlogctl -g | grep ENABLED | grep system | wc -l)" -eq 1 ] &&
- [ "$(dlogctl -g | grep ENABLED | grep radio | wc -l)" -eq 1 ] && ok || fail
+ [ "$(dlogctl -g | grep -c DISABLED )" -eq 1 ] &&
+ [ "$(dlogctl -g | grep DISABLED | grep -c main)" -eq 1 ] &&
+ [ "$(dlogctl -g | grep ENABLED | grep -c system)" -eq 1 ] &&
+ [ "$(dlogctl -g | grep ENABLED | grep -c radio)" -eq 1 ] && ok || fail
LOG_DETAILS="testing if filters were applied"
dlogutil -c -b radio -b system -b main
dlogsend -b system -t TEST test
LOG_DETAILS="dlogctl --enable (1 arg)"
dlogctl --enable -b main
- [ "$(dlogctl -g | grep DISABLED | wc -l)" -eq 0 ] && ok || fail
+ [ "$(dlogctl -g | grep -c DISABLED)" -eq 0 ] && ok || fail
LOG_DETAILS="testing if filters were applied"
dlogutil -c -b radio -b system -b main
dlogsend -b system -t TEST test
dlogctl -s 100 && ok || fail
LOG_DETAILS="testing invalid parameters for dlogctl (10/13)"
- [ $(cat "$RUNTIME_FILTERS_DIR/05-logctl.conf" | grep -E 'limiter\|\*\|\*=100' | wc -l) -eq 1 ] && ok || fail
+ [ $(cat "$RUNTIME_FILTERS_DIR/05-logctl.conf" | grep -cE 'limiter\|\*\|\*=100') -eq 1 ] && ok || fail
# -g correctness
LOG_DETAILS="testing invalid parameters for dlogctl (11/13)"
- [ "$(dlogctl -g | grep '*:*' | grep 100 | wc -l)" -eq 1 ] && ok || fail
+ [ "$(dlogctl -g | grep '*:*' | grep -c 100)" -eq 1 ] && ok || fail
# -c correctness
LOG_DETAILS="testing invalid parameters for dlogctl (12/13)"
dlogctl -c -t '*' -p '*' && ok || fail
LOG_DETAILS="testing invalid parameters for dlogctl (13/13)"
- [ $(cat "$RUNTIME_FILTERS_DIR/05-logctl.conf" | grep -E 'limiter\|\*\|\*=100' | wc -l) -eq 0 ] && ok || fail
+ [ $(cat "$RUNTIME_FILTERS_DIR/05-logctl.conf" | grep -cE 'limiter\|\*\|\*=100') -eq 0 ] && ok || fail
dlogctl -c
LOG_DETAILS="testing if the whole dynamic config directory is respected"
kill -s CONT $DLOGSEND_PID
wait $DLOGSEND_PID
LOG_DETAILS="testing if PID limiting works (1/14)"
- [ "$(dlogutil --pid $DLOGSEND_PID -d | grep -v blocked | wc -l)" -eq 0 ] && ok || fail
+ [ "$(dlogutil --pid $DLOGSEND_PID -d | grep -cv blocked)" -eq 0 ] && ok || fail
LOG_DETAILS="testing if PID limiting works (2/14)"
- [ "$(dlogutil --pid $DLOGSEND_PID -d | grep blocked | wc -l)" -eq 1 ] && ok || fail
+ [ "$(dlogutil --pid $DLOGSEND_PID -d | grep -c blocked)" -eq 1 ] && ok || fail
LOG_DETAILS="testing if PID limiting works (3/14)"
[ "$(dlogctl --pid $DLOGSEND_PID -g)" = "Denied" ] && ok || fail
LOG_DETAILS="testing if PID limiting works (4/14)"
kill -s CONT $DLOGSEND_PID
wait $DLOGSEND_PID
LOG_DETAILS="testing if PID limiting works (5/14)"
- [ "$(dlogutil --pid $DLOGSEND_PID -d | grep -v blocked | wc -l)" -eq 25 ] && ok || fail
+ [ "$(dlogutil --pid $DLOGSEND_PID -d | grep -cv blocked)" -eq 25 ] && ok || fail
LOG_DETAILS="testing if PID limiting works (6/14)"
- [ "$(dlogutil --pid $DLOGSEND_PID -d | grep blocked | wc -l)" -eq 1 ] && ok || fail
+ [ "$(dlogutil --pid $DLOGSEND_PID -d | grep -c blocked)" -eq 1 ] && ok || fail
LOG_DETAILS="testing if PID limiting works (7/14)"
[ "$(dlogctl --pid $DLOGSEND_PID -g)" = '25 logs/min' ] && ok || fail
LOG_DETAILS="testing if PID limiting works (8/14)"
kill -s CONT $DLOGSEND_PID
wait $DLOGSEND_PID
LOG_DETAILS="testing if PID limiting works (9/14)"
- [ "$(dlogutil --pid $DLOGSEND_PID -d | grep -v blocked | wc -l)" -eq 100 ] && ok || fail
+ [ "$(dlogutil --pid $DLOGSEND_PID -d | grep -cv blocked)" -eq 100 ] && ok || fail
LOG_DETAILS="testing if PID limiting works (10/14)"
- [ "$(dlogutil --pid $DLOGSEND_PID -d | grep blocked | wc -l)" -eq 0 ] && ok || fail
+ [ "$(dlogutil --pid $DLOGSEND_PID -d | grep -c blocked)" -eq 0 ] && ok || fail
LOG_DETAILS="testing if PID limiting works (11/14)"
[ "$(dlogctl --pid $DLOGSEND_PID -g)" = 'Unlimited' ] && ok || fail
LOG_DETAILS="testing if PID limiting works (12/14)"
LOG_DETAILS="testing if PID limiting works (13/14)"
# In each 5 second period, 5 logs are sent, so there are 3 periods.
# 2 logs from each period are allowed.
- [ "$(dlogutil --pid $DLOGSEND_PID -d | grep -v blocked | wc -l)" -eq 6 ] && ok || fail
+ [ "$(dlogutil --pid $DLOGSEND_PID -d | grep -cv blocked)" -eq 6 ] && ok || fail
LOG_DETAILS="testing if PID limiting works (14/14)"
- [ "$(dlogutil --pid $DLOGSEND_PID -d | grep blocked | wc -l)" -eq 3 ] && ok || fail
+ [ "$(dlogutil --pid $DLOGSEND_PID -d | grep -c blocked)" -eq 3 ] && ok || fail
# TODO: HACK ALERT!
# The following QoS tests make perfect sense for the pipe backend, since we kill the already
dlogsend -b main -t DLOG_QOS_TEST0 -c 30 -d 1 -f 2 "A normal app that just wants to log"
LOG_DETAILS="testing if QoS works (1/4)"
- [ "$(dlogutil -d DLOG_QOS_TEST0 | grep -v blocked | wc -l)" -eq 30 ] && ok || fail
+ [ "$(dlogutil -d DLOG_QOS_TEST0 | grep -cv blocked)" -eq 30 ] && ok || fail
kill $LOGGER > /dev/null
sleep 1
if [ "$type" = "logger" ]; then
dlogsend -b main -t DLOG_QOS_TEST1 -c 300 -d 1 -f 20 "Some log spam"
LOG_DETAILS="testing if QoS works (2/4)"
- [ "$(dlogutil -d DLOG_QOS_TEST1 | grep -v blocked | wc -l)" -le 180 ] && ok || fail
+ [ "$(dlogutil -d DLOG_QOS_TEST1 | grep -cv blocked)" -le 180 ] && ok || fail
kill $LOGGER > /dev/null
sleep 1
if [ "$type" = "logger" ]; then
dlogsend -b main -t DLOG_QOS_TEST3 -c 270 -d 1 -f 18 "Some log spam"
wait $DLOGSEND_PID
LOG_DETAILS="testing if QoS works (3/4)"
- [ "$(dlogutil -d DLOG_QOS_TEST2 DLOG_QOS_TEST3 | grep -v blocked | wc -l)" -le 180 ] && ok || fail
+ [ "$(dlogutil -d DLOG_QOS_TEST2 DLOG_QOS_TEST3 | grep -cv blocked)" -le 180 ] && ok || fail
LOG_DETAILS="testing if QoS works (4/4)"
- [ "$(dlogutil -d DLOG_QOS_TEST2 | grep -v blocked | wc -l)" -gt 24 ] && ok || fail
+ [ "$(dlogutil -d DLOG_QOS_TEST2 | grep -cv blocked)" -gt 24 ] && ok || fail
DLOG_CONFIG_PATH=$PREQOS_CONFIG_PATH
kill $LOGGER > /dev/null