Improve the libdlogutil coverage test 46/298046/1 accepted/tizen/unified/20230831.081046
authorMichal Bloch <m.bloch@samsung.com>
Wed, 30 Aug 2023 12:51:13 +0000 (14:51 +0200)
committerMichal Bloch <m.bloch@samsung.com>
Wed, 30 Aug 2023 13:10:59 +0000 (15:10 +0200)
Change-Id: I4c546d8e3479b7498c9ed2def85b7f710672b022

tests/dlog_coverage.in
tests/test_libdlogutil.c

index 597e385..9b42036 100644 (file)
@@ -12,7 +12,7 @@
 @bindir@/tizen-unittests/dlog/test_capi_coverage
 
 for MODE in monitor priority_exact pid_wrong tid_wrong tag_wrong prefix_wrong sorting clear alias negative; do
-       @bindir@/tizen-unittests/dlog/test_libdlogutil_cov $MODE 123 pipe
+       @bindir@/tizen-unittests/dlog/test_libdlogutil_cov $MODE 0 pipe
 done
 
 dlogsend -b main -b radio -b apps -b dotnet -b dotnet_api -b native -b native_api bla
index 9616505..d4238d6 100644 (file)
@@ -106,7 +106,7 @@ const char *mode_desc[] = {
 void print_usage_and_die(const char *name)
 {
        fprintf(stderr, "Usage: %s TEST PID TYPE\n"
-               "where PID is the process id of the logging process,\n"
+               "where PID is the process id of the logging process (or 0),\n"
                "TYPE is \"pipe\" or \"logger\" depending on the backend used,\n"
                "and TEST chooses a test and is one of the following:\n", name);
 
@@ -222,7 +222,8 @@ void get_logs_main(enum test_mode mode, backend_t backend, pid_t pid)
                        r = dlogutil_entry_get_message(e, &msg);
                        assert(r == 0);
 
-                       assert(!strcmp(tag, "SRPOL_LOGGER"));
+                       // !pid also means we are fine looking at random logs
+                       assert(!pid || !strcmp(tag, "SRPOL_LOGGER"));
 
                        pid_t apid, atid;
                        r = dlogutil_entry_get_pid(e, &apid);
@@ -230,8 +231,8 @@ void get_logs_main(enum test_mode mode, backend_t backend, pid_t pid)
                        r = dlogutil_entry_get_tid(e, &atid);
                        assert(r == 0);
 
-                       assert(pid == apid);
-                       assert(pid == atid);
+                       assert(!pid || pid == apid);
+                       assert(!pid || pid == atid);
 
                        switch (prio) {
                                case DLOG_ERROR: