MT_TEST=-1
LOGGER=-1
+TEST_DYNAMIC_FILTERS="@DYNAMIC_FILTERS@"
TESTDIR=/var/lib/dlog-tests
extract_timestamp() {
sleep 1
fi
-dlogctl -c
-dlogctl --enable
-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
-LOG_DETAILS="testing if filters were applied"
-dlogsend -b system -t TEST test
-dlogsend -b main -t TEST test
-dlogsend -b radio -t TEST test
-[ `dlogutil -d -b radio -b system -b main | wc -l` -eq 0 ] && ok || fail
-
-LOG_DETAILS="dlogctl --enable (no args)"
-dlogctl --enable
-[ `dlogctl -g | grep DISABLED | wc -l` -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
-dlogsend -b main -t TEST test
-dlogsend -b radio -t TEST test
-[ `dlogutil -d -b radio -b system -b main | wc -l` -eq 3 ] && ok || fail
-
-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
-LOG_DETAILS="testing if filters were applied"
-dlogutil -c -b radio -b system -b main
-dlogsend -b system -t TEST test
-dlogsend -b main -t TEST test
-dlogsend -b radio -t TEST test
-[ `dlogutil -d -b radio -b system -b main | wc -l` -eq 2 ] && ok || fail
-
-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
-LOG_DETAILS="testing if filters were applied"
-dlogutil -c -b radio -b system -b main
-dlogsend -b system -t TEST test
-dlogsend -b main -t TEST test
-dlogsend -b radio -t TEST test
-[ `dlogutil -d -b radio -b system -b main | wc -l` -eq 0 ] && ok || fail
-
-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
-LOG_DETAILS="testing if filters were applied"
-dlogutil -c -b radio -b system -b main
-dlogsend -b system -t TEST test
-dlogsend -b main -t TEST test
-dlogsend -b radio -t TEST test
-[ `dlogutil -d -b radio -b system -b main | wc -l` -eq 2 ] && ok || fail
-
-LOG_DETAILS="dlogctl --enable (1 arg)"
-dlogctl --enable -b main
-[ `dlogctl -g | grep DISABLED | wc -l` -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
-dlogsend -b main -t TEST test
-dlogsend -b radio -t TEST test
-[ `dlogutil -d -b radio -b system -b main | wc -l` -eq 3 ] && ok || fail
-
-LOG_DETAILS="dlogctl -s allow"
-dlogutil -c -b radio -b system -b main
-dlogctl -c
-dlogctl -s deny
-dlogctl -t TEST_TAG -s allow
-dlogsend -b main -t TEST_TAG test
-dlogsend -b main -t TEST test
-[ `dlogutil -d -b main | wc -l` -eq 1 ] && ok || fail
-
-LOG_DETAILS="dlogctl -s [N]"
-dlogutil -c -b radio -b system -b main
-dlogctl -c
-dlogctl -s deny
-dlogctl -t TEST_TAG -s 3
-dlogsend -b main -c 10 -t TEST_TAG test
-dlogsend -b main -c 10 -t TEST test
-[ `dlogutil -d -b main | wc -l` -eq 4 ] && ok || fail
-
-LOG_DETAILS="testing invalid parameters for dlogctl (1/13)"
-dlogctl -s invalid &> /dev/null && fail || ok
-
-LOG_DETAILS="testing invalid parameters for dlogctl (2/13)"
-dlogctl -p X -g &> /dev/null && fail || ok
-
-LOG_DETAILS="testing invalid parameters for dlogctl (3/13)"
-dlogctl -b invalid --disable &> /dev/null && fail || ok
-
-LOG_DETAILS="testing invalid parameters for dlogctl (4/13)"
-dlogctl -s allow -g -t xyz -p E &> /dev/null && fail || ok
-
-LOG_DETAILS="testing invalid parameters for dlogctl (5/13)"
-dlogctl -s allow -c &> /dev/null && fail || ok
-
-LOG_DETAILS="testing invalid parameters for dlogctl (6/13)"
-dlogctl -c -g -t xyz -p E &> /dev/null && fail || ok
-
-# -s out of range
-LOG_DETAILS="testing invalid parameters for dlogctl (7/13)"
-dlogctl -s -10 &> /dev/null && fail || ok
-
-LOG_DETAILS="testing invalid parameters for dlogctl (8/13)"
-dlogctl -s 999999 &> /dev/null && fail || ok
-
-# -s correctness
-LOG_DETAILS="testing invalid parameters for dlogctl (9/13)"
-dlogctl -s 100 && ok || fail
-
-LOG_DETAILS="testing invalid parameters for dlogctl (10/13)"
-[ `cat $RUNTIME_FILTERS_DIR/FILTERS | grep -E 'limiter\|\*\|\*=100' | wc -l` -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
-
-# -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/FILTERS | grep -E 'limiter\|\*\|\*=100' | wc -l` -eq 0 ] && ok || fail
+if [ "$TEST_DYNAMIC_FILTERS" == "true" ]; then
+ dlogctl -c
+ dlogctl --enable
+ 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
+ LOG_DETAILS="testing if filters were applied"
+ dlogsend -b system -t TEST test
+ dlogsend -b main -t TEST test
+ dlogsend -b radio -t TEST test
+ [ `dlogutil -d -b radio -b system -b main | wc -l` -eq 0 ] && ok || fail
+
+ LOG_DETAILS="dlogctl --enable (no args)"
+ dlogctl --enable
+ [ `dlogctl -g | grep DISABLED | wc -l` -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
+ dlogsend -b main -t TEST test
+ dlogsend -b radio -t TEST test
+ [ `dlogutil -d -b radio -b system -b main | wc -l` -eq 3 ] && ok || fail
+
+ 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
+ LOG_DETAILS="testing if filters were applied"
+ dlogutil -c -b radio -b system -b main
+ dlogsend -b system -t TEST test
+ dlogsend -b main -t TEST test
+ dlogsend -b radio -t TEST test
+ [ `dlogutil -d -b radio -b system -b main | wc -l` -eq 2 ] && ok || fail
+
+ 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
+ LOG_DETAILS="testing if filters were applied"
+ dlogutil -c -b radio -b system -b main
+ dlogsend -b system -t TEST test
+ dlogsend -b main -t TEST test
+ dlogsend -b radio -t TEST test
+ [ `dlogutil -d -b radio -b system -b main | wc -l` -eq 0 ] && ok || fail
+
+ 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
+ LOG_DETAILS="testing if filters were applied"
+ dlogutil -c -b radio -b system -b main
+ dlogsend -b system -t TEST test
+ dlogsend -b main -t TEST test
+ dlogsend -b radio -t TEST test
+ [ `dlogutil -d -b radio -b system -b main | wc -l` -eq 2 ] && ok || fail
+
+ LOG_DETAILS="dlogctl --enable (1 arg)"
+ dlogctl --enable -b main
+ [ `dlogctl -g | grep DISABLED | wc -l` -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
+ dlogsend -b main -t TEST test
+ dlogsend -b radio -t TEST test
+ [ `dlogutil -d -b radio -b system -b main | wc -l` -eq 3 ] && ok || fail
+
+ LOG_DETAILS="dlogctl -s allow"
+ dlogutil -c -b radio -b system -b main
+ dlogctl -c
+ dlogctl -s deny
+ dlogctl -t TEST_TAG -s allow
+ dlogsend -b main -t TEST_TAG test
+ dlogsend -b main -t TEST test
+ [ `dlogutil -d -b main | wc -l` -eq 1 ] && ok || fail
+
+ LOG_DETAILS="dlogctl -s [N]"
+ dlogutil -c -b radio -b system -b main
+ dlogctl -c
+ dlogctl -s deny
+ dlogctl -t TEST_TAG -s 3
+ dlogsend -b main -c 10 -t TEST_TAG test
+ dlogsend -b main -c 10 -t TEST test
+ [ `dlogutil -d -b main | wc -l` -eq 4 ] && ok || fail
+
+ LOG_DETAILS="testing invalid parameters for dlogctl (1/13)"
+ dlogctl -s invalid &> /dev/null && fail || ok
+
+ LOG_DETAILS="testing invalid parameters for dlogctl (2/13)"
+ dlogctl -p X -g &> /dev/null && fail || ok
+
+ LOG_DETAILS="testing invalid parameters for dlogctl (3/13)"
+ dlogctl -b invalid --disable &> /dev/null && fail || ok
+
+ LOG_DETAILS="testing invalid parameters for dlogctl (4/13)"
+ dlogctl -s allow -g -t xyz -p E &> /dev/null && fail || ok
+
+ LOG_DETAILS="testing invalid parameters for dlogctl (5/13)"
+ dlogctl -s allow -c &> /dev/null && fail || ok
+
+ LOG_DETAILS="testing invalid parameters for dlogctl (6/13)"
+ dlogctl -c -g -t xyz -p E &> /dev/null && fail || ok
+
+ # -s out of range
+ LOG_DETAILS="testing invalid parameters for dlogctl (7/13)"
+ dlogctl -s -10 &> /dev/null && fail || ok
+
+ LOG_DETAILS="testing invalid parameters for dlogctl (8/13)"
+ dlogctl -s 999999 &> /dev/null && fail || ok
+
+ # -s correctness
+ LOG_DETAILS="testing invalid parameters for dlogctl (9/13)"
+ dlogctl -s 100 && ok || fail
+
+ LOG_DETAILS="testing invalid parameters for dlogctl (10/13)"
+ [ `cat $RUNTIME_FILTERS_DIR/FILTERS | grep -E 'limiter\|\*\|\*=100' | wc -l` -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
+
+ # -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/FILTERS | grep -E 'limiter\|\*\|\*=100' | wc -l` -eq 0 ] && ok || fail
+ dlogctl -c
+fi
# put 100 log entries in the "main" buffer
-dlogctl -c
dlogutil -c
test_libdlog 100
sleep 1
line=`dlogutil -v raw -d --tid $!` #dlogsend is a single threaded app so tid is the same as pid
[[ "$line" == "tidTEST" ]] && ok || fail
-LOG_DETAILS="testing if limiter and runtime filtering works"
-dlogutil -c -b radio
-test_filters
-[ $(dlogutil -d -b radio | wc -l) -eq 12 ] && ok || fail
+if [ "$TEST_DYNAMIC_FILTERS" == "true" ]; then
+ LOG_DETAILS="testing if limiter and runtime filtering works"
+ dlogutil -c -b radio
+ test_filters
+ [ $(dlogutil -d -b radio | wc -l) -eq 12 ] && ok || fail
-LOG_DETAILS="testing proper SMACK label for dynamic config file location"
-ORIG_FILTERS_DIR=$(cat $ORIGINAL_CONFIG_PATH | grep dynamic_config_path | awk -F "=" '{print $2}')
-[ $(ls -dZ $ORIG_FILTERS_DIR | awk -F " " '{print $1}') == "System::Shared" ] && ok || fail
+ LOG_DETAILS="testing proper SMACK label for dynamic config file location"
+ ORIG_FILTERS_DIR=$(cat $ORIGINAL_CONFIG_PATH | grep dynamic_config_path | awk -F "=" '{print $2}')
+ [ $(ls -dZ $ORIG_FILTERS_DIR | awk -F " " '{print $1}') == "System::Shared" ] && ok || fail
+fi
LOG_DETAILS="testing if the library works with multithreaded app"
dlogutil -f $TESTDIR/dlog_mt_test &