Release 5.6.36 60/229660/1 accepted/tizen/5.5/unified/20200403.153233 submit/tizen_5.5/20200402.132109
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 2 Apr 2020 13:06:50 +0000 (15:06 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 2 Apr 2020 13:06:50 +0000 (15:06 +0200)
Change-Id: I9ce23297693b869fd4189c0eacbd24347e4f66ed

packaging/crash-worker.spec
src/dump_systemstate/dump_systemstate.c
tests/system/cmp_backtraces/cmp_backtraces.sh.template

index 62445d6..fd32f97 100644 (file)
@@ -13,7 +13,7 @@
 
 Name:           crash-worker
 Summary:        Coredump handler and report generator for Tizen
-Version:        5.5.35
+Version:        5.5.36
 Release:        1
 Group:          Framework/system
 License:        Apache-2.0 and BSD-2-Clause and MIT
@@ -29,7 +29,6 @@ BuildRequires:  cmake
 BuildRequires:  pkgconfig(pkgmgr-info)
 BuildRequires:  pkgconfig(libunwind-generic)
 BuildRequires:  libelf-devel libelf
-BuildRequires:  libebl-devel libebl
 BuildRequires:  libdw-devel libdw
 BuildRequires:  libcap-devel
 
index 8dbe9ce..dd183e6 100644 (file)
@@ -21,6 +21,7 @@
  * @brief   dump system states.
  */
 
+#include <assert.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -31,6 +32,7 @@
 #include <limits.h>
 #include <getopt.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 #include <sys/vfs.h>
 
 #include "dump_systemstate.h"
@@ -73,15 +75,13 @@ static void usage()
           );
 }
 
-/* get disk used percentage */
 static int get_disk_used_percent(const char *path)
 {
+       assert(path);
+
        struct statfs lstatfs;
        int percent;
 
-       if (!path)
-               return -1;
-
        if (statfs(path, &lstatfs) < 0)
                return -1;
        percent = (((lstatfs.f_blocks - lstatfs.f_bfree) * 1000) / (lstatfs.f_blocks)) + 9;
@@ -89,6 +89,17 @@ static int get_disk_used_percent(const char *path)
        return percent;
 }
 
+static dev_t get_disk_device(const char *path)
+{
+       assert(path);
+
+       struct stat st;
+       if (stat(path, &st) < 0)
+               return -1;
+
+       return st.st_dev;
+}
+
 int main(int argc, char *argv[])
 {
        int c, ret, i, dpercent, exit_code = 0;
@@ -178,15 +189,25 @@ int main(int argc, char *argv[])
 
        dpercent = get_disk_used_percent("/opt");
        if (90 < dpercent) {
-               fprintf_fd(out_fd, "\n==== System disk space usage detail - %d%% (/bin/du -ah /opt)\n", dpercent);
+               fprintf_fd(out_fd, "\n==== System disk space usage detail - %d%% (/bin/du -ah /opt --exclude=/opt/usr)\n", dpercent);
                char *du_args[] = {"/bin/du", "-ah", "/opt", "--exclude=/opt/usr", NULL};
                spawn_wait_checked(du_args, NULL);
        }
 
+       if (get_disk_device("/opt") != get_disk_device("/opt/usr")) {
+               dpercent = get_disk_used_percent("/opt/usr");
+
+               if (90 < dpercent) {
+                       fprintf_fd(out_fd, "\n==== System disk space usage detail - %d%% (/bin/du -ah /opt/usr)\n", dpercent);
+                       char *du_args[] = {"/bin/du", "-ah", "/opt/usr", NULL};
+                       spawn_wait_checked(du_args, NULL);
+               }
+       }
+
        dpercent = get_disk_used_percent("/tmp");
        if (80 < dpercent) {
-               fprintf_fd(out_fd, "\n==== tmp usage detail - %d%% (/bin/du -h /tmp)\n", dpercent);
-               char *du_args[] = {"/bin/du", "-h", "/tmp", NULL};
+               fprintf_fd(out_fd, "\n==== tmp usage detail - %d%% (/bin/du -ah /tmp)\n", dpercent);
+               char *du_args[] = {"/bin/du", "-ah", "/tmp", NULL};
                spawn_wait_checked(du_args, NULL);
        }
 
index 417cadd..5795397 100755 (executable)
@@ -44,8 +44,14 @@ wait_for_app minicoredumper
 
 untar_file ${BASE_DIR} ${CORE_MINI}.tar
 
-gdb ${CRASH_WORKER_SYSTEM_TESTS}/utils/kenny ${BASE_DIR}/${CORE_ORIG}  -ex "thread apply all bt" -ex "q" 2> /dev/null | grep -e '^#' > ${BASE_DIR}/${THREADS_ORIG}
-gdb ${CRASH_WORKER_SYSTEM_TESTS}/utils/kenny ${BASE_DIR}/${CORE_MINI}  -ex "thread apply all bt" -ex "q" 2> /dev/null | grep -e '^#' > ${BASE_DIR}/${THREADS_MINI}
+# We want to compare if the call stack from the original dump is the same as
+# the one from the minidump. GDB can also sometimes display the type of
+# argument based on the data stored in the heap. Unfortunately, the minidump does
+# not contain heap, and this causes differences in result. Therefore, the GDB
+# result is filtered so that we can compare the two call stacks.
+
+gdb ${CRASH_WORKER_SYSTEM_TESTS}/utils/kenny ${BASE_DIR}/${CORE_ORIG}  -ex "thread apply all bt" -ex "q" 2> /dev/null | grep -e '^#' | sed 's/: [0-9]\+\(x[0-9]\+\( <[^>]\+>\)\?\)\?/: 0/g' > ${BASE_DIR}/${THREADS_ORIG}
+gdb ${CRASH_WORKER_SYSTEM_TESTS}/utils/kenny ${BASE_DIR}/${CORE_MINI}  -ex "thread apply all bt" -ex "q" 2> /dev/null | grep -e '^#' | sed 's/: [0-9]\+\(x[0-9]\+\( <[^>]\+>\)\?\)\?/: 0/g' > ${BASE_DIR}/${THREADS_MINI}
 
 if ! diff ${BASE_DIR}/${THREADS_ORIG} ${BASE_DIR}/${THREADS_MINI} > /dev/null; then
     fail "backtraces are different"