libdlogutil: remove the defaults integration test 32/238232/1
authorMichal Bloch <m.bloch@samsung.com>
Thu, 9 Jul 2020 12:31:58 +0000 (14:31 +0200)
committerMichal Bloch <m.bloch@samsung.com>
Thu, 9 Jul 2020 12:32:01 +0000 (14:32 +0200)
Passing a valid config is now mandatory; uninitialized
values are validated by the "dump" test.

Change-Id: Ifb94e88dd49dc81807b99f58b4dcda8db1e670ee
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
tests/dlog_test.in
tests/test_libdlogutil.c

index dfbd760..e8fa62d 100644 (file)
@@ -401,8 +401,6 @@ UTIL_PID=-1
 
 LOG_DETAILS="testing if libdlogutil works correctly in the dump mode"
 test_libdlogutil dump $LIBDLOGUTIL_CORRECT_PID $type && ok || fail
-LOG_DETAILS="testing if libdlogutil works correctly without any additional settings"
-test_libdlogutil defaults $LIBDLOGUTIL_CORRECT_PID $type && ok || fail
 LOG_DETAILS="testing if libdlogutil works correctly if processing the logs takes some time"
 test_libdlogutil timer $LIBDLOGUTIL_CORRECT_PID $type && ok || fail
 LOG_DETAILS="testing if libdlogutil works correctly in the continuous mode"
index 28cabcd..a061c88 100644 (file)
@@ -25,7 +25,6 @@
 
 enum test_mode {
        MODE_DUMP,
-       MODE_DEFAULTS,
        MODE_TIMER,
        MODE_CONTINUOUS,
        MODE_MONITOR,
@@ -49,7 +48,6 @@ enum test_mode {
 
 const char *mode_names[] = {
        [MODE_DUMP] = "dump",
-       [MODE_DEFAULTS] = "defaults",
        [MODE_TIMER] = "timer",
        [MODE_CONTINUOUS] = "continuous",
        [MODE_MONITOR] = "monitor",
@@ -72,7 +70,6 @@ const char *mode_names[] = {
 
 const char *mode_desc[] = {
        [MODE_DUMP] = "test getting logs in the dump mode",
-       [MODE_DEFAULTS] = "same, but relying on implicit defaults",
        [MODE_TIMER] = "same, but waiting on each log to simulate work",
        [MODE_CONTINUOUS] = "test getting logs in the continuous mode",
        [MODE_MONITOR] = "test that monitor mode skips all the old logs",
@@ -137,50 +134,45 @@ void get_logs_main(enum test_mode mode, bool pipe, pid_t pid)
 
        int r;
 
-       dlogutil_config_s *c = NULL;
-       if (mode != MODE_DEFAULTS) {
-               c = dlogutil_config_create();
-               assert(c);
-
-               dlogutil_config_buffer_add(c, LOG_ID_MAIN);
-
-               switch (mode) {
-                       case MODE_PRIORITY:
-                               assert(dlogutil_config_filter_filterspec(c, "*:W") == 0);
-                               break;
-                       case MODE_PRIORITY_EXACT:
-                               assert(dlogutil_config_filter_filterspec(c, "*:=W") == 0);
-                               break;
-                       case MODE_PID_CORRECT:
-                               assert(dlogutil_config_filter_pid(c, pid) == 0);
-                               break;
-                       case MODE_PID_WRONG:
-                               assert(dlogutil_config_filter_pid(c, pid ^ 1) == 0);
-                               break;
-                       case MODE_TID_CORRECT:
-                               assert(dlogutil_config_filter_tid(c, pid) == 0);
-                               break;
-                       case MODE_TID_WRONG:
-                               assert(dlogutil_config_filter_tid(c, pid ^ 1) == 0);
-                               break;
-                       case MODE_TAG_CORRECT:
-                               dlogutil_config_filter_filterspec(c, "SRPOL_LOGGER");
-                               break;
-                       case MODE_TAG_WRONG:
-                               dlogutil_config_filter_filterspec(c, "SRPOL_WRONG");
-                               break;
-                       case MODE_PREFIX_CORRECT:
-                               dlogutil_config_filter_filterspec(c, "SRPOL*");
-                               break;
-                       case MODE_PREFIX_WRONG:
-                               dlogutil_config_filter_filterspec(c, "WRONG*");
-                               break;
-                       default:
-                               break;
-               }
+       dlogutil_config_s *c = dlogutil_config_create();
+       assert(c);
+
+       dlogutil_config_buffer_add(c, LOG_ID_MAIN);
+
+       switch (mode) {
+               case MODE_PRIORITY:
+                       assert(dlogutil_config_filter_filterspec(c, "*:W") == 0);
+                       break;
+               case MODE_PRIORITY_EXACT:
+                       assert(dlogutil_config_filter_filterspec(c, "*:=W") == 0);
+                       break;
+               case MODE_PID_CORRECT:
+                       assert(dlogutil_config_filter_pid(c, pid) == 0);
+                       break;
+               case MODE_PID_WRONG:
+                       assert(dlogutil_config_filter_pid(c, pid ^ 1) == 0);
+                       break;
+               case MODE_TID_CORRECT:
+                       assert(dlogutil_config_filter_tid(c, pid) == 0);
+                       break;
+               case MODE_TID_WRONG:
+                       assert(dlogutil_config_filter_tid(c, pid ^ 1) == 0);
+                       break;
+               case MODE_TAG_CORRECT:
+                       dlogutil_config_filter_filterspec(c, "SRPOL_LOGGER");
+                       break;
+               case MODE_TAG_WRONG:
+                       dlogutil_config_filter_filterspec(c, "SRPOL_WRONG");
+                       break;
+               case MODE_PREFIX_CORRECT:
+                       dlogutil_config_filter_filterspec(c, "SRPOL*");
+                       break;
+               case MODE_PREFIX_WRONG:
+                       dlogutil_config_filter_filterspec(c, "WRONG*");
+                       break;
+               default:
+                       break;
        }
-       // TODO
-       else return;
 
        dlogutil_state_s *s = NULL;
        if (continuous)
@@ -260,12 +252,10 @@ void get_logs_main(enum test_mode mode, bool pipe, pid_t pid)
        }
 
        dlogutil_state_destroy(s);
-       if (mode != MODE_DEFAULTS)
-               dlogutil_config_destroy(c);
+       dlogutil_config_destroy(c);
 
        switch (mode) {
                case MODE_DUMP:
-               case MODE_DEFAULTS:
                case MODE_TIMER:
                case MODE_CONTINUOUS:
                case MODE_PID_CORRECT:
@@ -582,7 +572,6 @@ int main(int argc, char **argv)
 
        switch (t) {
                case MODE_DUMP:
-               case MODE_DEFAULTS:
                case MODE_TIMER:
                case MODE_CONTINUOUS:
                case MODE_MONITOR: