summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarol Lewandowski <k.lewandowsk@samsung.com>2020-04-02 15:06:50 +0200
committerKarol Lewandowski <k.lewandowsk@samsung.com>2020-04-02 15:06:50 +0200
commitd342da747a9879f9d81fac1f3d2a76005a223b94 (patch)
tree619a5ef520032dd738473237ef348a9682537bd9
parentd6f5d8f1934766cedf88d5c9d57f8f20922a5bb8 (diff)
parentcf5606eec31acfc055d6d1a4f963ca875dae326e (diff)
downloadcrash-worker-d342da747a9879f9d81fac1f3d2a76005a223b94.tar.gz
crash-worker-d342da747a9879f9d81fac1f3d2a76005a223b94.tar.bz2
crash-worker-d342da747a9879f9d81fac1f3d2a76005a223b94.zip
Change-Id: I9ce23297693b869fd4189c0eacbd24347e4f66ed
-rw-r--r--packaging/crash-worker.spec3
-rw-r--r--src/dump_systemstate/dump_systemstate.c35
-rwxr-xr-xtests/system/cmp_backtraces/cmp_backtraces.sh.template10
3 files changed, 37 insertions, 11 deletions
diff --git a/packaging/crash-worker.spec b/packaging/crash-worker.spec
index 62445d6..fd32f97 100644
--- a/packaging/crash-worker.spec
+++ b/packaging/crash-worker.spec
@@ -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
diff --git a/src/dump_systemstate/dump_systemstate.c b/src/dump_systemstate/dump_systemstate.c
index 8dbe9ce..dd183e6 100644
--- a/src/dump_systemstate/dump_systemstate.c
+++ b/src/dump_systemstate/dump_systemstate.c
@@ -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);
}
diff --git a/tests/system/cmp_backtraces/cmp_backtraces.sh.template b/tests/system/cmp_backtraces/cmp_backtraces.sh.template
index 417cadd..5795397 100755
--- a/tests/system/cmp_backtraces/cmp_backtraces.sh.template
+++ b/tests/system/cmp_backtraces/cmp_backtraces.sh.template
@@ -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"