!53 [sync] PR-51: bugfix:fix testcase compile and run errs
From: @openeuler-sync-bot Reviewed-by: @Vchanger Signed-off-by: @Vchanger
This commit is contained in:
commit
e634600c16
45
bugfix-fix-java_probe_test-find-jdk-path.patch
Normal file
45
bugfix-fix-java_probe_test-find-jdk-path.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From fafbabcd1be7405d4711aa761eff4413c36d8744 Mon Sep 17 00:00:00 2001
|
||||
From: xietangxin <xietangxin@huawei.com>
|
||||
Date: Thu, 23 Feb 2023 14:20:53 +0800
|
||||
Subject: [PATCH] bugfix: fix java_probe_test find jdk path
|
||||
|
||||
---
|
||||
.../java_probe/java_probes_test.sh | 15 +--------------
|
||||
1 file changed, 1 insertion(+), 14 deletions(-)
|
||||
|
||||
diff --git a/test/test_extend_probes/java_probe/java_probes_test.sh b/test/test_extend_probes/java_probe/java_probes_test.sh
|
||||
index 9fe4e0e..043e9ce 100644
|
||||
--- a/test/test_extend_probes/java_probe/java_probes_test.sh
|
||||
+++ b/test/test_extend_probes/java_probe/java_probes_test.sh
|
||||
@@ -6,7 +6,7 @@ function find_jars()
|
||||
then
|
||||
# find jdk
|
||||
clink_path=$(echo $(ls -lrt $javac_link) | awk -F " " '{print $NF}' )
|
||||
- link_path=$(echo $(ls -lrt $link_path) | awk -F " " '{print $NF}' )
|
||||
+ link_path=$(echo $(ls -lrt $clink_path) | awk -F " " '{print $NF}' )
|
||||
jdk_path=$(dirname $(dirname $link_path))
|
||||
dir=$jdk_path
|
||||
else
|
||||
@@ -32,19 +32,6 @@ function find_jars()
|
||||
return 1
|
||||
fi
|
||||
|
||||
- #find rpm
|
||||
- junit_rpm=$( rpm -qa junit )
|
||||
- if [ -z $junit_rpm ];
|
||||
- then
|
||||
- #install junit4
|
||||
- yum install junit
|
||||
- junit_rpm=$( rpm -qa junit )
|
||||
- if [ -z $junit_rpm ];
|
||||
- then
|
||||
- exit 1
|
||||
- fi
|
||||
- fi
|
||||
-
|
||||
#junit.jar
|
||||
junit_jar=$( rpm -ql junit | grep junit.jar)
|
||||
if [ -e $junit_jar ];
|
||||
--
|
||||
2.33.0
|
||||
|
||||
142
bugfix-fix-testcase-compile-and-run-err.patch
Normal file
142
bugfix-fix-testcase-compile-and-run-err.patch
Normal file
@ -0,0 +1,142 @@
|
||||
From 6fb6d4952215b015be5c31277aeeb47780f03f16 Mon Sep 17 00:00:00 2001
|
||||
From: xietangxin <xietangxin@huawei.com>
|
||||
Date: Wed, 22 Feb 2023 09:40:56 +0800
|
||||
Subject: [PATCH] bugfix:fix testcase compile and run err
|
||||
|
||||
---
|
||||
test/test_modules/test_logs.c | 86 ++++++---------------------------
|
||||
test/test_probes/CMakeLists.txt | 1 +
|
||||
2 files changed, 15 insertions(+), 72 deletions(-)
|
||||
|
||||
diff --git a/test/test_modules/test_logs.c b/test/test_modules/test_logs.c
|
||||
index 0bc3a1f..52291cd 100644
|
||||
--- a/test/test_modules/test_logs.c
|
||||
+++ b/test/test_modules/test_logs.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#define TEST_META_PATH "/home/logs/meta"
|
||||
|
||||
#define LOGS_FILE_SIZE (1024)
|
||||
+#define TEST_WR_LOGS_NUM 10
|
||||
|
||||
#define WR_LOGS(count, id, func, txt) \
|
||||
do \
|
||||
@@ -116,85 +117,26 @@ static void TestLogsWrEventLogs(void)
|
||||
{
|
||||
int count = (LOGS_FILE_SIZE / strlen(EVENT_LOGS_TEXT) + 1);
|
||||
|
||||
- WR_LOGS(count, 0, wr_event_logs, EVENT_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 0) == 1);
|
||||
- WR_LOGS(count, 1, wr_event_logs, EVENT_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 1) == 1);
|
||||
- WR_LOGS(count, 2, wr_event_logs, EVENT_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 2) == 1);
|
||||
- WR_LOGS(count, 3, wr_event_logs, EVENT_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 3) == 1);
|
||||
-
|
||||
- RE_LOGS(read_event_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 0) == 0);
|
||||
- RE_LOGS(read_event_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 1) == 0);
|
||||
-
|
||||
- WR_LOGS(count, 4, wr_event_logs, EVENT_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 4) == 1);
|
||||
- WR_LOGS(count, 5, wr_event_logs, EVENT_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 5) == 1);
|
||||
- WR_LOGS(count, 6, wr_event_logs, EVENT_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 6) == 1);
|
||||
-
|
||||
- RE_LOGS(read_event_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 2) == 0);
|
||||
- RE_LOGS(read_event_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 3) == 0);
|
||||
- RE_LOGS(read_event_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 4) == 0);
|
||||
- RE_LOGS(read_event_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 5) == 0);
|
||||
- RE_LOGS(read_event_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 6) == 0);
|
||||
-
|
||||
- WR_LOGS(count, 7, wr_event_logs, EVENT_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", 7) == 1);
|
||||
-
|
||||
+ for (int i = 0; i <= TEST_WR_LOGS_NUM; i++) {
|
||||
+ WR_LOGS(count, i, wr_event_logs, EVENT_LOGS_TEXT);
|
||||
+ CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", i) == 1);
|
||||
+ RE_LOGS(read_event_logs);
|
||||
+ CU_ASSERT(is_logs_file_exist(TEST_EVENT_PATH, "event", i) == 0);
|
||||
+ }
|
||||
return;
|
||||
}
|
||||
|
||||
#define METRICS_LOGS_TEXT "I'am metrics, len 20"
|
||||
static void TestLogsWrMetricLogs(void)
|
||||
{
|
||||
- int ret = 0;
|
||||
int count = (LOGS_FILE_SIZE / strlen(METRICS_LOGS_TEXT) + 1);
|
||||
|
||||
- WR_LOGS(count, 0, wr_metrics_logs, METRICS_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 0) == 1);
|
||||
- WR_LOGS(count, 1, wr_metrics_logs, METRICS_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 1) == 1);
|
||||
- WR_LOGS(count, 2, wr_metrics_logs, METRICS_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 2) == 1);
|
||||
- WR_LOGS(count, 3, wr_metrics_logs, METRICS_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 3) == 1);
|
||||
-
|
||||
- RE_LOGS(read_metrics_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 0) == 0);
|
||||
- RE_LOGS(read_metrics_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 1) == 0);
|
||||
-
|
||||
- WR_LOGS(count, 4, wr_metrics_logs, METRICS_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 4) == 1);
|
||||
- WR_LOGS(count, 5, wr_metrics_logs, METRICS_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 5) == 1);
|
||||
- WR_LOGS(count, 6, wr_metrics_logs, METRICS_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 6) == 1);
|
||||
-
|
||||
- RE_LOGS(read_metrics_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 2) == 0);
|
||||
- RE_LOGS(read_metrics_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 3) == 0);
|
||||
- RE_LOGS(read_metrics_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 4) == 0);
|
||||
- RE_LOGS(read_metrics_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 5) == 0);
|
||||
- RE_LOGS(read_metrics_logs);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 6) == 0);
|
||||
-
|
||||
- WR_LOGS(count, 7, wr_metrics_logs, METRICS_LOGS_TEXT);
|
||||
- CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", 7) == 1);
|
||||
-
|
||||
+ for (int i = 0; i <= TEST_WR_LOGS_NUM; i++) {
|
||||
+ WR_LOGS(count, i, wr_metrics_logs, METRICS_LOGS_TEXT);
|
||||
+ CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", i) == 1);
|
||||
+ RE_LOGS(read_metrics_logs);
|
||||
+ CU_ASSERT(is_logs_file_exist(TEST_METRICS_PATH, "metrics", i) == 0);
|
||||
+ }
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -216,4 +158,4 @@ void TestLogsMain(CU_pSuite suite)
|
||||
CU_ADD_TEST(suite, TestLogsWrEventLogs);
|
||||
CU_ADD_TEST(suite, TestLogsWrMetricLogs);
|
||||
CU_ADD_TEST(suite, TestLogsMgrDestroy);
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
diff --git a/test/test_probes/CMakeLists.txt b/test/test_probes/CMakeLists.txt
|
||||
index e4ba433..fe6e805 100644
|
||||
--- a/test/test_probes/CMakeLists.txt
|
||||
+++ b/test/test_probes/CMakeLists.txt
|
||||
@@ -50,6 +50,7 @@ SET(SOURCES main.c test_probes.c
|
||||
${COMMON_DIR}/object.c
|
||||
${COMMON_DIR}/event.c
|
||||
${COMMON_DIR}/logs.cpp
|
||||
+ ${COMMON_DIR}/whitelist_config.c
|
||||
)
|
||||
|
||||
FOREACH(FILE ${PROBES_C_LIST})
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
#needsrootforbuild
|
||||
%define __os_install_post %{nil}
|
||||
|
||||
%define vmlinux_ver 5.10.0-126.0.0.66.oe2203.%{_arch}
|
||||
@ -5,7 +6,7 @@
|
||||
Summary: Intelligent ops toolkit for openEuler
|
||||
Name: gala-gopher
|
||||
Version: 1.0.1
|
||||
Release: 4
|
||||
Release: 5
|
||||
License: Mulan PSL v2
|
||||
URL: https://gitee.com/openeuler/gala-gopher
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
@ -14,6 +15,7 @@ BuildRequires: systemd cmake gcc-c++ elfutils-devel libcurl-devel
|
||||
BuildRequires: clang >= 10.0.1 llvm java-1.8.0-openjdk-devel
|
||||
BuildRequires: libconfig-devel librdkafka-devel libmicrohttpd-devel
|
||||
BuildRequires: libbpf-devel >= 2:0.3 uthash-devel log4cplus-devel
|
||||
BuildRequires: CUnit CUnit-devel dmidecode junit
|
||||
Requires: bash glibc elfutils zlib elfutils-devel bpftool
|
||||
Requires: dmidecode python3-psycopg2 python3-yaml erlang-eflame
|
||||
Requires: flamegraph-stackcollapse iproute libcurl
|
||||
@ -28,6 +30,8 @@ Patch6: repair-stackprobe-caused-cpu-rush.patch
|
||||
Patch7: add-system_uuid-field-to-distinguish-client-when-pos.patch
|
||||
Patch8: fix-bug.patch
|
||||
Patch9: fix-ksliprobe-get-invalid-args-occasionally-at-start.patch
|
||||
Patch10: bugfix-fix-testcase-compile-and-run-err.patch
|
||||
Patch11: bugfix-fix-java_probe_test-find-jdk-path.patch
|
||||
|
||||
%description
|
||||
gala-gopher is a low-overhead eBPF-based probes framework
|
||||
@ -40,6 +44,13 @@ pushd build
|
||||
sh build.sh --release %{vmlinux_ver}
|
||||
popd
|
||||
|
||||
%check
|
||||
pushd test
|
||||
sh test_modules.sh
|
||||
sh test_extend_probes.sh
|
||||
sh test_probes.sh
|
||||
popd
|
||||
|
||||
%install
|
||||
install -d %{buildroot}/opt/gala-gopher
|
||||
install -d %{buildroot}%{_bindir}
|
||||
@ -75,6 +86,9 @@ popd
|
||||
/usr/lib/systemd/system/gala-gopher.service
|
||||
|
||||
%changelog
|
||||
* Wed Feb 22 2023 Tangxin Xie <xietangxin@huawei.com> - 1.0.1-5
|
||||
- fix testcase compile and run errs
|
||||
|
||||
* Tue Jan 31 2023 Zhen Chen <chenzhen126@huawei.com> - 1.0.1-4
|
||||
- add net-tools and ethtool to Requires
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user