From 58a6d0f17cae56a7bb31fd0a89e9ba52a92edb35 Mon Sep 17 00:00:00 2001 From: yangna Date: Wed, 3 Dec 2025 12:41:51 +0000 Subject: [PATCH 01/19] 12.03 Signed-off-by: yangna --- .../smoke-test/smock-sysSentry/comm/lib.sh | 244 ++++++++++++++++++ .../oe_test_sysSentry_kernel_reboot_001.sh | 31 +++ .../oe_test_sysSentry_kernel_reboot_004.sh | 32 +++ .../oe_test_sysSentry_panic_004.sh | 32 +++ .../oe_test_sysSentry_reboot_002.sh | 0 5 files changed, 339 insertions(+) create mode 100644 testcases/smoke-test/smock-sysSentry/comm/lib.sh create mode 100644 testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh create mode 100644 testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh create mode 100644 testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh create mode 100644 testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_reboot_002.sh diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh new file mode 100644 index 000000000..6264924ad --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -0,0 +1,244 @@ +source "$OET_PATH/libs/locallibs/common_lib.sh" + +TMP_DIR=/root/sysSentry_script +task_log_path=/var/log/sysSentry +run_alarm="/var/run/xalarm/alarm" +run_report="/var/run/xalarm/report" +xalarm_run_dir="/var/run/xalarm" +mkdir -p "${TMP_DIR}" + +function pre_env(){ + DNF_INSTALL "sysSentry" 1 + DNF_INSTALL "sysSentry" 2 + DNF_INSTALL "sysSentry" 3 + start_sentry + + SSH_CMD " + yum -y install sentry_msg_monitor + systemctl start xalarmd + systemctl start sysSentry + modprobe sentry_msg_helper + modprobe sentry_reporter + sleep 5 + modprobe sentry_urma_comm + modprobe odf + modprobe cis + sleep 5 + modprobe sentry_remote_reporter + sentryctl start sentry_msg_monitor + sleep 5 + lsmod | grep sentry + " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + SSH_CMD " + yum -y install sentry_msg_monitor + systemctl start xalarmd + systemctl start sysSentry + modprobe sentry_msg_helper + modprobe sentry_reporter + sleep 5 + modprobe sentry_urma_comm + modprobe odf + modprobe cis + sleep 5 + modprobe sentry_remote_reporter + sentryctl start sentry_msg_monitor + sleep 5 + lsmod | grep sentry + " "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" + + get_eid + +} +function pre_oom_env(){ + yum -y install sentry_msg_monitor + modprobe sentry_msg_helper + modprobe sentry_reporter + systemctl start xalarmd + systemctl start sysSentry + sleep 5 + sentryctl list | grep sentry_msg_monitor + +} + +function pre_xalarm_env(){ + DNF_INSTALL "sysSentry" 1 + yum -y remove libxalarm pyxalarm sentry_msg_monitor sysSentry + yum -y install sentry_msg_monitor + systemctl start xalarmd + systemctl start sysSentry + sleep 5 + sentryctl list | grep sentry_msg_monitor +} + +function start_sentry(){ + yum -y install sentry_msg_monitor + systemctl start xalarmd + systemctl start sysSentry + modprobe sentry_msg_helper + modprobe sentry_reporter + sleep 5 + modprobe sentry_urma_comm + modprobe odf + modprobe cis + sleep 5 + modprobe sentry_remote_reporter + sentryctl start sentry_msg_monitor + sleep 5 + lsmod |grep sentry +} + +function get_eid(){ + node1_eid1=$(urma_admin show | awk '/udma2/ && /eid0/ {print $5}') + node1_eid2=$(urma_admin show | awk '/udma5/ && /eid0/ {print $5}') + + # node2_eid1=$(SSH_CMD "urma_admin show | awk '/udma2/ && /eid0/ {print \$5}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') + # node2_eid2=$(SSH_CMD "urma_admin show | awk '/udma5/ && /eid0/ {print \$5}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') + + # node3_eid1=$(SSH_CMD "urma_admin show | awk '/udma2/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') + # node3_eid2=$(SSH_CMD "urma_admin show | awk '/udma5/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') + + # node1_cna=1 + # node2_cna=2 + # node3_cna=3 + test_jetty_id=$((RANDOM % 1021 + 3)) + +} +function start_RA(){ + local ra_type="${1}" + local ra_pare="${2:-}" + local delay_time="${3:-}" + case $ra_type in + panic | kernel_reboot) + stdbuf -oL "/root/mugen/testcases/smoke-test/smoke-sysSentry/RA/RA_reboot" "${ra_pare}" "${delay_time}" > "${TMP_DIR}/RA.log" 2>&1 & + ;; + oom) + stdbuf -oL "/root/mugen/testcases/smoke-test/smoke-sysSentry/RA/RA_${re_type}" > "${TMP_DIR}/RA.log" 2>&1 & + *) + stdbuf -oL "/root/mugen/testcases/smoke-test/smoke-sysSentry/RA/RA_${re_type}" > "${TMP_DIR}/RA_${re_type}.log" 2>&1 & + + esac + return $? +} + +function check_RA_xalarmd(){ + local ra_log="${1-RA_xalarmd.log}" + SLEEP_WAIT 30 "grep -aw 'alarmid:1003' ${TMP_DIR}/${ra_log} | grep -w 'msg:hello'" 2 + CHECK_RESULT $? 0 0 +} +function check_RA_plugin(){ + local ra_log="${1-RA_plugin.log}" + SLEEP_WAIT 30 "grep -aw 'alarmid:1004' ${TMP_DIR}/${ra_log} | grep -w 'msg:ACK OK'" 2 + CHECK_RESULT $? 0 0 +} +function clean_sysSentry_message(){ + echo > /var/log/sysSentry/xalarm.log + echo > /var/log/sysSentry/sentry_msg_monitor.log +} + +function check_oom_dmesg(){ + local sync_value="${1}" + local reason_value="${2}" + SLEEP_WAIT 30 "dmesg | grep -aw \"got lowmem message\" | grep -a \"sync=${sync_value} reason=${reason_value}\"" 2 +} +function check_RA_oom(){ + local sync_value="${1}" + local reason_value="${2}" + for ((check_ra_oom_loop=0; check_ra_oom_loop<5; check_ra_oom_loop++)); do + grep -aw "\[alarmid:1005\]" ${TMP_DIR}/RA.log | grep "\[msg:.*,sync:${sync_value},timeout:30000,reason:${reason_value}\]" && break + sleep 2 + done + [ "${check_ra_oom_loop}" -lt 5 ] || return 1 + tmp_nid_info=$(grep -aw "\[alarmid:1005\]" ${TMP_DIR}/RA.log | tail -1 | grep "\[msg:.*\]" | awk -F'{' '{print $2}' | awk -F'}' '{print $1}' | awk -F']' '{print $1}') + echo "$tmp_nid_info" + check_oom_nid_info "${tmp_nid_info}" + CHECK_RESULT $? 0 0 +} +function check_alarmd(){ + local tmp_alarm_id="${1}" + local tmp_alarm_msg_len="${2}" + local is_reply="${3}" + local tmp_reply_msg_len="${4}" + tmp_reply_id=$(expr "$tmp_alarm_id" + 1) + if [ "${tmp_alarm_msg_len}"="no"]; then + tmp_alarm_msg_len=".*" + else + tmp_alarm_msg_len="$(grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_alarm_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" + tmp_alarm_msg_len="$(expr "$tmp_alarm_msg_len" - 1)" + fi + + if [ "${tmp_reply_msg_len}"="no"]; then + tmp_reply_msg_len=".*" + else + tmp_reply_msg_len="$(grep -aw 'Get msg:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_reply_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" + tmp_reply_msg_len="$(expr "$tmp_reply_msg_len" - 1)" + fi + grep -aw "Broadcast msg success" ${task_log_path}/xalarm.log | grep "alarm msg is alarm_id: ${tmp_alarm_id}, alarm_level: MINOR_ALM, alarm_type: ALARM_TYPE_OCCUR" + CHECK_RESULT $? 0 0 + + grep "alarm_id: ${tmd_alarm_id}" ${task_log_path}/xalarm.log | grep "alarm_msg_len: ${tmp_alarm_msg_len}" + CHECK_RESULT $? 0 0 + +} +function check_oom_sentry_msg_monitor(){ + local sync_value="${1}" + local reason_value="${2}" + local is_reply="${3-true}" + grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "alarm_type: 1005, str: .*,sync:${sync_value},timeout:30000,reason:${reason_value}" + CHECK_RESULT $? 0 0 + tmp_nid_info=$(grep -aw "alarm_type: 1005" ${task_log_path}/sentry_msg_monitor.log | tail -1 | awk -F'str:' '{print $2}' | awk -F'{' '{print $2}' | awk -F'}' '{print $1}' | awk -F']' '{print $1}') + check_oom_nid_info "${tmp_nid_info}" + CHECK_RESULT $? 0 0 +} + +function check_oom_nid_info(){ + local tmp_nid_info="${1}" + # nr_nid=$(echo "$tmp_nid_info" | grep -oP '(?<=nr_nid:)\d+') + # tmp_nid_str=$(echo "$tmp_nid_info" | grep -oP '(?<=nid:\[)[^\]]+(?=)') + nid_str=($(echo "${tmp_nid_str[@]}" | tr ',' ' ')) + echo ${nid_str[@]:0:$(expr "$nr_nid")} | grep -v '\-1' + CHECK_RESULT $? 0 0 + echo ${nid_str[@]:"$nr_nid":$(expr ${#nid_str[@]} - 1)} | xargs -n 1 | grep '\-1' | wc -l | grep "$(expr ${#nid_str[@]} - "$nr_nid")" + CHECK_RESULT $? 0 0 +} +function check_log(){ + local reply_type="${1}" + local log_type="${2}" + local alarm_value="${3}" + local ack_value="${4}" + local alarm_count + local log_file + local grep_alarm + local grep_ack + + case "$log_type" in + "RA") + log_file="${TMP_DIR}/RA.log" + grep_alarm="\[alarmid:${alarm_value}\]" + ;; + "alarmd") + log_file="${task_log_path}/xalarm.log" + grep_alarm="alarm_id: ${alarm_value}," + grep_ack="alarm_id: ${ack_value}" + ;; + "monitor") + log_file="${task_log_path}/sentry_msg_monitor.log" + grep_alarm="alarm_type: ${alarm_value}" + grep_ack="alarm_type: ${ack_value}" + ;; + esac + + timeout=$([ "reply_type" -eq 2 ] && echo 100 || echo 50) + sleep "$timeout" + cat "$log_file" + alarm_count=$(grep -a "$grep_alarm" "$log_file" | wc -l) + send_ack=$(grep -a "$grep_ack" "$log_file" | wc -l) + + test $alarm_count -ge 1 + CHECK_RESULT $? 0 0 + + if [ "$log_type" != "RA" -a "$reply_type" = "0" ]; then + test $send_ack -ge 1 + CHECK_RESULT $? 0 0 + fi +} diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh new file mode 100644 index 000000000..23f2f38e7 --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh @@ -0,0 +1,31 @@ +source "./comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid=${node2_eid1} --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" + SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + start_RA kernel_reboot 0 0 + SSH_CMD "reboot" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + check_log 0 RA 1009 1010 + check_log 0 alarmd 1009 1010 + check_log 0 monitor 1009 1010 + +} +function post_test(){ + clean_sysSentry_message + DNF_REMOVE "sysSentry" 1 + DNF_REMOVE "sysSentry" 2 +} + +main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh new file mode 100644 index 000000000..7be36a778 --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh @@ -0,0 +1,32 @@ +source "./comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node3_cna} --eid='${node3_eid1};${node3_eid2}' --panic=on --kernel_reboot=on " "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1},${node3_eid1};${node1_eid2},${node2_eid2},${node3_eid2}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1},${node3_eid1};${node2_eid2},${node1_eid2},${node3_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node3_eid1},${node1_eid1},${node2_eid1};${node3_eid2},${node1_eid2},${node2_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" + + start_RA kernel_reboot 0 0 + SSH_CMD "reboot" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + SSH_CMD "reboot" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" + + check_log 0 RA 1009 1010 + check_log 0 alarmd 1009 1010 + check_log 0 monitor 1009 1010 + +} +function post_test(){ + clean_sysSentry_message + DNF_REMOVE "sysSentry" 1 + DNF_REMOVE "sysSentry" 2 + DNF_REMOVE "sysSentry" 3 +} + +main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh new file mode 100644 index 000000000..0f131ac28 --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh @@ -0,0 +1,32 @@ +source "./comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node3_cna} --eid='${node3_eid1};${node3_eid2}' --panic=on --kernel_reboot=on " "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1},${node3_eid1};${node1_eid2},${node2_eid2},${node3_eid2}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1},${node3_eid1};${node2_eid2},${node1_eid2},${node3_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node3_eid1},${node1_eid1},${node2_eid1};${node3_eid2},${node1_eid2},${node2_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" + + start_RA kernel_reboot 0 0 + SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" + + check_log 0 RA 1007 1008 + check_log 0 alarmd 1007 1008 + check_log 0 monitor 1007 1008 + +} +function post_test(){ + clean_sysSentry_message + DNF_REMOVE "sysSentry" 1 + DNF_REMOVE "sysSentry" 2 + DNF_REMOVE "sysSentry" 3 +} + +main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_reboot_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_reboot_002.sh new file mode 100644 index 000000000..e69de29bb -- Gitee From 826825a950824e8f6d9120c518d55960754f1463 Mon Sep 17 00:00:00 2001 From: yangna Date: Wed, 3 Dec 2025 12:51:12 +0000 Subject: [PATCH 02/19] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20te?= =?UTF-8?q?stcases/smoke-test/smock-sysSentry/oe=5Ftest=5FsysSentry=5Frebo?= =?UTF-8?q?ot=5F002.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../smoke-test/smock-sysSentry/oe_test_sysSentry_reboot_002.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_reboot_002.sh diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_reboot_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_reboot_002.sh deleted file mode 100644 index e69de29bb..000000000 -- Gitee From 39108c816d63b859a7eab2bbf5852efc87ba9669 Mon Sep 17 00:00:00 2001 From: yangna Date: Sat, 6 Dec 2025 13:44:21 +0000 Subject: [PATCH 03/19] 12.6 Signed-off-by: yangna --- .../smoke-test/smock-sysSentry/RA/RA_reboot.c | 16 ++++ .../oe_test_sysSentry_kernel_reboot_002.sh | 28 +++++++ .../oe_test_sysSentry_kernel_reboot_003.sh | 31 ++++++++ .../smock-sysSentry/oe_test_sysSentry_oom.sh | 32 ++++++++ .../oe_test_sysSentry_panic_001.sh | 31 ++++++++ .../oe_test_sysSentry_panic_002.sh | 29 +++++++ .../oe_test_sysSentry_panic_003.sh | 31 ++++++++ .../oe_test_sysSentry_panic_004.sh | 7 +- .../oe_test_sysSentry_xalarmd_recorver.sh | 79 +++++++++++++++++++ 9 files changed, 279 insertions(+), 5 deletions(-) create mode 100644 testcases/smoke-test/smock-sysSentry/RA/RA_reboot.c create mode 100644 testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh create mode 100644 testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh create mode 100644 testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh create mode 100644 testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh create mode 100644 testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh create mode 100644 testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh create mode 100644 testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh diff --git a/testcases/smoke-test/smock-sysSentry/RA/RA_reboot.c b/testcases/smoke-test/smock-sysSentry/RA/RA_reboot.c new file mode 100644 index 000000000..572e54145 --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/RA/RA_reboot.c @@ -0,0 +1,16 @@ +#include +#include +#include +#include +#include +#include +#include +#include "smh_common_type.h" + +#define SLEEP_ +#define +#define +#define +#define +#define +#define \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh new file mode 100644 index 000000000..81cef3f45 --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh @@ -0,0 +1,28 @@ +source "./comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1};${node1_eid2},${node2_eid2}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1};${node2_eid2},${node1_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + start_RA kernel_reboot 2 0 + SSH_CMD "reboot" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + check_log 2 RA 1009 1010 + check_log 2 alarmd 1009 1010 + check_log 2 monitor 1009 1010 + +} +function post_test(){ + clean_sysSentry_message + DNF_REMOVE "sysSentry" 1 + DNF_REMOVE "sysSentry" 2 +} + +main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh new file mode 100644 index 000000000..972192715 --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh @@ -0,0 +1,31 @@ +source "./comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1};${node1_eid2},${node2_eid2}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1};${node2_eid2},${node1_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" + SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + start_RA kernel_reboot 0 30 + SSH_CMD "reboot" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + check_log 0 RA 1009 1010 + check_log 0 alarmd 1009 1010 + check_log 0 monitor 1009 1010 + +} +function post_test(){ + clean_sysSentry_message + DNF_REMOVE "sysSentry" 1 + DNF_REMOVE "sysSentry" 2 +} + +main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh new file mode 100644 index 000000000..7b7fb0161 --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh @@ -0,0 +1,32 @@ +source "./comm/lib.sh" +set -x + +function pre_test(){ + pre_oom_env +} +function run_test(){ + start_RA oom + CHECK_RESULT $? 0 0 + /root/mugen/testcases/cli-test/sysSentry/RA/oom & #后面改一下 + oom_pid=$! + + check_oom_dmesg 0 0 + CHECK_RESULT $? 0 0 + + kill -9 $oom_pid + check_RA_oom 0 0 + CHECK_RESULT $? 0 0 + + check_alarmd 1005 71 " " 3 + CHECK_RESULT $? 0 0 + + check_oom_sentry_msg_monitor 0 0 true + CHECK_RESULT $? 0 0 + +} +function post_test(){ + clean_sysSentry_message + +} + +main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh new file mode 100644 index 000000000..2e745b0a2 --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh @@ -0,0 +1,31 @@ +source "./comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid=${node2_eid1} --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" + SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + start_RA panic 0 0 + SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + check_log 0 RA 1007 1008 + check_log 0 alarmd 1007 1008 + check_log 0 monitor 1007 1008 + +} +function post_test(){ + clean_sysSentry_message + DNF_REMOVE "sysSentry" 1 + DNF_REMOVE "sysSentry" 2 +} + +main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh new file mode 100644 index 000000000..19feeff21 --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh @@ -0,0 +1,29 @@ +source "./comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1};${node1_eid2},${node2_eid2}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1};${node2_eid2},${node1_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + start_RA panic 2 0 + SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + check_log 2 RA 1007 1008 + check_log 2 alarmd 1007 1008 + check_log 2 monitor 1007 1008 + + +} +function post_test(){ + clean_sysSentry_message + DNF_REMOVE "sysSentry" 1 + DNF_REMOVE "sysSentry" 2 +} + +main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh new file mode 100644 index 000000000..5a88b8c69 --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh @@ -0,0 +1,31 @@ +source "./comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1};${node1_eid2},${node2_eid2}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1};${node2_eid2},${node1_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" + SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + start_RA panic 0 30 + SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + check_log 0 RA 1007 1008 + check_log 0 alarmd 1007 1008 + check_log 0 monitor 1007 1008 + +} +function post_test(){ + clean_sysSentry_message + DNF_REMOVE "sysSentry" 1 + DNF_REMOVE "sysSentry" 2 +} + +main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh index 0f131ac28..07611ae23 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh @@ -7,15 +7,12 @@ function pre_test(){ function run_test(){ sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node3_cna} --eid='${node3_eid1};${node3_eid2}' --panic=on --kernel_reboot=on " "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1},${node3_eid1};${node1_eid2},${node2_eid2},${node3_eid2}" --client_jetty_id="${test_jetty_id}" SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1},${node3_eid1};${node2_eid2},${node1_eid2},${node3_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node3_eid1},${node1_eid1},${node2_eid1};${node3_eid2},${node1_eid2},${node2_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" - start_RA kernel_reboot 0 0 + start_RA panic 0 0 SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" check_log 0 RA 1007 1008 check_log 0 alarmd 1007 1008 @@ -26,7 +23,7 @@ function post_test(){ clean_sysSentry_message DNF_REMOVE "sysSentry" 1 DNF_REMOVE "sysSentry" 2 - DNF_REMOVE "sysSentry" 3 + } main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh new file mode 100644 index 000000000..93c9e087d --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh @@ -0,0 +1,79 @@ +source "./comm/lib.sh" +set -x + +function check_RA_xalarmd_log(){ + SLEEP_WAIT 30 "systemctl is-active xalarmd.service" 2 + CHECK_RESULT $? 0 0 + sleep 6 #等服务重启 + start_RA xalarmd + CHECK_RESULT $? 0 0 + + start_RA plugin + CHECK_RESULT $? 0 0 + + check_RA_xalarmd + check_RA_plugin +} + +function check_xalarmd_log(){ + grep "${run_alarm} not found or socket file been replaced, recovering" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + grep "${run_report} not found or socket file been replaced, recovering" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + grep "${run_alarm} has been created" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + grep "${run_report} has been created" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + +} +function pre_test(){ + pre_xalarm_env +} +function run_test(){ + check_RA_xalarmd_log + clean_sysSentry_message + + rm -rf "${run_alarm}" + rm -rf "${run_report}" + check_RA_xalarmd_log + check_xalarmd_log + + clean_sysSentry_message + rm -rf "${run_alarm}" && touch "${run_alarm}" + rm -rf "${run_report}" && touch "${run_alarm}" + check_RA_xalarmd_log + check_xalarmd_log + + chmod 700 "${run_alarm}" + chmod 700 "${run_report}" + + check_RA_xalarmd_log + + grep "socket file ${run_alarm} permission .* set not properly, recover as default permission" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + grep "socket file ${run_report} permission .* set not properly, recover as default permission" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + + chmod 700 "${xalarm_run_dir}" + check_RA_xalarmd_log + grep "${xalarm_run_dir} permission set not properly, recover as default permission" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + + rm -rf "${xalarm_run_dir}" + check_RA_xalarmd_log + grep "xalarmd run dir not exists, create ${xalarm_run_dir}" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + + kill -9 "$(pgrep -f /usr/bin/xalarmd)" + check_RA_xalarmd_log + grep "xalarm daemon init success" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + +} +function post_test(){ + clean_sysSentry_message + systemctl stop xalarmd + +} + +main "$@" \ No newline at end of file -- Gitee From 51b8680bccdfe4b8cfd132b877ad1c41a364b085 Mon Sep 17 00:00:00 2001 From: yangna Date: Thu, 11 Dec 2025 01:31:20 +0000 Subject: [PATCH 04/19] 1211 Signed-off-by: yangna --- .../smoke-test/smock-sysSentry/RA/RA_oom.c | 84 +++++++++ .../smoke-test/smock-sysSentry/RA/RA_plugin.c | 73 ++++++++ .../smoke-test/smock-sysSentry/RA/RA_reboot.c | 169 +++++++++++++++++- .../smock-sysSentry/RA/RA_xalarmd.c | 63 +++++++ 4 files changed, 382 insertions(+), 7 deletions(-) create mode 100644 testcases/smoke-test/smock-sysSentry/RA/RA_oom.c create mode 100644 testcases/smoke-test/smock-sysSentry/RA/RA_plugin.c create mode 100644 testcases/smoke-test/smock-sysSentry/RA/RA_xalarmd.c diff --git a/testcases/smoke-test/smock-sysSentry/RA/RA_oom.c b/testcases/smoke-test/smock-sysSentry/RA/RA_oom.c new file mode 100644 index 000000000..9145f8fbb --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/RA/RA_oom.c @@ -0,0 +1,84 @@ +#include +#include +#include +#include +#include + +#define SLEEP_TIME 10 +#define ID_LIST_LENGTH 1 +#define TIME_UNIT_MILLISECONDS 1000 + +int need_ack = 0; +unsigned long process_alarm_info(struct alarm_msg *param) +{ + int alarmid; + long long alarmtime; + char *pucParas; + + alarmid = (param == NULL ? 0 : param->usAlarmId); + alarmtime = (param == NULL ? 0 : ((long long)(param->AlarmTime.tv_sec) * TIME_UNIT_MILLISECONDS + (long long)(param->AlarmTime.tv_usec) / TIME_UNIT_MILLISECONDS)); + pucParas = (param == NULL ? NULL : (char *)param->pucParas); + + unsigned long msgid; + char buf[1024]; + sscanf(pucParas, "%lu_", &msgid); + char *sync_pos = strstr(pucParas, "sync:"); + if(sync_pos) + { + sscanf(sync_pos, "sync:%d," , &need_ack); + + } + printf("msgid : %lu\n" , msgid); + printf("need_ack : %d\n" , need_ack); + printf("plugin notified with [alarmid:%d] [alarmtime:%lld ms] [msg:%s]\n" , + alarmid, alarmtime,pucParas); + return msgid; +} +int main(int argc, char **argv) +{ + int ret; + struct alarm_register *register_info; + struct alarm_subscription_info id_filter; + struct alarm_msg *msg = malloc(sizeof(struct alarm_msg)); + id_filter.id_list[0] = ALARM_OOM_EVENT; + id_filter.len = 1; + ret = xalarm_register_event(®ister_info, id_filter); + if(ret < 0) + { + printf("%d\n", ret); + perror("Failed to register xalarm\n"); + return 1; + + } + while(1) + { + printf("===Waiting for plugin msg ... \n"); + ret = xalarm_get_event(msg, register_info); + if(ret < 0) + { + perror("Failed to get msg\n"); + return 1; + } + printf("Processing msg from plugin ... \n"); + unsigned long msgid = process_alarm_info(msg); + if (need_ack) + { + printf("Ack msg to plugin ...\n"); + char ack[256]; + int nr_freed = 0; + sprintf(ack, "%lu_%d", msgid, nr_freed); + ret = xalarm_report_event(ALARM_OOM_ACK_EVENT, ack); + if(ret < 0) + { + perror("Failed to send msg\n"); + return 1; + } + } + else + { + printf("no need ack .. \n"); + } + } + xalarm_unregister_event(register_info); + return 0; + } \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/RA/RA_plugin.c b/testcases/smoke-test/smock-sysSentry/RA/RA_plugin.c new file mode 100644 index 000000000..ff90ea5f0 --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/RA/RA_plugin.c @@ -0,0 +1,73 @@ +#include +#include +#include +#include +#include + + +#define ID_LIST_LENGTH 1 +#define ID_INDEX_0 0 +#define TIME_UNIT_MILLISECONDS 1000 + +void RefreshOutput(void) +{ + int ret = fflush(stdout); + if (ret !=0){ + printf("Failed to fflush \n"); + + } +} +void print_alarm_info(struct alarm_msg *param) +{ + int alarmid; + long long alarmtime; + char *pucParas; + alarmid=(param == NULL ? 0 : param->usAlarmId); + alarmtime = (param == NULL ? 0 : ((long long)(param->AlarmTime.tv_sec) * TIME_UNIT_MILLISECONDS + + (long long)(param->AlarmTime.tv_usec) / TIME_UNIT_MILLISECONDS)); + pucParas = (param == NULL ? NULL : (char *)param->pucParas); + printf("plugin notified with [alarmid:%d] [alarmtime:%lld ms] [msg:%s]\n", + alarmid, alarmtime, pucParas); + return; +} + +int main(int argc, char **argv) +{ + struct alarm_register* register_info; + pthread_t thread_id; + int ret; + struct alarm_subscription_info id_filter; + struct alarm_msg *msg = malloc(sizeof(struct alarm_msg)); + char input[256]; + const char *auto_input = "hello"; + size_t len = strlen(auto_input); + + strncpy(input, auto_input, sizeof(input)); + input[sizeof(input)-1] = '\0'; + + if(len > 0 && input[len-1] == '\n'){ + input[len-1] = '\0'; + } + + printf ("Sending %s msg to RA ...", input); + xalarm_report_event(ALARM_REBOOT_EVENT, input); + id_filter.id_list[ID_INDEX_0] = ALARM_REBOOT_ACK_EVENT; + id_filter.len = ID_LIST_LENGTH; + ret = xalarm_register_event(®ister_info, id_filter); + if(ret < 0 ){ + printf("%d\n", ret); + perror("Failed to register xalarm\n"); + return 1; + } + printf("Waiting for RA msg .....\n"); + ret = xalarm_get_event(msg, register_info); + if(ret < 0){ + perror("Failed to get msg\n"); + return 1; + } + RefreshOutput(); + print_alarm_info(msg); + xalarm_unregister_event(register_info); + RefreshOutput(); + return 0; +} \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/RA/RA_reboot.c b/testcases/smoke-test/smock-sysSentry/RA/RA_reboot.c index 572e54145..cbbb477af 100644 --- a/testcases/smoke-test/smock-sysSentry/RA/RA_reboot.c +++ b/testcases/smoke-test/smock-sysSentry/RA/RA_reboot.c @@ -7,10 +7,165 @@ #include #include "smh_common_type.h" -#define SLEEP_ -#define -#define -#define -#define -#define -#define \ No newline at end of file +#define SLEEP_TIME 1 +#define SMH_MESSAGE_MAX 4 +#define ID_LIST_LENGTH SMH_MESSAGE_MAX +#define TIME_UNIT_MILLISECONDS 1000 +#define URMA_SEND_DATA_MAX_LEN 100 + +int event_id; +int ack_result = 0; +int g_wait_ack_event_id; +struct alarm_register* register_info; + +void signal_handler(int signum){ + printf("收到信号:%d, 程序将退出\n", signum); + xalarm_unregister_event(register_info); +} +void process_alarm_info(struct alarm_msg *param) +{ + int alarmid; + long long alarmtime; + char *pucParas; + if (param == NULL){ + perror("接受插件发送的消息失败\n"); + return; + } + alarmid = param->usAlarmId; + event_id= alarmid; + alarmtime = ((long long)(param->AlarmTime.tv_sec)* TIME_UNIT_MILLISECONDS + (long long)(param->AlarmTime.tv_usec) / TIME_UNIT_MILLISECONDS); + pucParas = (char *)param ->pucParas; + printf ("plugin notified with [alarmid:%d] [alarmtime:%lld ms] [msg:%s]\n", alarmid, alarmtime, pucParas); + return; +} +int main(int argc, char **argv) +{ + struct alarm_msg *msg =malloc(sizeof(struct alarm_msg)); + struct alarm_subscription_info id_filter; + id_filter.id_list[0] = ALARM_REBOOT_EVENT; + id_filter.id_list[1] = ALARM_OOM_EVENT; + id_filter.id_list[2] = ALARM_PANIC_EVENT; + id_filter.id_list[3] = ALARM_KERNEL_REBOOT_EVENT; + + id_filter.len = ID_LIST_LENGTH; + int ret; + ack_result = atoi(argv[1]); + time_t start_time, current_time; + bool time_start_flag = false; + double elapsed_seconds; + int delay_ack_time=0; + sscanf(argv[2], "%d", &delay_ack_time); + int cnt = 0; + + ret = xalarm_register_event(®ister_info, id_filter); + if(ret < 0){ + perror("Failed to register xalarm\n"); + return 1; + } + signal(SIGINT, signal_handler); + signal(SIGTERM, signal_handler); + + while (1){ + printf("waiting for plugin msg....\n"); + ret = xalarm_get_event(msg, register_info); + if (ret<0){ + perror("Failed to get msg \n"); + return 1; + }else { + printf("get mgs success, cnt is %d.\n", ++cnt); + } + process_alarm_info(msg); + if(!time_start_flag){ + time(&start_time); + time_start_flag = true; + g_wait_ack_event_id = event_id; + } + if (g_wait_ack_event_id == ALARM_REBOOT_EVENT){ + if (ack_result !=2){ + char res_str[256]; + snprintf(res_str, 256, "%s_%d", msg->pucParas, ack_result); + ret = xalarm_report_event(ALARM_REBOOT_ACK_EVENT, res_str); + if(ret < 0){ + perror("Failed to send reboot ack msg \n"); + return 1; + } + printf("send reboot ack msg to plugin \n"); + } + }else if (g_wait_ack_event_id == ALARM_OOM_EVENT){ + if(ack_result !=2){ + char res_str[256]; + snprintf(res_str, 256, "%s_%d", msg->pucParas, ack_result); + ret=xalarm_report_event(ALARM_OOM_ACK_EVENT, res_str); + if(ret < 0){ + perror("Failed to send oom ack msg\n"); + return 1; + } + printf("send oom ack msg to plugin \n"); + } + }else if (g_wait_ack_event_id == ALARM_PANIC_EVENT){ + if(ack_result !=2){ + char res_str[URMA_SEND_DATA_MAX_LEN]; + snprintf(res_str, URMA_SEND_DATA_MAX_LEN, "%s_%d", msg->pucParas, ack_result); + if (delay_ack_time <=0){ + time_start_flag =false; + ret = xalarm_report_event(ALARM_PANIC_ACK_EVENT, res_str); + if(ret < 0) { + printf("Failed to send panic ack msg %s\n", res_str); + return 1; + + } + printf("send panic ack msg to plugin %s\n", res_str); + continue; + } + time(¤t_time); + elapsed_seconds = difftime(current_time, start_time); + + printf("pass: %.0fs | remain:%ds", + elapsed_seconds, delay_ack_time - (int)elapsed_seconds); + fflush(stdout); + if(elapsed_seconds >= delay_ack_time){ + time_start_flag = false; + ret = xalarm_report_event(ALARM_PANIC_ACK_EVENT, res_str); + if(ret < 0){ + printf("Failed to send panic ack msg %s\n", res_str); + return 1; + } + printf("send panic ack msg to plugin %s\n", res_str); + } + + } + }else if (g_wait_ack_event_id == ALARM_KERNEL_REBOOT_EVENT){ + if(ack_result !=2){ + char res_str[URMA_SEND_DATA_MAX_LEN]; + snprintf(res_str, URMA_SEND_DATA_MAX_LEN, "%s_%d", msg->pucParas, ack_result); + if(delay_ack_time <=0){ + time_start_flag=false; + ret = xalarm_report_event(ALARM_KERNEL_REBOOT_ACK_EVENT, res_str); + if(ret < 0){ + printf("Failed to send kernel reboot ack msg %s\n", res_str); + return 1; + } + printf("send kernel reboot ack msg to plugin %s\n", res_str); + continue; + } + time(¤t_time); + elapsed_seconds = difftime(current_time, start_time); + printf("pass: %.0fs | remain:%ds", + elapsed_seconds, delay_ack_time - (int)elapsed_seconds); + fflush(stdout); + if (elapsed_seconds >=delay_ack_time){ + time_start_flag =false; + ret = xalarm_report_event(ALARM_KERNEL_REBOOT_ACK_EVENT, res_str); + if(ret < 0){ + printf("Failed to send kernel reboot ack msg %s\n", res_str); + return 1; + } + printf("send kernel reboot ack msg to plugin %s\n", res_str); + } + } + } + } + xalarm_unregister_event(register_info); + return 0; + +} \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/RA/RA_xalarmd.c b/testcases/smoke-test/smock-sysSentry/RA/RA_xalarmd.c new file mode 100644 index 000000000..2b49e0381 --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/RA/RA_xalarmd.c @@ -0,0 +1,63 @@ +#include +#include +#include +#include +#include + +#define SLEEP_TIME 10 +#define ID_LIST_LENGTH 1 +#define TIME_UNIT_MILLISECONDS 1000 + +void process_alarm_info(struct alarm_msg *param) +{ + int alarmid; + long long alarmtime; + char *pucParas; + + alarmid = (param == NULL ? 0 : param->usAlarmId); + alarmtime = (param == NULL ? 0 : ((long long)(param->AlarmTime.tv_sec) * TIME_UNIT_MILLISECONDS + + (long long)(param->AlarmTime.tv_usec) / TIME_UNIT_MILLISECONDS)); + pucParas = (param == NULL ? NULL : (char *)param->pucParas); + + printf("plugin notified with [alarmid:%d] [alarmtime:%lld ms] [msg:%s]\n" , + alarmid, alarmtime,pucParas); + return; +} +int main(int argc, char **argv) +{ + int ret; + struct alarm_register *register_info; + struct alarm_subscription_info id_filter; + struct alarm_msg *msg = malloc(sizeof(struct alarm_msg)); + id_filter.id_list[0] = ALARM_REBOOT_EVENT; + id_filter.len = 1; + ret = xalarm_register_event(®ister_info, id_filter); + if(ret < 0){ + printf("%d\n", ret); + perror("Failed to register xalarm\n"); + return 1; + + } + printf("Waiting for plugin msg ... \n"); + ret = xalarm_get_event(msg, register_info); + if(ret < 0){ + perror("Failed to get msg\n"); + return 1; + } + + printf("Processing msg from plugin ... \n"); + + process_alarm_info(msg); + sleep(5); + xalarm_unregister_event(register_info); + printf("Reporting msg to plugin ... \n"); + + ret = xalarm_report_event(ALARM_REBOOT_ACK_EVENT, "ACK OK"); + + + if(ret < 0){ + perror("Failed to send msg\n"); + return 1; + } + return 0; + } \ No newline at end of file -- Gitee From 9dda038d570ecca716e6f1497b641f18d11bbaef Mon Sep 17 00:00:00 2001 From: yangna Date: Thu, 11 Dec 2025 01:31:28 +0000 Subject: [PATCH 05/19] 1211 Signed-off-by: yangna --- testcases/smoke-test/smock-sysSentry/comm/lib.sh | 10 ++++++++++ .../smock-sysSentry/oe_test_sysSentry_oom.sh | 7 ++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh index 6264924ad..6811d0770 100644 --- a/testcases/smoke-test/smock-sysSentry/comm/lib.sh +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -103,6 +103,15 @@ function get_eid(){ # node3_cna=3 test_jetty_id=$((RANDOM % 1021 + 3)) +} +function gcc_ra(){ + local re_type="$1" + [-n "${ra_type}"] && re_type="_$_ra_type" + DNF_INSTALL "sentry_msg_monitor" + DNF_INSTALL "libxalarm-devel" + DNF_INSTALL "gcc" + + } function start_RA(){ local ra_type="${1}" @@ -110,6 +119,7 @@ function start_RA(){ local delay_time="${3:-}" case $ra_type in panic | kernel_reboot) + stdbuf -oL "/root/mugen/testcases/smoke-test/smoke-sysSentry/RA/RA_reboot" "${ra_pare}" "${delay_time}" > "${TMP_DIR}/RA.log" 2>&1 & ;; oom) diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh index 7b7fb0161..9869750dc 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh @@ -7,13 +7,14 @@ function pre_test(){ function run_test(){ start_RA oom CHECK_RESULT $? 0 0 - /root/mugen/testcases/cli-test/sysSentry/RA/oom & #后面改一下 - oom_pid=$! + # /root/mugen/testcases/cli-test/sysSentry/RA/oom & #后面改一下 + echo 50000 | sudo tee /proc/sys/vm/nr_hugepages + # oom_pid=$! check_oom_dmesg 0 0 CHECK_RESULT $? 0 0 - kill -9 $oom_pid + # kill -9 $oom_pid check_RA_oom 0 0 CHECK_RESULT $? 0 0 -- Gitee From 53950813f4d54a05eb70c63d852b8618eb455d9a Mon Sep 17 00:00:00 2001 From: yangna Date: Thu, 11 Dec 2025 14:33:11 +0000 Subject: [PATCH 06/19] 1211 Signed-off-by: yangna --- .../smock-sysSentry/RA/smh_common_type.h | 85 +++++++++++++++++++ .../smoke-test/smock-sysSentry/comm/lib.sh | 48 +++++++---- .../oe_test_sysSentry_kernel_reboot_001.sh | 4 +- .../oe_test_sysSentry_kernel_reboot_002.sh | 4 +- .../oe_test_sysSentry_kernel_reboot_003.sh | 6 +- .../oe_test_sysSentry_kernel_reboot_004.sh | 7 +- .../smock-sysSentry/oe_test_sysSentry_oom.sh | 11 +-- .../oe_test_sysSentry_panic_001.sh | 4 +- .../oe_test_sysSentry_panic_002.sh | 4 +- .../oe_test_sysSentry_panic_003.sh | 6 +- .../oe_test_sysSentry_panic_004.sh | 6 +- .../oe_test_sysSentry_xalarmd_recorver.sh | 10 +-- 12 files changed, 137 insertions(+), 58 deletions(-) create mode 100644 testcases/smoke-test/smock-sysSentry/RA/smh_common_type.h diff --git a/testcases/smoke-test/smock-sysSentry/RA/smh_common_type.h b/testcases/smoke-test/smock-sysSentry/RA/smh_common_type.h new file mode 100644 index 000000000..dffca147f --- /dev/null +++ b/testcases/smoke-test/smock-sysSentry/RA/smh_common_type.h @@ -0,0 +1,85 @@ +#ifndef SMH_COMMON_TYPE_H +#define SMH_COMMON_TYPE_H + +#include + +#define SMH_TYPE ('}') +#define OOM_EVENT_MAX_NUMA_NODES 8 +#define EID_MAX_LEN 40 // eid str len 39 + '\0' + +enum { + SMH_CMD_MSG_ACK = 0x10, +}; + +#define SMH_MSG_ACK _IO(SMH_TYPE, SMH_CMD_MSG_ACK) + +enum ras_err_type { + UB_MEM_ATOMIC_DATA_ERR = 0, + UB_MEM_READ_DATA_ERR, + UB_MEM_FLOW_POISON, + UB_MEM_FLOW_READ_AUTH_POISON, + UB_MEM_FLOW_READ_AUTH_RESPERR, + UB_MEM_TIMEOUT_POISON, + UB_MEM_TIMEOUT_RESPERR, + UB_MEM_READ_DATA_POISON, + UB_MEM_READ_DATA_RESPERR, + MAR_NOPORT_VLD_INT_ERR, + MAR_FLUX_INT_ERR, + MAR_WITHOUT_CXT_ERR, + RSP_BKPRE_OVER_TIMEOUT_ERR, + MAR_NEAR_AUTH_FAIL_ERR, + MAR_FAR_AUTH_FAIL_ERR, + MAR_TIMEOUT_ERR, + MAR_ILLEGAL_ACCESS_ERR, + REMOTE_READ_DATA_ERR_OR_WRITE_RESPONSE_ERR, +}; + +enum sentry_ubus_mem_err_type { + SENTRY_MEM_ERR_ROUTE, + SENTRY_MEM_FLUX_INT, + SENTRY_MEM_ERR_OUTBOUND_TRANSLATION, + SENTRY_MEM_ERR_INBOUND_TRANSLATION, + SENTRY_MEM_ERR_TIMEOUT, + SENTRY_MEM_ERR_BUS, + SENTRY_MEM_ERR_UCE, + SENTRY_MEM_ERR_NO_REPORT = 1000, +}; + +enum sentry_msg_helper_msg_type { + SMH_MESSAGE_POWER_OFF, + SMH_MESSAGE_OOM, + SMH_MESSAGE_PANIC, + SMH_MESSAGE_KERNEL_REBOOT, + SMH_MESSAGE_UB_MEM_ERR, + SMH_MESSAGE_PANIC_ACK, + SMH_MESSAGE_KERNEL_REBOOT_ACK, +}; + +struct sentry_msg_helper_msg { + enum sentry_msg_helper_msg_type type; + uint64_t msgid; + uint64_t start_send_time; + uint64_t timeout_time; + // reboot_info is empty + union { + struct { + int nr_nid; + int nid[OOM_EVENT_MAX_NUMA_NODES]; + int sync; + int timeout; + int reason; + } oom_info; + struct { + uint32_t cna; + char eid[EID_MAX_LEN]; + } remote_info; + struct { + uint64_t pa; + enum ras_err_type raw_ubus_mem_err_type; + } ub_mem_info; + } helper_msg_info; + unsigned long res; +}; + +#endif + diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh index 6811d0770..44c23dfd9 100644 --- a/testcases/smoke-test/smock-sysSentry/comm/lib.sh +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -5,12 +5,15 @@ task_log_path=/var/log/sysSentry run_alarm="/var/run/xalarm/alarm" run_report="/var/run/xalarm/report" xalarm_run_dir="/var/run/xalarm" +ra_path="$OET_PATH/testcases/smoke-test/smoke-sysSentry/RA" mkdir -p "${TMP_DIR}" function pre_env(){ + local node_num="$1" + DNF_INSTALL "sysSentry" 1 DNF_INSTALL "sysSentry" 2 - DNF_INSTALL "sysSentry" 3 + [ -n "${node_num}" ] && DNF_INSTALL "sysSentry" 3 start_sentry SSH_CMD " @@ -30,7 +33,7 @@ function pre_env(){ lsmod | grep sentry " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - SSH_CMD " + [ -n "${node_num}" ] && SSH_CMD " yum -y install sentry_msg_monitor systemctl start xalarmd systemctl start sysSentry @@ -92,24 +95,31 @@ function get_eid(){ node1_eid1=$(urma_admin show | awk '/udma2/ && /eid0/ {print $5}') node1_eid2=$(urma_admin show | awk '/udma5/ && /eid0/ {print $5}') - # node2_eid1=$(SSH_CMD "urma_admin show | awk '/udma2/ && /eid0/ {print \$5}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') - # node2_eid2=$(SSH_CMD "urma_admin show | awk '/udma5/ && /eid0/ {print \$5}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') + node2_eid1=$(SSH_CMD "urma_admin show | awk '/udma2/ && /eid0/ {print \$5}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') + node2_eid2=$(SSH_CMD "urma_admin show | awk '/udma5/ && /eid0/ {print \$5}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') - # node3_eid1=$(SSH_CMD "urma_admin show | awk '/udma2/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') - # node3_eid2=$(SSH_CMD "urma_admin show | awk '/udma5/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') + node3_eid1=$(SSH_CMD "urma_admin show | awk '/udma2/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') + node3_eid2=$(SSH_CMD "urma_admin show | awk '/udma5/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') # node1_cna=1 # node2_cna=2 - # node3_cna=3 + node1_cna=$(( $(cat /sys/devices/ub_bus_controller0/00001/primary_cna | tr -d '[:space:]') )) + raw_output=$(SSH_CMD "cat /sys/devices/ub_bus_controller0/00001/primary_cna 2>/dev/null" \ + "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}") + + hex_value=$(echo "$raw_output" | tr -d '[:space:]' | grep -oE '0x[0-9A-Fa-f]+') + node2_cna=$(( $hex_value )) + node3_cna=3 test_jetty_id=$((RANDOM % 1021 + 3)) } function gcc_ra(){ - local re_type="$1" - [-n "${ra_type}"] && re_type="_$_ra_type" - DNF_INSTALL "sentry_msg_monitor" - DNF_INSTALL "libxalarm-devel" - DNF_INSTALL "gcc" + local ra_type="$1" + [ -n "${ra_type}" ] && ra_type="_$ra_type" + yum -y install sentry_msg_monitor libxalarm-devel gcc + gcc "${ra_path}"/RA"${ra_type}".c -Wall -o3 -lxalarm -o "${ra_path}"/RA"${ra_type}" + chmod 777 "${ra_path}/RA${ra_type}" + } @@ -119,13 +129,17 @@ function start_RA(){ local delay_time="${3:-}" case $ra_type in panic | kernel_reboot) - + [ -f "${ra_path}"/RA_reboot ] || gcc_ra reboot stdbuf -oL "/root/mugen/testcases/smoke-test/smoke-sysSentry/RA/RA_reboot" "${ra_pare}" "${delay_time}" > "${TMP_DIR}/RA.log" 2>&1 & ;; oom) - stdbuf -oL "/root/mugen/testcases/smoke-test/smoke-sysSentry/RA/RA_${re_type}" > "${TMP_DIR}/RA.log" 2>&1 & + [ -f "${ra_path}"/RA_oom ] || gcc_ra oom + stdbuf -oL "${ra_path}/RA_${ra_type}" > "${TMP_DIR}/RA.log" 2>&1 & + ;; *) - stdbuf -oL "/root/mugen/testcases/smoke-test/smoke-sysSentry/RA/RA_${re_type}" > "${TMP_DIR}/RA_${re_type}.log" 2>&1 & + [ -f "${ra_path}"/RA_"${ra_type}" ] || gcc_ra ${ra_type} + stdbuf -oL "${ra_path}/RA_${ra_type}" > "${TMP_DIR}/RA_${ra_type}.log" 2>&1 & + ;; esac return $? @@ -155,7 +169,7 @@ function check_RA_oom(){ local sync_value="${1}" local reason_value="${2}" for ((check_ra_oom_loop=0; check_ra_oom_loop<5; check_ra_oom_loop++)); do - grep -aw "\[alarmid:1005\]" ${TMP_DIR}/RA.log | grep "\[msg:.*,sync:${sync_value},timeout:30000,reason:${reason_value}\]" && break + grep -aw "\[alarmid:1005\]" ${TMP_DIR}/RA.log | grep -F "sync:${sync_value},timeout:30000,reason:${reason_value}" && break sleep 2 done [ "${check_ra_oom_loop}" -lt 5 ] || return 1 @@ -238,7 +252,7 @@ function check_log(){ ;; esac - timeout=$([ "reply_type" -eq 2 ] && echo 100 || echo 50) + timeout=$([ "$reply_type" -eq 2 ] && echo 100 || echo 50) sleep "$timeout" cat "$log_file" alarm_count=$(grep -a "$grep_alarm" "$log_file" | wc -l) diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh index 23f2f38e7..cb7e68d14 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh @@ -1,4 +1,4 @@ -source "./comm/lib.sh" +source "comm/lib.sh" set -x function pre_test(){ @@ -24,8 +24,6 @@ function run_test(){ } function post_test(){ clean_sysSentry_message - DNF_REMOVE "sysSentry" 1 - DNF_REMOVE "sysSentry" 2 } main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh index 81cef3f45..7e7524abf 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh @@ -1,4 +1,4 @@ -source "./comm/lib.sh" +source "comm/lib.sh" set -x function pre_test(){ @@ -21,8 +21,6 @@ function run_test(){ } function post_test(){ clean_sysSentry_message - DNF_REMOVE "sysSentry" 1 - DNF_REMOVE "sysSentry" 2 } main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh index 972192715..a39f4063e 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh @@ -1,4 +1,4 @@ -source "./comm/lib.sh" +source "comm/lib.sh" set -x function pre_test(){ @@ -14,7 +14,7 @@ function run_test(){ sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - start_RA kernel_reboot 0 30 + start_RA kernel_reboot 0 20 SSH_CMD "reboot" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" check_log 0 RA 1009 1010 @@ -24,8 +24,6 @@ function run_test(){ } function post_test(){ clean_sysSentry_message - DNF_REMOVE "sysSentry" 1 - DNF_REMOVE "sysSentry" 2 } main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh index 7be36a778..025a86697 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh @@ -1,8 +1,8 @@ -source "./comm/lib.sh" +source "comm/lib.sh" set -x function pre_test(){ - pre_env + pre_env 3 } function run_test(){ sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on @@ -24,9 +24,6 @@ function run_test(){ } function post_test(){ clean_sysSentry_message - DNF_REMOVE "sysSentry" 1 - DNF_REMOVE "sysSentry" 2 - DNF_REMOVE "sysSentry" 3 } main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh index 9869750dc..999b88970 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh @@ -1,4 +1,4 @@ -source "./comm/lib.sh" +source "comm/lib.sh" set -x function pre_test(){ @@ -7,27 +7,24 @@ function pre_test(){ function run_test(){ start_RA oom CHECK_RESULT $? 0 0 - # /root/mugen/testcases/cli-test/sysSentry/RA/oom & #后面改一下 echo 50000 | sudo tee /proc/sys/vm/nr_hugepages - # oom_pid=$! check_oom_dmesg 0 0 CHECK_RESULT $? 0 0 - # kill -9 $oom_pid - check_RA_oom 0 0 + check_RA_oom 1 1 CHECK_RESULT $? 0 0 check_alarmd 1005 71 " " 3 CHECK_RESULT $? 0 0 - check_oom_sentry_msg_monitor 0 0 true + check_oom_sentry_msg_monitor 1 1 true CHECK_RESULT $? 0 0 } function post_test(){ clean_sysSentry_message - + echo 0 | sudo tee /proc/sys/vm/nr_hugepages } main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh index 2e745b0a2..ca1e8edcb 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh @@ -1,4 +1,4 @@ -source "./comm/lib.sh" +source "comm/lib.sh" set -x function pre_test(){ @@ -24,8 +24,6 @@ function run_test(){ } function post_test(){ clean_sysSentry_message - DNF_REMOVE "sysSentry" 1 - DNF_REMOVE "sysSentry" 2 } main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh index 19feeff21..a599f3be6 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh @@ -1,4 +1,4 @@ -source "./comm/lib.sh" +source "comm/lib.sh" set -x function pre_test(){ @@ -22,8 +22,6 @@ function run_test(){ } function post_test(){ clean_sysSentry_message - DNF_REMOVE "sysSentry" 1 - DNF_REMOVE "sysSentry" 2 } main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh index 5a88b8c69..907f737c6 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh @@ -1,4 +1,4 @@ -source "./comm/lib.sh" +source "comm/lib.sh" set -x function pre_test(){ @@ -14,7 +14,7 @@ function run_test(){ sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - start_RA panic 0 30 + start_RA panic 0 20 SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" check_log 0 RA 1007 1008 @@ -24,8 +24,6 @@ function run_test(){ } function post_test(){ clean_sysSentry_message - DNF_REMOVE "sysSentry" 1 - DNF_REMOVE "sysSentry" 2 } main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh index 07611ae23..517db617e 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh @@ -1,8 +1,8 @@ -source "./comm/lib.sh" +source "comm/lib.sh" set -x function pre_test(){ - pre_env + pre_env 3 } function run_test(){ sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on @@ -21,8 +21,6 @@ function run_test(){ } function post_test(){ clean_sysSentry_message - DNF_REMOVE "sysSentry" 1 - DNF_REMOVE "sysSentry" 2 } diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh index 93c9e087d..82cf9eef6 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh @@ -1,7 +1,7 @@ -source "./comm/lib.sh" +#!/bin/bash +source "comm/lib.sh" set -x - -function check_RA_xalarmd_log(){ +function check_RA_xalarmd_log() { SLEEP_WAIT 30 "systemctl is-active xalarmd.service" 2 CHECK_RESULT $? 0 0 sleep 6 #等服务重启 @@ -15,7 +15,7 @@ function check_RA_xalarmd_log(){ check_RA_plugin } -function check_xalarmd_log(){ +function check_xalarmd_log() { grep "${run_alarm} not found or socket file been replaced, recovering" "${task_log_path}"/xalarm.log CHECK_RESULT $? 0 0 grep "${run_report} not found or socket file been replaced, recovering" "${task_log_path}"/xalarm.log @@ -73,7 +73,7 @@ function run_test(){ function post_test(){ clean_sysSentry_message systemctl stop xalarmd - + # return 0 } main "$@" \ No newline at end of file -- Gitee From b0cb800f0b46159d1cdc0e6d3f9c85ecbf3a0022 Mon Sep 17 00:00:00 2001 From: yangna Date: Thu, 11 Dec 2025 14:35:29 +0000 Subject: [PATCH 07/19] 1211 Signed-off-by: yangna --- suite2cases/smoke-sysSentry.json | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 suite2cases/smoke-sysSentry.json diff --git a/suite2cases/smoke-sysSentry.json b/suite2cases/smoke-sysSentry.json new file mode 100644 index 000000000..f97e2dcd2 --- /dev/null +++ b/suite2cases/smoke-sysSentry.json @@ -0,0 +1,36 @@ +{ + "path": "$OET_PATH/testcases/smoke-test/smoke-sysSentry", + "cases": [ + { + "name": "oe_test_sysSentry_xalarmd_recorver" + }, + { + "name": "oe_test_sysSentry_oom" + }, + { + "name": "oe_test_sysSentry_kernel_reboot_001" + }, + { + "name": "oe_test_sysSentry_kernel_reboot_002" + }, + { + "name": "oe_test_sysSentry_kernel_reboot_003" + }, + { + "name": "oe_test_sysSentry_kernel_reboot_004" + }, + { + "name": "oe_test_sysSentry_panic_001" + }, + { + "name": "oe_test_sysSentry_panic_002" + }, + { + "name": "oe_test_sysSentry_panic_003" + }, + { + "name": "oe_test_sysSentry_panic_004" + }, + + ] +} -- Gitee From 53f99ee410cecfb5665619d9bec6558158757521 Mon Sep 17 00:00:00 2001 From: yangna Date: Fri, 12 Dec 2025 01:42:18 +0000 Subject: [PATCH 08/19] 1212 Signed-off-by: yangna --- .../oe_test_sysSentry_kernel_reboot_001.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh index cb7e68d14..58b6e1599 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh @@ -1,3 +1,18 @@ +#!/usr/bin/bash + +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## +# shellcheck disable=SC2002,SC2119 + source "comm/lib.sh" set -x -- Gitee From 69d929fb3faa05f742f622cedef0a16fc2ca621d Mon Sep 17 00:00:00 2001 From: yangna Date: Fri, 12 Dec 2025 01:44:01 +0000 Subject: [PATCH 09/19] 1212 Signed-off-by: yangna --- testcases/smoke-test/smock-sysSentry/comm/lib.sh | 15 +++++++++++++++ .../oe_test_sysSentry_kernel_reboot_002.sh | 15 +++++++++++++++ .../oe_test_sysSentry_kernel_reboot_003.sh | 15 +++++++++++++++ .../oe_test_sysSentry_kernel_reboot_004.sh | 15 +++++++++++++++ .../smock-sysSentry/oe_test_sysSentry_oom.sh | 15 +++++++++++++++ .../oe_test_sysSentry_panic_001.sh | 15 +++++++++++++++ .../oe_test_sysSentry_panic_002.sh | 15 +++++++++++++++ .../oe_test_sysSentry_panic_003.sh | 15 +++++++++++++++ .../oe_test_sysSentry_panic_004.sh | 15 +++++++++++++++ .../oe_test_sysSentry_xalarmd_recorver.sh | 16 +++++++++++++++- 10 files changed, 150 insertions(+), 1 deletion(-) diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh index 44c23dfd9..855a53793 100644 --- a/testcases/smoke-test/smock-sysSentry/comm/lib.sh +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -1,3 +1,18 @@ +#!/usr/bin/bash + +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## +# shellcheck disable=SC2002,SC2119 + source "$OET_PATH/libs/locallibs/common_lib.sh" TMP_DIR=/root/sysSentry_script diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh index 7e7524abf..3e2eaa08f 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh @@ -1,3 +1,18 @@ +#!/usr/bin/bash + +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## +# shellcheck disable=SC2002,SC2119 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh index a39f4063e..89b611aca 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh @@ -1,3 +1,18 @@ +#!/usr/bin/bash + +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## +# shellcheck disable=SC2002,SC2119 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh index 025a86697..3f16e26ce 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh @@ -1,3 +1,18 @@ +#!/usr/bin/bash + +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## +# shellcheck disable=SC2002,SC2119 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh index 999b88970..46d705bc6 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh @@ -1,3 +1,18 @@ +#!/usr/bin/bash + +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## +# shellcheck disable=SC2002,SC2119 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh index ca1e8edcb..da092c353 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh @@ -1,3 +1,18 @@ +#!/usr/bin/bash + +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## +# shellcheck disable=SC2002,SC2119 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh index a599f3be6..1c5e79e5b 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh @@ -1,3 +1,18 @@ +#!/usr/bin/bash + +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## +# shellcheck disable=SC2002,SC2119 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh index 907f737c6..97b344534 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh @@ -1,3 +1,18 @@ +#!/usr/bin/bash + +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## +# shellcheck disable=SC2002,SC2119 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh index 517db617e..9d025985c 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh @@ -1,3 +1,18 @@ +#!/usr/bin/bash + +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## +# shellcheck disable=SC2002,SC2119 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh index 82cf9eef6..41602fb75 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh @@ -1,4 +1,18 @@ -#!/bin/bash +#!/usr/bin/bash + +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## +# shellcheck disable=SC2002,SC2119 + source "comm/lib.sh" set -x function check_RA_xalarmd_log() { -- Gitee From 599a64e59707213c635c1a75e47b94cb9f29cde0 Mon Sep 17 00:00:00 2001 From: yangna Date: Fri, 12 Dec 2025 01:59:27 +0000 Subject: [PATCH 10/19] sysSentry Signed-off-by: yangna --- testcases/smoke-test/smock-sysSentry/comm/lib.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh | 2 +- testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh | 2 +- .../smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh | 2 +- .../smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh | 2 +- .../smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh | 2 +- .../smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh index 855a53793..0f7e322d7 100644 --- a/testcases/smoke-test/smock-sysSentry/comm/lib.sh +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC2002,SC2119 +# shellcheck disable=SC1017 source "$OET_PATH/libs/locallibs/common_lib.sh" diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh index 58b6e1599..e8abe2be5 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC2002,SC2119 +# shellcheck disable=SC1017 source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh index 3e2eaa08f..01b301982 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC2002,SC2119 +# shellcheck disable=SC1017 source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh index 89b611aca..e93a31053 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC2002,SC2119 +# shellcheck disable=SC1017 source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh index 3f16e26ce..89ad1d968 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC2002,SC2119 +# shellcheck disable=SC1017 source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh index 46d705bc6..df64da8e4 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC2002,SC2119 +# shellcheck disable=SC1017 source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh index da092c353..cf2274527 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC2002,SC2119 +# shellcheck disable=SC1017 source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh index 1c5e79e5b..cb6827b2c 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC2002,SC2119 +# shellcheck disable=SC1017 source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh index 97b344534..b0b602640 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC2002,SC2119 +# shellcheck disable=SC1017 source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh index 9d025985c..4952df9a6 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC2002,SC2119 +# shellcheck disable=SC1017 source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh index 41602fb75..4c2348d14 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC2002,SC2119 +# shellcheck disable=SC1017 source "comm/lib.sh" set -x -- Gitee From e176418224e75b08748cae73b480f6ae5c0d3e17 Mon Sep 17 00:00:00 2001 From: yangna Date: Fri, 12 Dec 2025 02:26:08 +0000 Subject: [PATCH 11/19] 1212 Signed-off-by: yangna --- testcases/smoke-test/smock-sysSentry/comm/lib.sh | 4 ++-- .../smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh | 4 ++-- .../smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh | 4 ++-- .../smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh | 4 ++-- .../smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh | 4 ++-- testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh | 4 ++-- .../smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh | 4 ++-- .../smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh | 4 ++-- .../smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh | 4 ++-- .../smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh | 4 ++-- .../smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh index 0f7e322d7..5abf72147 100644 --- a/testcases/smoke-test/smock-sysSentry/comm/lib.sh +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash - +# shellcheck disable=SC1017,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC1017 + source "$OET_PATH/libs/locallibs/common_lib.sh" diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh index e8abe2be5..aa7d3078f 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash - +# shellcheck disable=SC1017,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC1017 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh index 01b301982..e4999ea48 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash - +# shellcheck disable=SC1017,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC1017 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh index e93a31053..678793f7d 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash - +# shellcheck disable=SC1017,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC1017 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh index 89ad1d968..0c7be8200 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash - +# shellcheck disable=SC1017,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC1017 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh index df64da8e4..58b996344 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash - +# shellcheck disable=SC1017,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC1017 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh index cf2274527..f4d66a0b8 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash - +# shellcheck disable=SC1017,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC1017 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh index cb6827b2c..2839a559e 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash - +# shellcheck disable=SC1017,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC1017 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh index b0b602640..302100994 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash - +# shellcheck disable=SC1017,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC1017 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh index 4952df9a6..dab0e624b 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash - +# shellcheck disable=SC1017,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC1017 + source "comm/lib.sh" set -x diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh index 4c2348d14..47b523c46 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash - +# shellcheck disable=SC1017,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -11,7 +11,7 @@ # @Author : yangna # @Date : 2025/12/12 # ################################## -# shellcheck disable=SC1017 + source "comm/lib.sh" set -x -- Gitee From 0b21ce8188f1bf345105b9903e7e53e8461cc374 Mon Sep 17 00:00:00 2001 From: yangna Date: Fri, 12 Dec 2025 12:09:35 +0800 Subject: [PATCH 12/19] change error --- .../smoke-test/smock-sysSentry/comm/lib.sh | 566 +++++++++--------- .../oe_test_sysSentry_kernel_reboot_001.sh | 86 +-- .../oe_test_sysSentry_kernel_reboot_002.sh | 80 +-- .../oe_test_sysSentry_kernel_reboot_003.sh | 86 +-- .../oe_test_sysSentry_kernel_reboot_004.sh | 86 +-- .../smock-sysSentry/oe_test_sysSentry_oom.sh | 88 +-- .../oe_test_sysSentry_panic_001.sh | 86 +-- .../oe_test_sysSentry_panic_002.sh | 82 +-- .../oe_test_sysSentry_panic_003.sh | 86 +-- .../oe_test_sysSentry_panic_004.sh | 82 +-- .../oe_test_sysSentry_xalarmd_recorver.sh | 184 +++--- 11 files changed, 756 insertions(+), 756 deletions(-) diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh index 5abf72147..d7b730e55 100644 --- a/testcases/smoke-test/smock-sysSentry/comm/lib.sh +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -1,283 +1,283 @@ -#!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ################################## -# @Author : yangna -# @Date : 2025/12/12 -# ################################## - - -source "$OET_PATH/libs/locallibs/common_lib.sh" - -TMP_DIR=/root/sysSentry_script -task_log_path=/var/log/sysSentry -run_alarm="/var/run/xalarm/alarm" -run_report="/var/run/xalarm/report" -xalarm_run_dir="/var/run/xalarm" -ra_path="$OET_PATH/testcases/smoke-test/smoke-sysSentry/RA" -mkdir -p "${TMP_DIR}" - -function pre_env(){ - local node_num="$1" - - DNF_INSTALL "sysSentry" 1 - DNF_INSTALL "sysSentry" 2 - [ -n "${node_num}" ] && DNF_INSTALL "sysSentry" 3 - start_sentry - - SSH_CMD " - yum -y install sentry_msg_monitor - systemctl start xalarmd - systemctl start sysSentry - modprobe sentry_msg_helper - modprobe sentry_reporter - sleep 5 - modprobe sentry_urma_comm - modprobe odf - modprobe cis - sleep 5 - modprobe sentry_remote_reporter - sentryctl start sentry_msg_monitor - sleep 5 - lsmod | grep sentry - " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - [ -n "${node_num}" ] && SSH_CMD " - yum -y install sentry_msg_monitor - systemctl start xalarmd - systemctl start sysSentry - modprobe sentry_msg_helper - modprobe sentry_reporter - sleep 5 - modprobe sentry_urma_comm - modprobe odf - modprobe cis - sleep 5 - modprobe sentry_remote_reporter - sentryctl start sentry_msg_monitor - sleep 5 - lsmod | grep sentry - " "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" - - get_eid - -} -function pre_oom_env(){ - yum -y install sentry_msg_monitor - modprobe sentry_msg_helper - modprobe sentry_reporter - systemctl start xalarmd - systemctl start sysSentry - sleep 5 - sentryctl list | grep sentry_msg_monitor - -} - -function pre_xalarm_env(){ - DNF_INSTALL "sysSentry" 1 - yum -y remove libxalarm pyxalarm sentry_msg_monitor sysSentry - yum -y install sentry_msg_monitor - systemctl start xalarmd - systemctl start sysSentry - sleep 5 - sentryctl list | grep sentry_msg_monitor -} - -function start_sentry(){ - yum -y install sentry_msg_monitor - systemctl start xalarmd - systemctl start sysSentry - modprobe sentry_msg_helper - modprobe sentry_reporter - sleep 5 - modprobe sentry_urma_comm - modprobe odf - modprobe cis - sleep 5 - modprobe sentry_remote_reporter - sentryctl start sentry_msg_monitor - sleep 5 - lsmod |grep sentry -} - -function get_eid(){ - node1_eid1=$(urma_admin show | awk '/udma2/ && /eid0/ {print $5}') - node1_eid2=$(urma_admin show | awk '/udma5/ && /eid0/ {print $5}') - - node2_eid1=$(SSH_CMD "urma_admin show | awk '/udma2/ && /eid0/ {print \$5}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') - node2_eid2=$(SSH_CMD "urma_admin show | awk '/udma5/ && /eid0/ {print \$5}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') - - node3_eid1=$(SSH_CMD "urma_admin show | awk '/udma2/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') - node3_eid2=$(SSH_CMD "urma_admin show | awk '/udma5/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') - - # node1_cna=1 - # node2_cna=2 - node1_cna=$(( $(cat /sys/devices/ub_bus_controller0/00001/primary_cna | tr -d '[:space:]') )) - raw_output=$(SSH_CMD "cat /sys/devices/ub_bus_controller0/00001/primary_cna 2>/dev/null" \ - "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}") - - hex_value=$(echo "$raw_output" | tr -d '[:space:]' | grep -oE '0x[0-9A-Fa-f]+') - node2_cna=$(( $hex_value )) - node3_cna=3 - test_jetty_id=$((RANDOM % 1021 + 3)) - -} -function gcc_ra(){ - local ra_type="$1" - [ -n "${ra_type}" ] && ra_type="_$ra_type" - yum -y install sentry_msg_monitor libxalarm-devel gcc - gcc "${ra_path}"/RA"${ra_type}".c -Wall -o3 -lxalarm -o "${ra_path}"/RA"${ra_type}" - chmod 777 "${ra_path}/RA${ra_type}" - - - -} -function start_RA(){ - local ra_type="${1}" - local ra_pare="${2:-}" - local delay_time="${3:-}" - case $ra_type in - panic | kernel_reboot) - [ -f "${ra_path}"/RA_reboot ] || gcc_ra reboot - stdbuf -oL "/root/mugen/testcases/smoke-test/smoke-sysSentry/RA/RA_reboot" "${ra_pare}" "${delay_time}" > "${TMP_DIR}/RA.log" 2>&1 & - ;; - oom) - [ -f "${ra_path}"/RA_oom ] || gcc_ra oom - stdbuf -oL "${ra_path}/RA_${ra_type}" > "${TMP_DIR}/RA.log" 2>&1 & - ;; - *) - [ -f "${ra_path}"/RA_"${ra_type}" ] || gcc_ra ${ra_type} - stdbuf -oL "${ra_path}/RA_${ra_type}" > "${TMP_DIR}/RA_${ra_type}.log" 2>&1 & - ;; - - esac - return $? -} - -function check_RA_xalarmd(){ - local ra_log="${1-RA_xalarmd.log}" - SLEEP_WAIT 30 "grep -aw 'alarmid:1003' ${TMP_DIR}/${ra_log} | grep -w 'msg:hello'" 2 - CHECK_RESULT $? 0 0 -} -function check_RA_plugin(){ - local ra_log="${1-RA_plugin.log}" - SLEEP_WAIT 30 "grep -aw 'alarmid:1004' ${TMP_DIR}/${ra_log} | grep -w 'msg:ACK OK'" 2 - CHECK_RESULT $? 0 0 -} -function clean_sysSentry_message(){ - echo > /var/log/sysSentry/xalarm.log - echo > /var/log/sysSentry/sentry_msg_monitor.log -} - -function check_oom_dmesg(){ - local sync_value="${1}" - local reason_value="${2}" - SLEEP_WAIT 30 "dmesg | grep -aw \"got lowmem message\" | grep -a \"sync=${sync_value} reason=${reason_value}\"" 2 -} -function check_RA_oom(){ - local sync_value="${1}" - local reason_value="${2}" - for ((check_ra_oom_loop=0; check_ra_oom_loop<5; check_ra_oom_loop++)); do - grep -aw "\[alarmid:1005\]" ${TMP_DIR}/RA.log | grep -F "sync:${sync_value},timeout:30000,reason:${reason_value}" && break - sleep 2 - done - [ "${check_ra_oom_loop}" -lt 5 ] || return 1 - tmp_nid_info=$(grep -aw "\[alarmid:1005\]" ${TMP_DIR}/RA.log | tail -1 | grep "\[msg:.*\]" | awk -F'{' '{print $2}' | awk -F'}' '{print $1}' | awk -F']' '{print $1}') - echo "$tmp_nid_info" - check_oom_nid_info "${tmp_nid_info}" - CHECK_RESULT $? 0 0 -} -function check_alarmd(){ - local tmp_alarm_id="${1}" - local tmp_alarm_msg_len="${2}" - local is_reply="${3}" - local tmp_reply_msg_len="${4}" - tmp_reply_id=$(expr "$tmp_alarm_id" + 1) - if [ "${tmp_alarm_msg_len}"="no"]; then - tmp_alarm_msg_len=".*" - else - tmp_alarm_msg_len="$(grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_alarm_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" - tmp_alarm_msg_len="$(expr "$tmp_alarm_msg_len" - 1)" - fi - - if [ "${tmp_reply_msg_len}"="no"]; then - tmp_reply_msg_len=".*" - else - tmp_reply_msg_len="$(grep -aw 'Get msg:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_reply_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" - tmp_reply_msg_len="$(expr "$tmp_reply_msg_len" - 1)" - fi - grep -aw "Broadcast msg success" ${task_log_path}/xalarm.log | grep "alarm msg is alarm_id: ${tmp_alarm_id}, alarm_level: MINOR_ALM, alarm_type: ALARM_TYPE_OCCUR" - CHECK_RESULT $? 0 0 - - grep "alarm_id: ${tmd_alarm_id}" ${task_log_path}/xalarm.log | grep "alarm_msg_len: ${tmp_alarm_msg_len}" - CHECK_RESULT $? 0 0 - -} -function check_oom_sentry_msg_monitor(){ - local sync_value="${1}" - local reason_value="${2}" - local is_reply="${3-true}" - grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "alarm_type: 1005, str: .*,sync:${sync_value},timeout:30000,reason:${reason_value}" - CHECK_RESULT $? 0 0 - tmp_nid_info=$(grep -aw "alarm_type: 1005" ${task_log_path}/sentry_msg_monitor.log | tail -1 | awk -F'str:' '{print $2}' | awk -F'{' '{print $2}' | awk -F'}' '{print $1}' | awk -F']' '{print $1}') - check_oom_nid_info "${tmp_nid_info}" - CHECK_RESULT $? 0 0 -} - -function check_oom_nid_info(){ - local tmp_nid_info="${1}" - # nr_nid=$(echo "$tmp_nid_info" | grep -oP '(?<=nr_nid:)\d+') - # tmp_nid_str=$(echo "$tmp_nid_info" | grep -oP '(?<=nid:\[)[^\]]+(?=)') - nid_str=($(echo "${tmp_nid_str[@]}" | tr ',' ' ')) - echo ${nid_str[@]:0:$(expr "$nr_nid")} | grep -v '\-1' - CHECK_RESULT $? 0 0 - echo ${nid_str[@]:"$nr_nid":$(expr ${#nid_str[@]} - 1)} | xargs -n 1 | grep '\-1' | wc -l | grep "$(expr ${#nid_str[@]} - "$nr_nid")" - CHECK_RESULT $? 0 0 -} -function check_log(){ - local reply_type="${1}" - local log_type="${2}" - local alarm_value="${3}" - local ack_value="${4}" - local alarm_count - local log_file - local grep_alarm - local grep_ack - - case "$log_type" in - "RA") - log_file="${TMP_DIR}/RA.log" - grep_alarm="\[alarmid:${alarm_value}\]" - ;; - "alarmd") - log_file="${task_log_path}/xalarm.log" - grep_alarm="alarm_id: ${alarm_value}," - grep_ack="alarm_id: ${ack_value}" - ;; - "monitor") - log_file="${task_log_path}/sentry_msg_monitor.log" - grep_alarm="alarm_type: ${alarm_value}" - grep_ack="alarm_type: ${ack_value}" - ;; - esac - - timeout=$([ "$reply_type" -eq 2 ] && echo 100 || echo 50) - sleep "$timeout" - cat "$log_file" - alarm_count=$(grep -a "$grep_alarm" "$log_file" | wc -l) - send_ack=$(grep -a "$grep_ack" "$log_file" | wc -l) - - test $alarm_count -ge 1 - CHECK_RESULT $? 0 0 - - if [ "$log_type" != "RA" -a "$reply_type" = "0" ]; then - test $send_ack -ge 1 - CHECK_RESULT $? 0 0 - fi -} +#!/usr/bin/bash +# shellcheck disable=SC1017,SC2154 +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## + + +source "$OET_PATH/libs/locallibs/common_lib.sh" + +TMP_DIR=/root/sysSentry_script +task_log_path=/var/log/sysSentry +run_alarm="/var/run/xalarm/alarm" +run_report="/var/run/xalarm/report" +xalarm_run_dir="/var/run/xalarm" +ra_path="$OET_PATH/testcases/smoke-test/smoke-sysSentry/RA" +mkdir -p "${TMP_DIR}" + +function pre_env(){ + local node_num="$1" + + DNF_INSTALL "sysSentry" 1 + DNF_INSTALL "sysSentry" 2 + [ -n "${node_num}" ] && DNF_INSTALL "sysSentry" 3 + start_sentry + + SSH_CMD " + yum -y install sentry_msg_monitor + systemctl start xalarmd + systemctl start sysSentry + modprobe sentry_msg_helper + modprobe sentry_reporter + sleep 5 + modprobe sentry_urma_comm + modprobe odf + modprobe cis + sleep 5 + modprobe sentry_remote_reporter + sentryctl start sentry_msg_monitor + sleep 5 + lsmod | grep sentry + " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + [ -n "${node_num}" ] && SSH_CMD " + yum -y install sentry_msg_monitor + systemctl start xalarmd + systemctl start sysSentry + modprobe sentry_msg_helper + modprobe sentry_reporter + sleep 5 + modprobe sentry_urma_comm + modprobe odf + modprobe cis + sleep 5 + modprobe sentry_remote_reporter + sentryctl start sentry_msg_monitor + sleep 5 + lsmod | grep sentry + " "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" + + get_eid + +} +function pre_oom_env(){ + yum -y install sentry_msg_monitor + modprobe sentry_msg_helper + modprobe sentry_reporter + systemctl start xalarmd + systemctl start sysSentry + sleep 5 + sentryctl list | grep sentry_msg_monitor + +} + +function pre_xalarm_env(){ + DNF_INSTALL "sysSentry" 1 + yum -y remove libxalarm pyxalarm sentry_msg_monitor sysSentry + yum -y install sentry_msg_monitor + systemctl start xalarmd + systemctl start sysSentry + sleep 5 + sentryctl list | grep sentry_msg_monitor +} + +function start_sentry(){ + yum -y install sentry_msg_monitor + systemctl start xalarmd + systemctl start sysSentry + modprobe sentry_msg_helper + modprobe sentry_reporter + sleep 5 + modprobe sentry_urma_comm + modprobe odf + modprobe cis + sleep 5 + modprobe sentry_remote_reporter + sentryctl start sentry_msg_monitor + sleep 5 + lsmod |grep sentry +} + +function get_eid(){ + node1_eid1=$(urma_admin show | awk '/udma2/ && /eid0/ {print $5}') + node1_eid2=$(urma_admin show | awk '/udma5/ && /eid0/ {print $5}') + + node2_eid1=$(SSH_CMD "urma_admin show | awk '/udma2/ && /eid0/ {print \$5}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') + node2_eid2=$(SSH_CMD "urma_admin show | awk '/udma5/ && /eid0/ {print \$5}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') + + node3_eid1=$(SSH_CMD "urma_admin show | awk '/udma2/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') + node3_eid2=$(SSH_CMD "urma_admin show | awk '/udma5/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') + + # node1_cna=1 + # node2_cna=2 + node1_cna=$(( $(cat /sys/devices/ub_bus_controller0/00001/primary_cna | tr -d '[:space:]') )) + raw_output=$(SSH_CMD "cat /sys/devices/ub_bus_controller0/00001/primary_cna 2>/dev/null" \ + "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}") + + hex_value=$(echo "$raw_output" | tr -d '[:space:]' | grep -oE '0x[0-9A-Fa-f]+') + node2_cna=$(( $hex_value )) + node3_cna=3 + test_jetty_id=$((RANDOM % 1021 + 3)) + +} +function gcc_ra(){ + local ra_type="$1" + [ -n "${ra_type}" ] && ra_type="_$ra_type" + yum -y install sentry_msg_monitor libxalarm-devel gcc + gcc "${ra_path}"/RA"${ra_type}".c -Wall -o3 -lxalarm -o "${ra_path}"/RA"${ra_type}" + chmod 777 "${ra_path}/RA${ra_type}" + + + +} +function start_RA(){ + local ra_type="${1}" + local ra_pare="${2:-}" + local delay_time="${3:-}" + case $ra_type in + panic | kernel_reboot) + [ -f "${ra_path}"/RA_reboot ] || gcc_ra reboot + stdbuf -oL "/root/mugen/testcases/smoke-test/smoke-sysSentry/RA/RA_reboot" "${ra_pare}" "${delay_time}" > "${TMP_DIR}/RA.log" 2>&1 & + ;; + oom) + [ -f "${ra_path}"/RA_oom ] || gcc_ra oom + stdbuf -oL "${ra_path}/RA_${ra_type}" > "${TMP_DIR}/RA.log" 2>&1 & + ;; + *) + [ -f "${ra_path}"/RA_"${ra_type}" ] || gcc_ra ${ra_type} + stdbuf -oL "${ra_path}/RA_${ra_type}" > "${TMP_DIR}/RA_${ra_type}.log" 2>&1 & + ;; + + esac + return $? +} + +function check_RA_xalarmd(){ + local ra_log="${1-RA_xalarmd.log}" + SLEEP_WAIT 30 "grep -aw 'alarmid:1003' ${TMP_DIR}/${ra_log} | grep -w 'msg:hello'" 2 + CHECK_RESULT $? 0 0 +} +function check_RA_plugin(){ + local ra_log="${1-RA_plugin.log}" + SLEEP_WAIT 30 "grep -aw 'alarmid:1004' ${TMP_DIR}/${ra_log} | grep -w 'msg:ACK OK'" 2 + CHECK_RESULT $? 0 0 +} +function clean_sysSentry_message(){ + echo > /var/log/sysSentry/xalarm.log + echo > /var/log/sysSentry/sentry_msg_monitor.log +} + +function check_oom_dmesg(){ + local sync_value="${1}" + local reason_value="${2}" + SLEEP_WAIT 30 "dmesg | grep -aw \"got lowmem message\" | grep -a \"sync=${sync_value} reason=${reason_value}\"" 2 +} +function check_RA_oom(){ + local sync_value="${1}" + local reason_value="${2}" + for ((check_ra_oom_loop=0; check_ra_oom_loop<5; check_ra_oom_loop++)); do + grep -aw "\[alarmid:1005\]" ${TMP_DIR}/RA.log | grep -F "sync:${sync_value},timeout:30000,reason:${reason_value}" && break + sleep 2 + done + [ "${check_ra_oom_loop}" -lt 5 ] || return 1 + tmp_nid_info=$(grep -aw "\[alarmid:1005\]" ${TMP_DIR}/RA.log | tail -1 | grep "\[msg:.*\]" | awk -F'{' '{print $2}' | awk -F'}' '{print $1}' | awk -F']' '{print $1}') + echo "$tmp_nid_info" + check_oom_nid_info "${tmp_nid_info}" + CHECK_RESULT $? 0 0 +} +function check_alarmd(){ + local tmp_alarm_id="${1}" + local tmp_alarm_msg_len="${2}" + local is_reply="${3}" + local tmp_reply_msg_len="${4}" + tmp_reply_id=$(expr "$tmp_alarm_id" + 1) + if [ "${tmp_alarm_msg_len}"="no"]; then + tmp_alarm_msg_len=".*" + else + tmp_alarm_msg_len="$(grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_alarm_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" + tmp_alarm_msg_len="$(expr "$tmp_alarm_msg_len" - 1)" + fi + + if [ "${tmp_reply_msg_len}"="no"]; then + tmp_reply_msg_len=".*" + else + tmp_reply_msg_len="$(grep -aw 'Get msg:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_reply_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" + tmp_reply_msg_len="$(expr "$tmp_reply_msg_len" - 1)" + fi + grep -aw "Broadcast msg success" ${task_log_path}/xalarm.log | grep "alarm msg is alarm_id: ${tmp_alarm_id}, alarm_level: MINOR_ALM, alarm_type: ALARM_TYPE_OCCUR" + CHECK_RESULT $? 0 0 + + grep "alarm_id: ${tmd_alarm_id}" ${task_log_path}/xalarm.log | grep "alarm_msg_len: ${tmp_alarm_msg_len}" + CHECK_RESULT $? 0 0 + +} +function check_oom_sentry_msg_monitor(){ + local sync_value="${1}" + local reason_value="${2}" + local is_reply="${3-true}" + grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "alarm_type: 1005, str: .*,sync:${sync_value},timeout:30000,reason:${reason_value}" + CHECK_RESULT $? 0 0 + tmp_nid_info=$(grep -aw "alarm_type: 1005" ${task_log_path}/sentry_msg_monitor.log | tail -1 | awk -F'str:' '{print $2}' | awk -F'{' '{print $2}' | awk -F'}' '{print $1}' | awk -F']' '{print $1}') + check_oom_nid_info "${tmp_nid_info}" + CHECK_RESULT $? 0 0 +} + +function check_oom_nid_info(){ + local tmp_nid_info="${1}" + # nr_nid=$(echo "$tmp_nid_info" | grep -oP '(?<=nr_nid:)\d+') + # tmp_nid_str=$(echo "$tmp_nid_info" | grep -oP '(?<=nid:\[)[^\]]+(?=)') + nid_str=($(echo "${tmp_nid_str[@]}" | tr ',' ' ')) + echo ${nid_str[@]:0:$(expr "$nr_nid")} | grep -v '\-1' + CHECK_RESULT $? 0 0 + echo ${nid_str[@]:"$nr_nid":$(expr ${#nid_str[@]} - 1)} | xargs -n 1 | grep '\-1' | wc -l | grep "$(expr ${#nid_str[@]} - "$nr_nid")" + CHECK_RESULT $? 0 0 +} +function check_log(){ + local reply_type="${1}" + local log_type="${2}" + local alarm_value="${3}" + local ack_value="${4}" + local alarm_count + local log_file + local grep_alarm + local grep_ack + + case "$log_type" in + "RA") + log_file="${TMP_DIR}/RA.log" + grep_alarm="\[alarmid:${alarm_value}\]" + ;; + "alarmd") + log_file="${task_log_path}/xalarm.log" + grep_alarm="alarm_id: ${alarm_value}," + grep_ack="alarm_id: ${ack_value}" + ;; + "monitor") + log_file="${task_log_path}/sentry_msg_monitor.log" + grep_alarm="alarm_type: ${alarm_value}" + grep_ack="alarm_type: ${ack_value}" + ;; + esac + + timeout=$([ "$reply_type" -eq 2 ] && echo 100 || echo 50) + sleep "$timeout" + cat "$log_file" + alarm_count=$(grep -a "$grep_alarm" "$log_file" | wc -l) + send_ack=$(grep -a "$grep_ack" "$log_file" | wc -l) + + test $alarm_count -ge 1 + CHECK_RESULT $? 0 0 + + if [ "$log_type" != "RA" -a "$reply_type" = "0" ]; then + test $send_ack -ge 1 + CHECK_RESULT $? 0 0 + fi +} diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh index aa7d3078f..de76ec050 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh @@ -1,44 +1,44 @@ -#!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ################################## -# @Author : yangna -# @Date : 2025/12/12 -# ################################## - - -source "comm/lib.sh" -set -x - -function pre_test(){ - pre_env -} -function run_test(){ - sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1}" --panic=on --kernel_reboot=on - SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid=${node2_eid1} --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1}" --client_jetty_id="${test_jetty_id}" - SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" - SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - start_RA kernel_reboot 0 0 - SSH_CMD "reboot" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - check_log 0 RA 1009 1010 - check_log 0 alarmd 1009 1010 - check_log 0 monitor 1009 1010 - -} -function post_test(){ - clean_sysSentry_message -} - +#!/usr/bin/bash +# shellcheck disable=SC1017,SC2154 +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## + + +source "comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid=${node2_eid1} --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" + SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + start_RA kernel_reboot 0 0 + SSH_CMD "reboot" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + check_log 0 RA 1009 1010 + check_log 0 alarmd 1009 1010 + check_log 0 monitor 1009 1010 + +} +function post_test(){ + clean_sysSentry_message +} + main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh index e4999ea48..f63e3b62c 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh @@ -1,41 +1,41 @@ -#!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ################################## -# @Author : yangna -# @Date : 2025/12/12 -# ################################## - - -source "comm/lib.sh" -set -x - -function pre_test(){ - pre_env -} -function run_test(){ - sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on - SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1};${node1_eid2},${node2_eid2}" --client_jetty_id="${test_jetty_id}" - SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1};${node2_eid2},${node1_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - start_RA kernel_reboot 2 0 - SSH_CMD "reboot" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - check_log 2 RA 1009 1010 - check_log 2 alarmd 1009 1010 - check_log 2 monitor 1009 1010 - -} -function post_test(){ - clean_sysSentry_message -} - +#!/usr/bin/bash +# shellcheck disable=SC1017,SC2154 +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## + + +source "comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1};${node1_eid2},${node2_eid2}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1};${node2_eid2},${node1_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + start_RA kernel_reboot 2 0 + SSH_CMD "reboot" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + check_log 2 RA 1009 1010 + check_log 2 alarmd 1009 1010 + check_log 2 monitor 1009 1010 + +} +function post_test(){ + clean_sysSentry_message +} + main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh index 678793f7d..94283ac3f 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh @@ -1,44 +1,44 @@ -#!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ################################## -# @Author : yangna -# @Date : 2025/12/12 -# ################################## - - -source "comm/lib.sh" -set -x - -function pre_test(){ - pre_env -} -function run_test(){ - sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on - SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1};${node1_eid2},${node2_eid2}" --client_jetty_id="${test_jetty_id}" - SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1};${node2_eid2},${node1_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" - SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - start_RA kernel_reboot 0 20 - SSH_CMD "reboot" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - check_log 0 RA 1009 1010 - check_log 0 alarmd 1009 1010 - check_log 0 monitor 1009 1010 - -} -function post_test(){ - clean_sysSentry_message -} - +#!/usr/bin/bash +# shellcheck disable=SC1017,SC2154 +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## + + +source "comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1};${node1_eid2},${node2_eid2}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1};${node2_eid2},${node1_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" + SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + start_RA kernel_reboot 0 20 + SSH_CMD "reboot" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + check_log 0 RA 1009 1010 + check_log 0 alarmd 1009 1010 + check_log 0 monitor 1009 1010 + +} +function post_test(){ + clean_sysSentry_message +} + main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh index 0c7be8200..1ec894f96 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh @@ -1,44 +1,44 @@ -#!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ################################## -# @Author : yangna -# @Date : 2025/12/12 -# ################################## - - -source "comm/lib.sh" -set -x - -function pre_test(){ - pre_env 3 -} -function run_test(){ - sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on - SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node3_cna} --eid='${node3_eid1};${node3_eid2}' --panic=on --kernel_reboot=on " "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" - - sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1},${node3_eid1};${node1_eid2},${node2_eid2},${node3_eid2}" --client_jetty_id="${test_jetty_id}" - SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1},${node3_eid1};${node2_eid2},${node1_eid2},${node3_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node3_eid1},${node1_eid1},${node2_eid1};${node3_eid2},${node1_eid2},${node2_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" - - start_RA kernel_reboot 0 0 - SSH_CMD "reboot" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - SSH_CMD "reboot" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" - - check_log 0 RA 1009 1010 - check_log 0 alarmd 1009 1010 - check_log 0 monitor 1009 1010 - -} -function post_test(){ - clean_sysSentry_message -} - +#!/usr/bin/bash +# shellcheck disable=SC1017,SC2154 +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## + + +source "comm/lib.sh" +set -x + +function pre_test(){ + pre_env 3 +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node3_cna} --eid='${node3_eid1};${node3_eid2}' --panic=on --kernel_reboot=on " "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1},${node3_eid1};${node1_eid2},${node2_eid2},${node3_eid2}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1},${node3_eid1};${node2_eid2},${node1_eid2},${node3_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node3_eid1},${node1_eid1},${node2_eid1};${node3_eid2},${node1_eid2},${node2_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" + + start_RA kernel_reboot 0 0 + SSH_CMD "reboot" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + SSH_CMD "reboot" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" + + check_log 0 RA 1009 1010 + check_log 0 alarmd 1009 1010 + check_log 0 monitor 1009 1010 + +} +function post_test(){ + clean_sysSentry_message +} + main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh index 58b996344..1535f872d 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh @@ -1,45 +1,45 @@ -#!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ################################## -# @Author : yangna -# @Date : 2025/12/12 -# ################################## - - -source "comm/lib.sh" -set -x - -function pre_test(){ - pre_oom_env -} -function run_test(){ - start_RA oom - CHECK_RESULT $? 0 0 - echo 50000 | sudo tee /proc/sys/vm/nr_hugepages - - check_oom_dmesg 0 0 - CHECK_RESULT $? 0 0 - - check_RA_oom 1 1 - CHECK_RESULT $? 0 0 - - check_alarmd 1005 71 " " 3 - CHECK_RESULT $? 0 0 - - check_oom_sentry_msg_monitor 1 1 true - CHECK_RESULT $? 0 0 - -} -function post_test(){ - clean_sysSentry_message - echo 0 | sudo tee /proc/sys/vm/nr_hugepages -} - +#!/usr/bin/bash +# shellcheck disable=SC1017,SC2154 +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## + + +source "comm/lib.sh" +set -x + +function pre_test(){ + pre_oom_env +} +function run_test(){ + start_RA oom + CHECK_RESULT $? 0 0 + echo 50000 | sudo tee /proc/sys/vm/nr_hugepages + + check_oom_dmesg 0 0 + CHECK_RESULT $? 0 0 + + check_RA_oom 1 1 + CHECK_RESULT $? 0 0 + + check_alarmd 1005 71 " " 3 + CHECK_RESULT $? 0 0 + + check_oom_sentry_msg_monitor 1 1 true + CHECK_RESULT $? 0 0 + +} +function post_test(){ + clean_sysSentry_message + echo 0 | sudo tee /proc/sys/vm/nr_hugepages +} + main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh index f4d66a0b8..320a2d3e4 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh @@ -1,44 +1,44 @@ -#!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ################################## -# @Author : yangna -# @Date : 2025/12/12 -# ################################## - - -source "comm/lib.sh" -set -x - -function pre_test(){ - pre_env -} -function run_test(){ - sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1}" --panic=on --kernel_reboot=on - SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid=${node2_eid1} --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1}" --client_jetty_id="${test_jetty_id}" - SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" - SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - start_RA panic 0 0 - SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - check_log 0 RA 1007 1008 - check_log 0 alarmd 1007 1008 - check_log 0 monitor 1007 1008 - -} -function post_test(){ - clean_sysSentry_message -} - +#!/usr/bin/bash +# shellcheck disable=SC1017,SC2154 +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## + + +source "comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid=${node2_eid1} --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" + SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + start_RA panic 0 0 + SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + check_log 0 RA 1007 1008 + check_log 0 alarmd 1007 1008 + check_log 0 monitor 1007 1008 + +} +function post_test(){ + clean_sysSentry_message +} + main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh index 2839a559e..d41c20174 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh @@ -1,42 +1,42 @@ -#!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ################################## -# @Author : yangna -# @Date : 2025/12/12 -# ################################## - - -source "comm/lib.sh" -set -x - -function pre_test(){ - pre_env -} -function run_test(){ - sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on - SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1};${node1_eid2},${node2_eid2}" --client_jetty_id="${test_jetty_id}" - SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1};${node2_eid2},${node1_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - start_RA panic 2 0 - SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - check_log 2 RA 1007 1008 - check_log 2 alarmd 1007 1008 - check_log 2 monitor 1007 1008 - - -} -function post_test(){ - clean_sysSentry_message -} - +#!/usr/bin/bash +# shellcheck disable=SC1017,SC2154 +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## + + +source "comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1};${node1_eid2},${node2_eid2}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1};${node2_eid2},${node1_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + start_RA panic 2 0 + SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + check_log 2 RA 1007 1008 + check_log 2 alarmd 1007 1008 + check_log 2 monitor 1007 1008 + + +} +function post_test(){ + clean_sysSentry_message +} + main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh index 302100994..784dae6dc 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh @@ -1,44 +1,44 @@ -#!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ################################## -# @Author : yangna -# @Date : 2025/12/12 -# ################################## - - -source "comm/lib.sh" -set -x - -function pre_test(){ - pre_env -} -function run_test(){ - sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on - SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1};${node1_eid2},${node2_eid2}" --client_jetty_id="${test_jetty_id}" - SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1};${node2_eid2},${node1_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" - SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - start_RA panic 0 20 - SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - check_log 0 RA 1007 1008 - check_log 0 alarmd 1007 1008 - check_log 0 monitor 1007 1008 - -} -function post_test(){ - clean_sysSentry_message -} - +#!/usr/bin/bash +# shellcheck disable=SC1017,SC2154 +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## + + +source "comm/lib.sh" +set -x + +function pre_test(){ + pre_env +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1};${node1_eid2},${node2_eid2}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1};${node2_eid2},${node1_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_uvb_comm --server_cna="${node2_cna}" + SSH_CMD "sentryctl set sentry_uvb_comm --server_cna='${node1_cna}'" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + start_RA panic 0 20 + SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + check_log 0 RA 1007 1008 + check_log 0 alarmd 1007 1008 + check_log 0 monitor 1007 1008 + +} +function post_test(){ + clean_sysSentry_message +} + main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh index dab0e624b..1f2c2c388 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh @@ -1,42 +1,42 @@ -#!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ################################## -# @Author : yangna -# @Date : 2025/12/12 -# ################################## - - -source "comm/lib.sh" -set -x - -function pre_test(){ - pre_env 3 -} -function run_test(){ - sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on - SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1},${node3_eid1};${node1_eid2},${node2_eid2},${node3_eid2}" --client_jetty_id="${test_jetty_id}" - SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1},${node3_eid1};${node2_eid2},${node1_eid2},${node3_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - start_RA panic 0 0 - SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - - check_log 0 RA 1007 1008 - check_log 0 alarmd 1007 1008 - check_log 0 monitor 1007 1008 - -} -function post_test(){ - clean_sysSentry_message - -} - +#!/usr/bin/bash +# shellcheck disable=SC1017,SC2154 +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## + + +source "comm/lib.sh" +set -x + +function pre_test(){ + pre_env 3 +} +function run_test(){ + sentryctl set sentry_remote_reporter --cna "${node1_cna}" --eid "${node1_eid1};${node1_eid2}" --panic=on --kernel_reboot=on + SSH_CMD "sentryctl set sentry_remote_reporter --cna=${node2_cna} --eid='${node2_eid1};${node2_eid2}' --panic=on --kernel_reboot=on " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + sentryctl set sentry_urma_comm --server_eid="${node1_eid1},${node2_eid1},${node3_eid1};${node1_eid2},${node2_eid2},${node3_eid2}" --client_jetty_id="${test_jetty_id}" + SSH_CMD "sentryctl set sentry_urma_comm --server_eid='${node2_eid1},${node1_eid1},${node3_eid1};${node2_eid2},${node1_eid2},${node3_eid2}' --client_jetty_id=${test_jetty_id}" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + start_RA panic 0 0 + SSH_CMD "echo c > /proc/sysrq-trigger" "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" + + check_log 0 RA 1007 1008 + check_log 0 alarmd 1007 1008 + check_log 0 monitor 1007 1008 + +} +function post_test(){ + clean_sysSentry_message + +} + main "$@" \ No newline at end of file diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh index 47b523c46..bcd1d2390 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh @@ -1,93 +1,93 @@ -#!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 -# You can use it according to the terms and conditions of the Mulan PSL v2. -# http://license.coscl.org.cn/MulanPSL2 -# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, -# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -# See the Mulan PSL v2 for more details. - -# ################################## -# @Author : yangna -# @Date : 2025/12/12 -# ################################## - - -source "comm/lib.sh" -set -x -function check_RA_xalarmd_log() { - SLEEP_WAIT 30 "systemctl is-active xalarmd.service" 2 - CHECK_RESULT $? 0 0 - sleep 6 #等服务重启 - start_RA xalarmd - CHECK_RESULT $? 0 0 - - start_RA plugin - CHECK_RESULT $? 0 0 - - check_RA_xalarmd - check_RA_plugin -} - -function check_xalarmd_log() { - grep "${run_alarm} not found or socket file been replaced, recovering" "${task_log_path}"/xalarm.log - CHECK_RESULT $? 0 0 - grep "${run_report} not found or socket file been replaced, recovering" "${task_log_path}"/xalarm.log - CHECK_RESULT $? 0 0 - grep "${run_alarm} has been created" "${task_log_path}"/xalarm.log - CHECK_RESULT $? 0 0 - grep "${run_report} has been created" "${task_log_path}"/xalarm.log - CHECK_RESULT $? 0 0 - -} -function pre_test(){ - pre_xalarm_env -} -function run_test(){ - check_RA_xalarmd_log - clean_sysSentry_message - - rm -rf "${run_alarm}" - rm -rf "${run_report}" - check_RA_xalarmd_log - check_xalarmd_log - - clean_sysSentry_message - rm -rf "${run_alarm}" && touch "${run_alarm}" - rm -rf "${run_report}" && touch "${run_alarm}" - check_RA_xalarmd_log - check_xalarmd_log - - chmod 700 "${run_alarm}" - chmod 700 "${run_report}" - - check_RA_xalarmd_log - - grep "socket file ${run_alarm} permission .* set not properly, recover as default permission" "${task_log_path}"/xalarm.log - CHECK_RESULT $? 0 0 - grep "socket file ${run_report} permission .* set not properly, recover as default permission" "${task_log_path}"/xalarm.log - CHECK_RESULT $? 0 0 - - chmod 700 "${xalarm_run_dir}" - check_RA_xalarmd_log - grep "${xalarm_run_dir} permission set not properly, recover as default permission" "${task_log_path}"/xalarm.log - CHECK_RESULT $? 0 0 - - rm -rf "${xalarm_run_dir}" - check_RA_xalarmd_log - grep "xalarmd run dir not exists, create ${xalarm_run_dir}" "${task_log_path}"/xalarm.log - CHECK_RESULT $? 0 0 - - kill -9 "$(pgrep -f /usr/bin/xalarmd)" - check_RA_xalarmd_log - grep "xalarm daemon init success" "${task_log_path}"/xalarm.log - CHECK_RESULT $? 0 0 - -} -function post_test(){ - clean_sysSentry_message - systemctl stop xalarmd - # return 0 -} - +#!/usr/bin/bash +# shellcheck disable=SC1017,SC2154 +# You can use it according to the terms and conditions of the Mulan PSL v2. +# http://license.coscl.org.cn/MulanPSL2 +# THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. + +# ################################## +# @Author : yangna +# @Date : 2025/12/12 +# ################################## + + +source "comm/lib.sh" +set -x +function check_RA_xalarmd_log() { + SLEEP_WAIT 30 "systemctl is-active xalarmd.service" 2 + CHECK_RESULT $? 0 0 + sleep 6 #等服务重启 + start_RA xalarmd + CHECK_RESULT $? 0 0 + + start_RA plugin + CHECK_RESULT $? 0 0 + + check_RA_xalarmd + check_RA_plugin +} + +function check_xalarmd_log() { + grep "${run_alarm} not found or socket file been replaced, recovering" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + grep "${run_report} not found or socket file been replaced, recovering" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + grep "${run_alarm} has been created" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + grep "${run_report} has been created" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + +} +function pre_test(){ + pre_xalarm_env +} +function run_test(){ + check_RA_xalarmd_log + clean_sysSentry_message + + rm -rf "${run_alarm}" + rm -rf "${run_report}" + check_RA_xalarmd_log + check_xalarmd_log + + clean_sysSentry_message + rm -rf "${run_alarm}" && touch "${run_alarm}" + rm -rf "${run_report}" && touch "${run_alarm}" + check_RA_xalarmd_log + check_xalarmd_log + + chmod 700 "${run_alarm}" + chmod 700 "${run_report}" + + check_RA_xalarmd_log + + grep "socket file ${run_alarm} permission .* set not properly, recover as default permission" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + grep "socket file ${run_report} permission .* set not properly, recover as default permission" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + + chmod 700 "${xalarm_run_dir}" + check_RA_xalarmd_log + grep "${xalarm_run_dir} permission set not properly, recover as default permission" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + + rm -rf "${xalarm_run_dir}" + check_RA_xalarmd_log + grep "xalarmd run dir not exists, create ${xalarm_run_dir}" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + + kill -9 "$(pgrep -f /usr/bin/xalarmd)" + check_RA_xalarmd_log + grep "xalarm daemon init success" "${task_log_path}"/xalarm.log + CHECK_RESULT $? 0 0 + +} +function post_test(){ + clean_sysSentry_message + systemctl stop xalarmd + # return 0 +} + main "$@" \ No newline at end of file -- Gitee From a6c2ab7c2dfd0cf3d1d12cd3a13377ea6057149e Mon Sep 17 00:00:00 2001 From: yangna Date: Fri, 12 Dec 2025 12:47:06 +0000 Subject: [PATCH 13/19] 2 Signed-off-by: yangna --- testcases/smoke-test/smock-sysSentry/comm/lib.sh | 6 +++--- .../smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh | 2 +- .../smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_panic_001.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_panic_002.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_panic_003.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_panic_004.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh index d7b730e55..bc8d2f2fb 100644 --- a/testcases/smoke-test/smock-sysSentry/comm/lib.sh +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 +# shellcheck disable=SC1091 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -199,14 +199,14 @@ function check_alarmd(){ local is_reply="${3}" local tmp_reply_msg_len="${4}" tmp_reply_id=$(expr "$tmp_alarm_id" + 1) - if [ "${tmp_alarm_msg_len}"="no"]; then + if [[ "${tmp_alarm_msg_len}" == "no" ]]; then tmp_alarm_msg_len=".*" else tmp_alarm_msg_len="$(grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_alarm_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" tmp_alarm_msg_len="$(expr "$tmp_alarm_msg_len" - 1)" fi - if [ "${tmp_reply_msg_len}"="no"]; then + if [[ "${tmp_reply_msg_len}" == "no" ]]; then tmp_reply_msg_len=".*" else tmp_reply_msg_len="$(grep -aw 'Get msg:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_reply_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh index de76ec050..e3bbd94ee 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 +# shellcheck disable=SC1091 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh index f63e3b62c..3d1de91de 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 +# shellcheck disable=SC1091 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh index 94283ac3f..4f23695a4 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 +# shellcheck disable=SC1091 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh index 1ec894f96..f58ba2f29 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 +# shellcheck disable=SC1091 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh index 1535f872d..91c92e3ae 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 +# shellcheck disable=SC1091 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh index 320a2d3e4..c8b0f81dd 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 +# shellcheck disable=SC1091 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh index d41c20174..17b587312 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 +# shellcheck disable=SC1091 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh index 784dae6dc..fe275e09d 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 +# shellcheck disable=SC1091 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh index 1f2c2c388..f53becdfa 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 +# shellcheck disable=SC1091 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh index bcd1d2390..c9ab679a6 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1017,SC2154 +# shellcheck disable=SC1091 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -- Gitee From 951c51822b0139016454ee9125e95b81e4d23872 Mon Sep 17 00:00:00 2001 From: yangna Date: Fri, 12 Dec 2025 13:28:34 +0000 Subject: [PATCH 14/19] update testcases/smoke-test/smock-sysSentry/comm/lib.sh. Signed-off-by: yangna --- .../smoke-test/smock-sysSentry/comm/lib.sh | 68 +++++++++---------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh index bc8d2f2fb..99f6b565d 100644 --- a/testcases/smoke-test/smock-sysSentry/comm/lib.sh +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -8,11 +8,10 @@ # See the Mulan PSL v2 for more details. # ################################## -# @Author : yangna +# @Author : yangna # @Date : 2025/12/12 # ################################## - source "$OET_PATH/libs/locallibs/common_lib.sh" TMP_DIR=/root/sysSentry_script @@ -23,7 +22,7 @@ xalarm_run_dir="/var/run/xalarm" ra_path="$OET_PATH/testcases/smoke-test/smoke-sysSentry/RA" mkdir -p "${TMP_DIR}" -function pre_env(){ +function pre_env() { local node_num="$1" DNF_INSTALL "sysSentry" 1 @@ -48,7 +47,7 @@ function pre_env(){ lsmod | grep sentry " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - [ -n "${node_num}" ] && SSH_CMD " + [ -n "${node_num}" ] && SSH_CMD " yum -y install sentry_msg_monitor systemctl start xalarmd systemctl start sysSentry @@ -68,18 +67,18 @@ function pre_env(){ get_eid } -function pre_oom_env(){ +function pre_oom_env() { yum -y install sentry_msg_monitor modprobe sentry_msg_helper modprobe sentry_reporter systemctl start xalarmd systemctl start sysSentry - sleep 5 + sleep 5 sentryctl list | grep sentry_msg_monitor } -function pre_xalarm_env(){ +function pre_xalarm_env() { DNF_INSTALL "sysSentry" 1 yum -y remove libxalarm pyxalarm sentry_msg_monitor sysSentry yum -y install sentry_msg_monitor @@ -89,7 +88,7 @@ function pre_xalarm_env(){ sentryctl list | grep sentry_msg_monitor } -function start_sentry(){ +function start_sentry() { yum -y install sentry_msg_monitor systemctl start xalarmd systemctl start sysSentry @@ -103,10 +102,10 @@ function start_sentry(){ modprobe sentry_remote_reporter sentryctl start sentry_msg_monitor sleep 5 - lsmod |grep sentry + lsmod | grep sentry } -function get_eid(){ +function get_eid() { node1_eid1=$(urma_admin show | awk '/udma2/ && /eid0/ {print $5}') node1_eid2=$(urma_admin show | awk '/udma5/ && /eid0/ {print $5}') @@ -115,34 +114,33 @@ function get_eid(){ node3_eid1=$(SSH_CMD "urma_admin show | awk '/udma2/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') node3_eid2=$(SSH_CMD "urma_admin show | awk '/udma5/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') - + # node1_cna=1 # node2_cna=2 - node1_cna=$(( $(cat /sys/devices/ub_bus_controller0/00001/primary_cna | tr -d '[:space:]') )) + node1_cna=$(($(cat /sys/devices/ub_bus_controller0/00001/primary_cna | tr -d '[:space:]'))) raw_output=$(SSH_CMD "cat /sys/devices/ub_bus_controller0/00001/primary_cna 2>/dev/null" \ "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}") - + hex_value=$(echo "$raw_output" | tr -d '[:space:]' | grep -oE '0x[0-9A-Fa-f]+') - node2_cna=$(( $hex_value )) + node2_cna=$(($hex_value)) node3_cna=3 test_jetty_id=$((RANDOM % 1021 + 3)) } -function gcc_ra(){ +function gcc_ra() { local ra_type="$1" [ -n "${ra_type}" ] && ra_type="_$ra_type" yum -y install sentry_msg_monitor libxalarm-devel gcc gcc "${ra_path}"/RA"${ra_type}".c -Wall -o3 -lxalarm -o "${ra_path}"/RA"${ra_type}" chmod 777 "${ra_path}/RA${ra_type}" - - } -function start_RA(){ + +function start_RA() { local ra_type="${1}" local ra_pare="${2:-}" local delay_time="${3:-}" - case $ra_type in + case $ra_type in panic | kernel_reboot) [ -f "${ra_path}"/RA_reboot ] || gcc_ra reboot stdbuf -oL "/root/mugen/testcases/smoke-test/smoke-sysSentry/RA/RA_reboot" "${ra_pare}" "${delay_time}" > "${TMP_DIR}/RA.log" 2>&1 & @@ -152,7 +150,7 @@ function start_RA(){ stdbuf -oL "${ra_path}/RA_${ra_type}" > "${TMP_DIR}/RA.log" 2>&1 & ;; *) - [ -f "${ra_path}"/RA_"${ra_type}" ] || gcc_ra ${ra_type} + [ -f "${ra_path}"/RA_"${ra_type}" ] || gcc_ra "${ra_type}" stdbuf -oL "${ra_path}/RA_${ra_type}" > "${TMP_DIR}/RA_${ra_type}.log" 2>&1 & ;; @@ -160,30 +158,30 @@ function start_RA(){ return $? } -function check_RA_xalarmd(){ +function check_RA_xalarmd() { local ra_log="${1-RA_xalarmd.log}" SLEEP_WAIT 30 "grep -aw 'alarmid:1003' ${TMP_DIR}/${ra_log} | grep -w 'msg:hello'" 2 CHECK_RESULT $? 0 0 } -function check_RA_plugin(){ +function check_RA_plugin() { local ra_log="${1-RA_plugin.log}" - SLEEP_WAIT 30 "grep -aw 'alarmid:1004' ${TMP_DIR}/${ra_log} | grep -w 'msg:ACK OK'" 2 + SLEEP_WAIT 30 "grep -aw 'alarmid:1004' ${TMP_DIR}/${ra_log} | grep -w 'msg:ACK OK'" 2 CHECK_RESULT $? 0 0 } -function clean_sysSentry_message(){ +function clean_sysSentry_message() { echo > /var/log/sysSentry/xalarm.log echo > /var/log/sysSentry/sentry_msg_monitor.log } -function check_oom_dmesg(){ +function check_oom_dmesg() { local sync_value="${1}" local reason_value="${2}" SLEEP_WAIT 30 "dmesg | grep -aw \"got lowmem message\" | grep -a \"sync=${sync_value} reason=${reason_value}\"" 2 } -function check_RA_oom(){ +function check_RA_oom() { local sync_value="${1}" local reason_value="${2}" - for ((check_ra_oom_loop=0; check_ra_oom_loop<5; check_ra_oom_loop++)); do + for ((check_ra_oom_loop = 0; check_ra_oom_loop < 5; check_ra_oom_loop++)); do grep -aw "\[alarmid:1005\]" ${TMP_DIR}/RA.log | grep -F "sync:${sync_value},timeout:30000,reason:${reason_value}" && break sleep 2 done @@ -193,7 +191,7 @@ function check_RA_oom(){ check_oom_nid_info "${tmp_nid_info}" CHECK_RESULT $? 0 0 } -function check_alarmd(){ +function check_alarmd() { local tmp_alarm_id="${1}" local tmp_alarm_msg_len="${2}" local is_reply="${3}" @@ -219,18 +217,18 @@ function check_alarmd(){ CHECK_RESULT $? 0 0 } -function check_oom_sentry_msg_monitor(){ +function check_oom_sentry_msg_monitor() { local sync_value="${1}" local reason_value="${2}" local is_reply="${3-true}" - grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "alarm_type: 1005, str: .*,sync:${sync_value},timeout:30000,reason:${reason_value}" + grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "alarm_type: 1005, str: .*,sync:${sync_value},timeout:30000,reason:${reason_value}" CHECK_RESULT $? 0 0 tmp_nid_info=$(grep -aw "alarm_type: 1005" ${task_log_path}/sentry_msg_monitor.log | tail -1 | awk -F'str:' '{print $2}' | awk -F'{' '{print $2}' | awk -F'}' '{print $1}' | awk -F']' '{print $1}') check_oom_nid_info "${tmp_nid_info}" CHECK_RESULT $? 0 0 } -function check_oom_nid_info(){ +function check_oom_nid_info() { local tmp_nid_info="${1}" # nr_nid=$(echo "$tmp_nid_info" | grep -oP '(?<=nr_nid:)\d+') # tmp_nid_str=$(echo "$tmp_nid_info" | grep -oP '(?<=nid:\[)[^\]]+(?=)') @@ -240,7 +238,7 @@ function check_oom_nid_info(){ echo ${nid_str[@]:"$nr_nid":$(expr ${#nid_str[@]} - 1)} | xargs -n 1 | grep '\-1' | wc -l | grep "$(expr ${#nid_str[@]} - "$nr_nid")" CHECK_RESULT $? 0 0 } -function check_log(){ +function check_log() { local reply_type="${1}" local log_type="${2}" local alarm_value="${3}" @@ -273,11 +271,11 @@ function check_log(){ alarm_count=$(grep -a "$grep_alarm" "$log_file" | wc -l) send_ack=$(grep -a "$grep_ack" "$log_file" | wc -l) - test $alarm_count -ge 1 + test "$alarm_count" -ge 1 CHECK_RESULT $? 0 0 - if [ "$log_type" != "RA" -a "$reply_type" = "0" ]; then - test $send_ack -ge 1 + if [ "$log_type" != "RA" -a "$reply_type" = "0" ]; then + test "$send_ack" -ge 1 CHECK_RESULT $? 0 0 fi } -- Gitee From 571144e7ab7448cc828456dafa961d0a70b7093e Mon Sep 17 00:00:00 2001 From: yangna Date: Fri, 12 Dec 2025 13:51:04 +0000 Subject: [PATCH 15/19] 1212 Signed-off-by: yangna --- .../smoke-test/smock-sysSentry/comm/lib.sh | 22 +++++++++---------- .../oe_test_sysSentry_kernel_reboot_001.sh | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh index 99f6b565d..b5e0dec37 100644 --- a/testcases/smoke-test/smock-sysSentry/comm/lib.sh +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091 +# shellcheck disable=SC1091,SC2207,SC2002,SC2126 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -122,7 +122,7 @@ function get_eid() { "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}") hex_value=$(echo "$raw_output" | tr -d '[:space:]' | grep -oE '0x[0-9A-Fa-f]+') - node2_cna=$(($hex_value)) + node2_cna=$((hex_value)) node3_cna=3 test_jetty_id=$((RANDOM % 1021 + 3)) @@ -140,7 +140,7 @@ function start_RA() { local ra_type="${1}" local ra_pare="${2:-}" local delay_time="${3:-}" - case $ra_type in + case "$ra_type" in panic | kernel_reboot) [ -f "${ra_path}"/RA_reboot ] || gcc_ra reboot stdbuf -oL "/root/mugen/testcases/smoke-test/smoke-sysSentry/RA/RA_reboot" "${ra_pare}" "${delay_time}" > "${TMP_DIR}/RA.log" 2>&1 & @@ -196,24 +196,24 @@ function check_alarmd() { local tmp_alarm_msg_len="${2}" local is_reply="${3}" local tmp_reply_msg_len="${4}" - tmp_reply_id=$(expr "$tmp_alarm_id" + 1) + tmp_reply_id=$((expr "$tmp_alarm_id" + 1)) if [[ "${tmp_alarm_msg_len}" == "no" ]]; then tmp_alarm_msg_len=".*" else tmp_alarm_msg_len="$(grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_alarm_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" - tmp_alarm_msg_len="$(expr "$tmp_alarm_msg_len" - 1)" + tmp_alarm_msg_len="$((expr "$tmp_alarm_msg_len" - 1))" fi if [[ "${tmp_reply_msg_len}" == "no" ]]; then tmp_reply_msg_len=".*" else tmp_reply_msg_len="$(grep -aw 'Get msg:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_reply_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" - tmp_reply_msg_len="$(expr "$tmp_reply_msg_len" - 1)" + tmp_reply_msg_len="$((expr "$tmp_reply_msg_len" - 1))" fi grep -aw "Broadcast msg success" ${task_log_path}/xalarm.log | grep "alarm msg is alarm_id: ${tmp_alarm_id}, alarm_level: MINOR_ALM, alarm_type: ALARM_TYPE_OCCUR" CHECK_RESULT $? 0 0 - grep "alarm_id: ${tmd_alarm_id}" ${task_log_path}/xalarm.log | grep "alarm_msg_len: ${tmp_alarm_msg_len}" + grep "alarm_id: ${tmp_alarm_id}" ${task_log_path}/xalarm.log | grep "alarm_msg_len: ${tmp_alarm_msg_len}" CHECK_RESULT $? 0 0 } @@ -230,12 +230,10 @@ function check_oom_sentry_msg_monitor() { function check_oom_nid_info() { local tmp_nid_info="${1}" - # nr_nid=$(echo "$tmp_nid_info" | grep -oP '(?<=nr_nid:)\d+') - # tmp_nid_str=$(echo "$tmp_nid_info" | grep -oP '(?<=nid:\[)[^\]]+(?=)') nid_str=($(echo "${tmp_nid_str[@]}" | tr ',' ' ')) - echo ${nid_str[@]:0:$(expr "$nr_nid")} | grep -v '\-1' + echo "${nid_str[@]:0:$((nr_nid))}" | grep -v '\-1' CHECK_RESULT $? 0 0 - echo ${nid_str[@]:"$nr_nid":$(expr ${#nid_str[@]} - 1)} | xargs -n 1 | grep '\-1' | wc -l | grep "$(expr ${#nid_str[@]} - "$nr_nid")" + echo "${nid_str[@]:$nr_nid:$((${#nid_str[@]} - 1))}" | xargs -n 1 | grep -c '\-1' | grep "$((${#nid_str[@]} - nr_nid))" CHECK_RESULT $? 0 0 } function check_log() { @@ -274,7 +272,7 @@ function check_log() { test "$alarm_count" -ge 1 CHECK_RESULT $? 0 0 - if [ "$log_type" != "RA" -a "$reply_type" = "0" ]; then + if [ "$log_type" != "RA" ] && [ "$reply_type" = "0" ]; then test "$send_ack" -ge 1 CHECK_RESULT $? 0 0 fi diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh index e3bbd94ee..5072fed2d 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091 +# shellcheck disable=SC1091,SC2034,SC2004,SC2145 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -- Gitee From abb464559c45def241abea59efbcf99f18108ddc Mon Sep 17 00:00:00 2001 From: yangna Date: Sat, 13 Dec 2025 00:59:38 +0000 Subject: [PATCH 16/19] 1213 Signed-off-by: yangna --- .../smoke-test/smock-sysSentry/comm/lib.sh | 78 ++++++++++--------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh index b5e0dec37..967db7682 100644 --- a/testcases/smoke-test/smock-sysSentry/comm/lib.sh +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091,SC2207,SC2002,SC2126 +# shellcheck disable=SC1091,SC2034,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -8,10 +8,11 @@ # See the Mulan PSL v2 for more details. # ################################## -# @Author : yangna +# @Author : yangna # @Date : 2025/12/12 # ################################## + source "$OET_PATH/libs/locallibs/common_lib.sh" TMP_DIR=/root/sysSentry_script @@ -22,7 +23,7 @@ xalarm_run_dir="/var/run/xalarm" ra_path="$OET_PATH/testcases/smoke-test/smoke-sysSentry/RA" mkdir -p "${TMP_DIR}" -function pre_env() { +function pre_env(){ local node_num="$1" DNF_INSTALL "sysSentry" 1 @@ -47,7 +48,7 @@ function pre_env() { lsmod | grep sentry " "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}" - [ -n "${node_num}" ] && SSH_CMD " + [ -n "${node_num}" ] && SSH_CMD " yum -y install sentry_msg_monitor systemctl start xalarmd systemctl start sysSentry @@ -67,18 +68,18 @@ function pre_env() { get_eid } -function pre_oom_env() { +function pre_oom_env(){ yum -y install sentry_msg_monitor modprobe sentry_msg_helper modprobe sentry_reporter systemctl start xalarmd systemctl start sysSentry - sleep 5 + sleep 5 sentryctl list | grep sentry_msg_monitor } -function pre_xalarm_env() { +function pre_xalarm_env(){ DNF_INSTALL "sysSentry" 1 yum -y remove libxalarm pyxalarm sentry_msg_monitor sysSentry yum -y install sentry_msg_monitor @@ -88,7 +89,7 @@ function pre_xalarm_env() { sentryctl list | grep sentry_msg_monitor } -function start_sentry() { +function start_sentry(){ yum -y install sentry_msg_monitor systemctl start xalarmd systemctl start sysSentry @@ -102,10 +103,10 @@ function start_sentry() { modprobe sentry_remote_reporter sentryctl start sentry_msg_monitor sleep 5 - lsmod | grep sentry + lsmod |grep sentry } -function get_eid() { +function get_eid(){ node1_eid1=$(urma_admin show | awk '/udma2/ && /eid0/ {print $5}') node1_eid2=$(urma_admin show | awk '/udma5/ && /eid0/ {print $5}') @@ -114,33 +115,34 @@ function get_eid() { node3_eid1=$(SSH_CMD "urma_admin show | awk '/udma2/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') node3_eid2=$(SSH_CMD "urma_admin show | awk '/udma5/ && /eid0/ {print \$5}'" "${NODE3_IPV4}" "${NODE3_PASSWORD}" "${NODE3_USER}" | grep -oE '([0-9a-fA-F]{4}:){7}[0-9a-fA-F]{4}') - + # node1_cna=1 # node2_cna=2 - node1_cna=$(($(cat /sys/devices/ub_bus_controller0/00001/primary_cna | tr -d '[:space:]'))) + node1_cna=$(( $(cat /sys/devices/ub_bus_controller0/00001/primary_cna | tr -d '[:space:]') )) raw_output=$(SSH_CMD "cat /sys/devices/ub_bus_controller0/00001/primary_cna 2>/dev/null" \ "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}") - + hex_value=$(echo "$raw_output" | tr -d '[:space:]' | grep -oE '0x[0-9A-Fa-f]+') - node2_cna=$((hex_value)) + node2_cna=$(( $hex_value )) node3_cna=3 test_jetty_id=$((RANDOM % 1021 + 3)) } -function gcc_ra() { +function gcc_ra(){ local ra_type="$1" [ -n "${ra_type}" ] && ra_type="_$ra_type" yum -y install sentry_msg_monitor libxalarm-devel gcc gcc "${ra_path}"/RA"${ra_type}".c -Wall -o3 -lxalarm -o "${ra_path}"/RA"${ra_type}" chmod 777 "${ra_path}/RA${ra_type}" -} -function start_RA() { + +} +function start_RA(){ local ra_type="${1}" local ra_pare="${2:-}" local delay_time="${3:-}" - case "$ra_type" in + case $ra_type in panic | kernel_reboot) [ -f "${ra_path}"/RA_reboot ] || gcc_ra reboot stdbuf -oL "/root/mugen/testcases/smoke-test/smoke-sysSentry/RA/RA_reboot" "${ra_pare}" "${delay_time}" > "${TMP_DIR}/RA.log" 2>&1 & @@ -158,30 +160,30 @@ function start_RA() { return $? } -function check_RA_xalarmd() { +function check_RA_xalarmd(){ local ra_log="${1-RA_xalarmd.log}" SLEEP_WAIT 30 "grep -aw 'alarmid:1003' ${TMP_DIR}/${ra_log} | grep -w 'msg:hello'" 2 CHECK_RESULT $? 0 0 } -function check_RA_plugin() { +function check_RA_plugin(){ local ra_log="${1-RA_plugin.log}" - SLEEP_WAIT 30 "grep -aw 'alarmid:1004' ${TMP_DIR}/${ra_log} | grep -w 'msg:ACK OK'" 2 + SLEEP_WAIT 30 "grep -aw 'alarmid:1004' ${TMP_DIR}/${ra_log} | grep -w 'msg:ACK OK'" 2 CHECK_RESULT $? 0 0 } -function clean_sysSentry_message() { +function clean_sysSentry_message(){ echo > /var/log/sysSentry/xalarm.log echo > /var/log/sysSentry/sentry_msg_monitor.log } -function check_oom_dmesg() { +function check_oom_dmesg(){ local sync_value="${1}" local reason_value="${2}" SLEEP_WAIT 30 "dmesg | grep -aw \"got lowmem message\" | grep -a \"sync=${sync_value} reason=${reason_value}\"" 2 } -function check_RA_oom() { +function check_RA_oom(){ local sync_value="${1}" local reason_value="${2}" - for ((check_ra_oom_loop = 0; check_ra_oom_loop < 5; check_ra_oom_loop++)); do + for ((check_ra_oom_loop=0; check_ra_oom_loop<5; check_ra_oom_loop++)); do grep -aw "\[alarmid:1005\]" ${TMP_DIR}/RA.log | grep -F "sync:${sync_value},timeout:30000,reason:${reason_value}" && break sleep 2 done @@ -191,7 +193,7 @@ function check_RA_oom() { check_oom_nid_info "${tmp_nid_info}" CHECK_RESULT $? 0 0 } -function check_alarmd() { +function check_alarmd(){ local tmp_alarm_id="${1}" local tmp_alarm_msg_len="${2}" local is_reply="${3}" @@ -208,35 +210,37 @@ function check_alarmd() { tmp_reply_msg_len=".*" else tmp_reply_msg_len="$(grep -aw 'Get msg:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_reply_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" - tmp_reply_msg_len="$((expr "$tmp_reply_msg_len" - 1))" + tmp_reply_msg_len="$(expr "$tmp_reply_msg_len" - 1)" fi grep -aw "Broadcast msg success" ${task_log_path}/xalarm.log | grep "alarm msg is alarm_id: ${tmp_alarm_id}, alarm_level: MINOR_ALM, alarm_type: ALARM_TYPE_OCCUR" CHECK_RESULT $? 0 0 - grep "alarm_id: ${tmp_alarm_id}" ${task_log_path}/xalarm.log | grep "alarm_msg_len: ${tmp_alarm_msg_len}" + grep "alarm_id: ${tmd_alarm_id}" ${task_log_path}/xalarm.log | grep "alarm_msg_len: ${tmp_alarm_msg_len}" CHECK_RESULT $? 0 0 } -function check_oom_sentry_msg_monitor() { +function check_oom_sentry_msg_monitor(){ local sync_value="${1}" local reason_value="${2}" local is_reply="${3-true}" - grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "alarm_type: 1005, str: .*,sync:${sync_value},timeout:30000,reason:${reason_value}" + grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "alarm_type: 1005, str: .*,sync:${sync_value},timeout:30000,reason:${reason_value}" CHECK_RESULT $? 0 0 tmp_nid_info=$(grep -aw "alarm_type: 1005" ${task_log_path}/sentry_msg_monitor.log | tail -1 | awk -F'str:' '{print $2}' | awk -F'{' '{print $2}' | awk -F'}' '{print $1}' | awk -F']' '{print $1}') check_oom_nid_info "${tmp_nid_info}" CHECK_RESULT $? 0 0 } -function check_oom_nid_info() { +function check_oom_nid_info(){ local tmp_nid_info="${1}" + # nr_nid=$(echo "$tmp_nid_info" | grep -oP '(?<=nr_nid:)\d+') + # tmp_nid_str=$(echo "$tmp_nid_info" | grep -oP '(?<=nid:\[)[^\]]+(?=)') nid_str=($(echo "${tmp_nid_str[@]}" | tr ',' ' ')) - echo "${nid_str[@]:0:$((nr_nid))}" | grep -v '\-1' + echo ${nid_str[@]:0:$(expr "$nr_nid")} | grep -v '\-1' CHECK_RESULT $? 0 0 - echo "${nid_str[@]:$nr_nid:$((${#nid_str[@]} - 1))}" | xargs -n 1 | grep -c '\-1' | grep "$((${#nid_str[@]} - nr_nid))" + echo ${nid_str[@]:"$nr_nid":$(expr ${#nid_str[@]} - 1)} | xargs -n 1 | grep '\-1' | wc -l | grep "$(expr ${#nid_str[@]} - "$nr_nid")" CHECK_RESULT $? 0 0 } -function check_log() { +function check_log(){ local reply_type="${1}" local log_type="${2}" local alarm_value="${3}" @@ -269,11 +273,11 @@ function check_log() { alarm_count=$(grep -a "$grep_alarm" "$log_file" | wc -l) send_ack=$(grep -a "$grep_ack" "$log_file" | wc -l) - test "$alarm_count" -ge 1 + test $alarm_count -ge 1 CHECK_RESULT $? 0 0 - if [ "$log_type" != "RA" ] && [ "$reply_type" = "0" ]; then - test "$send_ack" -ge 1 + if [ "$log_type" != "RA" -a "$reply_type" = "0" ]; then + test $send_ack -ge 1 CHECK_RESULT $? 0 0 fi } -- Gitee From a1b3dd6879e29c69c6214099cf5f3a62afbfd176 Mon Sep 17 00:00:00 2001 From: yangna Date: Sat, 13 Dec 2025 01:26:06 +0000 Subject: [PATCH 17/19] 1213925 Signed-off-by: yangna --- .../smoke-test/smock-sysSentry/comm/lib.sh | 24 +++++++++---------- .../oe_test_sysSentry_kernel_reboot_001.sh | 2 +- .../oe_test_sysSentry_kernel_reboot_002.sh | 2 +- .../oe_test_sysSentry_kernel_reboot_003.sh | 2 +- .../oe_test_sysSentry_kernel_reboot_004.sh | 2 +- .../smock-sysSentry/oe_test_sysSentry_oom.sh | 2 +- .../oe_test_sysSentry_panic_001.sh | 2 +- .../oe_test_sysSentry_panic_002.sh | 2 +- .../oe_test_sysSentry_panic_003.sh | 2 +- .../oe_test_sysSentry_panic_004.sh | 2 +- .../oe_test_sysSentry_xalarmd_recorver.sh | 2 +- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh index 967db7682..67936e114 100644 --- a/testcases/smoke-test/smock-sysSentry/comm/lib.sh +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091,SC2034,SC2154 +# shellcheck disable=SC1091,SC2034,SC2154,AC2207 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, @@ -118,7 +118,7 @@ function get_eid(){ # node1_cna=1 # node2_cna=2 - node1_cna=$(( $(cat /sys/devices/ub_bus_controller0/00001/primary_cna | tr -d '[:space:]') )) + node1_cna=$(( $(tr -d '[:space:]' < /sys/devices/ub_bus_controller0/00001/primary_cna) )) raw_output=$(SSH_CMD "cat /sys/devices/ub_bus_controller0/00001/primary_cna 2>/dev/null" \ "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}") @@ -198,19 +198,19 @@ function check_alarmd(){ local tmp_alarm_msg_len="${2}" local is_reply="${3}" local tmp_reply_msg_len="${4}" - tmp_reply_id=$((expr "$tmp_alarm_id" + 1)) + tmp_reply_id=$(( tmp_alarm_id + 1 )) if [[ "${tmp_alarm_msg_len}" == "no" ]]; then tmp_alarm_msg_len=".*" else tmp_alarm_msg_len="$(grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_alarm_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" - tmp_alarm_msg_len="$((expr "$tmp_alarm_msg_len" - 1))" + tmp_alarm_msg_len="$((expr tmp_alarm_msg_len - 1))" fi if [[ "${tmp_reply_msg_len}" == "no" ]]; then tmp_reply_msg_len=".*" else tmp_reply_msg_len="$(grep -aw 'Get msg:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_reply_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" - tmp_reply_msg_len="$(expr "$tmp_reply_msg_len" - 1)" + tmp_reply_msg_len="$((expr tmp_reply_msg_len - 1))" fi grep -aw "Broadcast msg success" ${task_log_path}/xalarm.log | grep "alarm msg is alarm_id: ${tmp_alarm_id}, alarm_level: MINOR_ALM, alarm_type: ALARM_TYPE_OCCUR" CHECK_RESULT $? 0 0 @@ -235,9 +235,9 @@ function check_oom_nid_info(){ # nr_nid=$(echo "$tmp_nid_info" | grep -oP '(?<=nr_nid:)\d+') # tmp_nid_str=$(echo "$tmp_nid_info" | grep -oP '(?<=nid:\[)[^\]]+(?=)') nid_str=($(echo "${tmp_nid_str[@]}" | tr ',' ' ')) - echo ${nid_str[@]:0:$(expr "$nr_nid")} | grep -v '\-1' + echo "${nid_str[@]:0:$((nr_nid))}" | grep -v '\-1' CHECK_RESULT $? 0 0 - echo ${nid_str[@]:"$nr_nid":$(expr ${#nid_str[@]} - 1)} | xargs -n 1 | grep '\-1' | wc -l | grep "$(expr ${#nid_str[@]} - "$nr_nid")" + echo "${nid_str[@]:$nr_nid:$((${#nid_str[@]} - 1))}" | xargs -n 1 | grep -c '\-1' | grep "$((${#nid_str[@]} - nr_nid))" CHECK_RESULT $? 0 0 } function check_log(){ @@ -270,14 +270,14 @@ function check_log(){ timeout=$([ "$reply_type" -eq 2 ] && echo 100 || echo 50) sleep "$timeout" cat "$log_file" - alarm_count=$(grep -a "$grep_alarm" "$log_file" | wc -l) - send_ack=$(grep -a "$grep_ack" "$log_file" | wc -l) + alarm_count=$(grep -ac "$grep_alarm" "$log_file") + send_ack=$(grep -ac "$grep_ack" "$log_file") - test $alarm_count -ge 1 + test "$alarm_count" -ge 1 CHECK_RESULT $? 0 0 - if [ "$log_type" != "RA" -a "$reply_type" = "0" ]; then - test $send_ack -ge 1 + if [ "$log_type" != "RA" ] && [ "$reply_type" = "0" ]; then + test "$send_ack" -ge 1 CHECK_RESULT $? 0 0 fi } diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh index 5072fed2d..9d6f22c3e 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_001.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091,SC2034,SC2004,SC2145 +# shellcheck disable=SC1091,SC2034,SC2004,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh index 3d1de91de..2d7e750d1 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_002.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091 +# shellcheck disable=SC1091,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh index 4f23695a4..a17f74cfc 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_003.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091 +# shellcheck disable=SC1091,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh index f58ba2f29..e0c8b12e4 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_kernel_reboot_004.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091 +# shellcheck disable=SC1091,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh index 91c92e3ae..8132ccd61 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_oom.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091 +# shellcheck disable=SC1091,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh index c8b0f81dd..9aca7776f 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_001.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091 +# shellcheck disable=SC1091,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh index 17b587312..7bc090aee 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_002.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091 +# shellcheck disable=SC1091,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh index fe275e09d..71cf88ab4 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_003.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091 +# shellcheck disable=SC1091,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh index f53becdfa..271b0b007 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_panic_004.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091 +# shellcheck disable=SC1091,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, diff --git a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh index c9ab679a6..e7b0bfe15 100644 --- a/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh +++ b/testcases/smoke-test/smock-sysSentry/oe_test_sysSentry_xalarmd_recorver.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091 +# shellcheck disable=SC1091,SC2154 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -- Gitee From 03c50b843f7efa2bbb7b33fe8bd7bb80f58cecce Mon Sep 17 00:00:00 2001 From: yangna Date: Sat, 13 Dec 2025 01:33:08 +0000 Subject: [PATCH 18/19] 12130933 Signed-off-by: yangna --- testcases/smoke-test/smock-sysSentry/comm/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh index 67936e114..5938b5bd9 100644 --- a/testcases/smoke-test/smock-sysSentry/comm/lib.sh +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -1,5 +1,5 @@ #!/usr/bin/bash -# shellcheck disable=SC1091,SC2034,SC2154,AC2207 +# shellcheck disable=SC1091,SC2034,SC2154,SC2207 # You can use it according to the terms and conditions of the Mulan PSL v2. # http://license.coscl.org.cn/MulanPSL2 # THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, -- Gitee From 4a0d9452600372439f68092d2309b10b93501fcb Mon Sep 17 00:00:00 2001 From: yangna Date: Sat, 13 Dec 2025 01:46:52 +0000 Subject: [PATCH 19/19] 12130946 Signed-off-by: yangna --- testcases/smoke-test/smock-sysSentry/comm/lib.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testcases/smoke-test/smock-sysSentry/comm/lib.sh b/testcases/smoke-test/smock-sysSentry/comm/lib.sh index 5938b5bd9..c1016fa7a 100644 --- a/testcases/smoke-test/smock-sysSentry/comm/lib.sh +++ b/testcases/smoke-test/smock-sysSentry/comm/lib.sh @@ -123,7 +123,7 @@ function get_eid(){ "${NODE2_IPV4}" "${NODE2_PASSWORD}" "${NODE2_USER}") hex_value=$(echo "$raw_output" | tr -d '[:space:]' | grep -oE '0x[0-9A-Fa-f]+') - node2_cna=$(( $hex_value )) + node2_cna=$(( hex_value )) node3_cna=3 test_jetty_id=$((RANDOM % 1021 + 3)) @@ -203,14 +203,14 @@ function check_alarmd(){ tmp_alarm_msg_len=".*" else tmp_alarm_msg_len="$(grep -aw 'Send msg success:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_alarm_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" - tmp_alarm_msg_len="$((expr tmp_alarm_msg_len - 1))" + tmp_alarm_msg_len=$((tmp_alarm_msg_len - 1)) fi if [[ "${tmp_reply_msg_len}" == "no" ]]; then tmp_reply_msg_len=".*" else tmp_reply_msg_len="$(grep -aw 'Get msg:' ${task_log_path}/sentry_msg_monitor.log | grep -w "${tmp_reply_id}" | head -1 | awk -F'str:' '{print $2}' | sed 's/ //g' | wc -c)" - tmp_reply_msg_len="$((expr tmp_reply_msg_len - 1))" + tmp_reply_msg_len=$(( tmp_reply_msg_len - 1)) fi grep -aw "Broadcast msg success" ${task_log_path}/xalarm.log | grep "alarm msg is alarm_id: ${tmp_alarm_id}, alarm_level: MINOR_ALM, alarm_type: ALARM_TYPE_OCCUR" CHECK_RESULT $? 0 0 -- Gitee