Skip to content
Snippets Groups Projects
Commit 40365615 authored by Stefan Schmidt's avatar Stefan Schmidt
Browse files

Merge branch 'faultloggertest' into 'kirkstone'

Fix ActsFautLoggerTest

Closes #84

See merge request eclipse/oniro-core/meta-openharmony!91
parents 1b507505 6671cc18
No related branches found
No related tags found
1 merge request!91Fix ActsFautLoggerTest
Pipeline #14898 passed
Showing with 161 additions and 11 deletions
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //test/xts/acts repository of OpenHarmony 3.0 codebase.
This fixes the ActsFaultLogger test-case.
- Optimization needs to be disabled to avoid compiler optimizing out the null
pointer dereference.
- In order for the faultloggerd process to actually generate the log files,
applications needs to install the needed signal handlers, as documented in
base/hiviewdfx/faultloggerd/README.md
- Align the test with it's own name, so it actually matches on the generated
crash log.
Signed-off-by: Esben Haabendal <esben@geanix.com>
Upstream-Status: Inappropritate [test-case was dropped in 3.0.2]
diff --git a/hiviewdfx/faultloggertest/faultloggercpptest/BUILD.gn b/hiviewdfx/faultloggertest/faultloggercpptest/BUILD.gn
index 0eeb66084952..4ba249d8c4af 100755
--- a/hiviewdfx/faultloggertest/faultloggercpptest/BUILD.gn
+++ b/hiviewdfx/faultloggertest/faultloggercpptest/BUILD.gn
@@ -23,6 +23,7 @@ config("faultloggertest_config") {
"//base/hiviewdfx/hilog/interfaces/native/innerkits/include",
"genfault.h",
]
+ cflags = [ "-O0" ]
}
ohos_moduletest_suite("ActsFaultLoggerTest") {
module_out_path = module_output_path
@@ -33,6 +34,7 @@ ohos_moduletest_suite("ActsFaultLoggerTest") {
deps = [
"../../utils/native:utilskit",
"//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog",
+ "//base/hiviewdfx/faultloggerd/interfaces/innerkits/signal_handler:dfx_signalhandler",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
diff --git a/hiviewdfx/faultloggertest/faultloggercpptest/faultloggertest.cpp b/hiviewdfx/faultloggertest/faultloggercpptest/faultloggertest.cpp
index 5870de2257c1..ff00cffddf9f 100755
--- a/hiviewdfx/faultloggertest/faultloggercpptest/faultloggertest.cpp
+++ b/hiviewdfx/faultloggertest/faultloggercpptest/faultloggertest.cpp
@@ -22,6 +22,8 @@
#include "hilog/log_c.h"
#include "hilog/log_cpp.h"
+#include "dfx_signal_handler.h"
+
#undef LOG_DOMAIN
#undef LOG_TAG
#define LOG_DOMAIN 0xD003200
@@ -60,6 +62,7 @@ pid_t faultloggertest::DoTestProcess(int faulttype)
{
printf("DoTestProcess, param is %d\r\n", faulttype);
pid_t pid;
+ static int installed = 0;
pid = fork();
printf("pid is %d\r\n", pid);
switch (pid) {
@@ -70,6 +73,11 @@ pid_t faultloggertest::DoTestProcess(int faulttype)
GenFault(faulttype);
break;
default:
+ if (installed == 0) {
+ DFX_InstallSignalHandler();
+ std::cout << "DFX signal handler installed"<<std::endl;
+ installed = 1;
+ }
break;
}
wait(&status);
@@ -130,9 +138,9 @@ HWTEST_F(faultloggertest, Faultlogger_Faultdetect1, Function|MediumTest|Level1)
string fileinfo;
fileinfo = ReadFile("/data/log/faultlog/temp/" + faultloggerfile);
std::vector<std::string> para = {"Pid:" + to_string(pid), "Uid:0",
- "Process name:", "/data/local/tmp/faultloggertest",
+ "Process name:", "/data/local/tmp/ActsFaultLoggerTest",
"Reason:Signal:SIGILL", "Fault thread Info:",
- "Tid:" + to_string(pid), "Name:faultloggertest"};
+ "Tid:" + to_string(pid), "Name:ActsFaultLoggerTest"};
if (!fileinfo.empty()) {
result = CheckInfo(para, fileinfo);
} else {
......@@ -349,9 +349,6 @@ SRCREV_FORMAT .= "+third_party_libpng"
SRC_URI += "${GITEE_URL}/third_party_libsnd.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.0.1-LTS;name=third_party_libsnd;destsuffix=${OH_SRCDIR}/third_party/libsnd"
SRCREV_third_party_libsnd = "11640c8570477dd9b3d741d3dfd9941b7325a98d"
SRCREV_FORMAT .= "+third_party_libsnd"
SRC_URI += "${GITEE_URL}/third_party_libunwind.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.0.1-LTS;name=third_party_libunwind;destsuffix=${OH_SRCDIR}/third_party/libunwind"
SRCREV_third_party_libunwind = "60ec73774087bdecd62072a1cfbd669580c35ca2"
SRCREV_FORMAT .= "+third_party_libunwind"
SRC_URI += "${GITEE_URL}/third_party_libuv.git;protocol=https;nobranch=1;branch=OpenHarmony-v3.0.1-LTS;name=third_party_libuv;destsuffix=${OH_SRCDIR}/third_party/libuv;lfs=0"
SRCREV_third_party_libuv = "96413c54af34a4a0c24631ac0c3cde26517f6d67"
SRCREV_FORMAT .= "+third_party_libuv"
......
......@@ -75,6 +75,7 @@ SRC_URI += "file://RenderText-PerformLayout-remove-sigsegv-code.patch;patchdir=$
SRC_URI += "file://test-xts-acts-timeout-increment.patch;patchdir=${S}/test/xts/acts"
SRC_URI += "file://start-ability-timeout-increment.patch;patchdir=${S}/test/xts/acts"
SRC_URI += "file://test-xts-acts-fix-Defpermission-typo.patch;patchdir=${S}/test/xts/acts"
SRC_URI += "file://test-xts-acts-fix-faultloggertest.patch;patchdir=${S}/test/xts/acts"
inherit python3native gn_base ptest
......@@ -1580,7 +1581,7 @@ FILES:${PN}-faultlogger = " \
${libdir}/libdfx_signalhandler*${SOLIBS} \
"
RDEPENDS:${PN}-faultlogger += "musl libcxx"
RDEPENDS:${PN}-faultlogger += "${PN}-libutils ${PN}-hilog ${PN}-thirdparty-libunwind"
RDEPENDS:${PN}-faultlogger += "${PN}-libutils ${PN}-hilog"
RDEPENDS:${PN} += "${PN}-faultlogger"
# faultlogger-ptest
......@@ -1912,11 +1913,6 @@ FILES:${PN}-thirdparty-protobuf = "${libdir}/libprotobuf_standard*${SOLIBS}"
RDEPENDS:${PN}-thirdparty-protobuf += "musl libcxx"
RDEPENDS:${PN} += "${PN}-thirdparty-protobuf"
PACKAGES =+ "${PN}-thirdparty-libunwind"
FILES:${PN}-thirdparty-libunwind = "${libdir}/libunwind*${SOLIBS}"
RDEPENDS:${PN}-thirdparty-libunwind += "musl libcxx"
RDEPENDS:${PN} += "${PN}-thirdparty-libunwind"
PACKAGES =+ "${PN}-thirdparty-giflib"
FILES:${PN}-thirdparty-giflib = "${libdir}/libgif*${SOLIBS}"
RDEPENDS:${PN}-thirdparty-giflib += "musl libcxx"
......
......@@ -18,3 +18,8 @@ TOOLCHAIN_TARGET_TASK += "openssl-dev"
# OpenSSL for build host
TOOLCHAIN_HOST_TASK += "nativesdk-openssl-dev"
# libunwind for target
DEPENDS += "libunwind"
RDEPENDS:${PN} = "libunwind"
TOOLCHAIN_TARGET_TASK += "libcxx-dev"
......@@ -2,5 +2,6 @@
#
# SPDX-License-Identifier: Apache-2.0
# This file is intentionally left empty.
# It is needed so the 'require' statement in oniro-openharmony-thirdparty-integration.bb doesn't fail
SRC_URI += "file://third_party/libunwind/BUILD.gn;subdir=src/overlay"
SRC_URI += "file://patches/no-processdump.patch;apply=no;subdir=src"
SRC_URI += "file://patches/hiviewdfx_faultloggerd_local_unwind_unused_variables.patch;apply=no;subdir=src"
......@@ -9,6 +9,7 @@ group("third_party") {
deps = [
"//third_party/openssl:libcrypto",
"//third_party/openssl:libssl",
"//third_party/libunwind:libunwind",
]
}
}
......
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //base/hiviewdfx/faultloggerd git repository of OpenHarmony 3.0 codebase.
This fixes warning about unused variables when using musl, which (depending on
compiler version) can be promoted to an error, and thus break compilation.
Signed-off-by: Esben Haabendal <esben@geanix.com>
Upstream-Status: Pending
--- a/base/hiviewdfx/faultloggerd/interfaces/innerkits/signal_handler/dfx_signal_handler.c 2023-02-20 10:19:50.406718524 +0100
+++ b/base/hiviewdfx/faultloggerd/interfaces/innerkits/signal_handler/dfx_signal_handler.c 2023-02-20 10:20:41.980303697 +0100
@@ -79,8 +79,10 @@
static struct ProcessDumpRequest g_request;
static void *g_reservedChildStack;
static pthread_mutex_t g_signalHandlerMutex = PTHREAD_MUTEX_INITIALIZER;
+#ifndef DFX_LOCAL_UNWIND
static pthread_mutex_t g_dumpMutex = PTHREAD_MUTEX_INITIALIZER;
static int g_pipefd[2] = {-1, -1};
+#endif
static BOOL g_hasInit = FALSE;
enum DumpPreparationStage {
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
Patch for //base/hiviewdfx/faultloggerd repository of OpenHarmony 3.0 codebase.
The processdump tool relies on remote unwind feature of libunwind, which is not
supported by the LLVM libunwind version. The processdump tool is not a required
feature, so by dropping it, we can get rid of the libunwind fork, and avoid
having to convince meta-clang to use the non-LLVM libunwind library.
Signed-off-by: Esben Haabendal <esben@geanix.com>
Upstream-Status: Inappropriate [configuration/integration]
diff a/base/hiviewdfx/faultloggerd/ohos.build b/base/hiviewdfx/faultloggerd/ohos.build
--- a/base/hiviewdfx/faultloggerd/ohos.build 2023-02-14 18:40:25.662946940 +0100
+++ b/base/hiviewdfx/faultloggerd/ohos.build 2023-02-14 16:07:18.840350031 +0100
@@ -5,7 +5,6 @@
"module_list": [
"//base/hiviewdfx/faultloggerd/interfaces/innerkits/signal_handler:dfx_signalhandler",
"//base/hiviewdfx/faultloggerd/interfaces/innerkits/faultloggerd_client:libfaultloggerd",
- "//base/hiviewdfx/faultloggerd/tools/process_dump:processdump",
"//base/hiviewdfx/faultloggerd/services:faultloggerd"
],
"test_list": [
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
import("//build/ohos.gni")
import("//oniro/third_party.gni")
ohos_prebuilt_shared_library("libunwind") {
source = "//oniro/sysroots/target/usr/lib/libunwind.so.1.0"
subsystem_name = "hiviewdfx"
part_name = "faultloggerd"
install_enable = install_oniro_third_party
install_images = [ "system", "updater" ]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment