Return-Path: From: Wang Mingyu Date: Wed, 21 Nov 2018 00:08:49 -0800 Message-ID: <1542787735-36170-1-git-send-email-wangmy@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Fuego] [PATCH] Add test cases for command lm_sensors and service lighttpd, logd and lvm2-monitor. List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org Signed-off-by: Wang Mingyu --- .../tests/Functional.demo/tests/demo_lighttpd.sh | 41 ++++++++++ .../tests/Functional.demo/tests/demo_lm_sensors.sh | 88 ++++++++++++++++++++++ engine/tests/Functional.demo/tests/demo_logd.sh | 39 ++++++++++ .../Functional.demo/tests/demo_lvm2-monitor.sh | 20 +++++ 4 files changed, 188 insertions(+) create mode 100644 engine/tests/Functional.demo/tests/demo_lighttpd.sh create mode 100644 engine/tests/Functional.demo/tests/demo_lm_sensors.sh create mode 100644 engine/tests/Functional.demo/tests/demo_logd.sh create mode 100644 engine/tests/Functional.demo/tests/demo_lvm2-monitor.sh diff --git a/engine/tests/Functional.demo/tests/demo_lighttpd.sh b/engine/tests/Functional.demo/tests/demo_lighttpd.sh new file mode 100644 index 0000000..5e745af --- /dev/null +++ b/engine/tests/Functional.demo/tests/demo_lighttpd.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +# In the target start lighttpd, and confirm the process condition by command ps. + +test="lighttpd" + +. ./fuego_board_function_lib.sh + +set_init_manager + +exec_service_on_target lighttpd stop + +if exec_service_on_target lighttpd start +then + echo " -> start of lighttpd succeeded." +else + echo " -> start of lighttpd failed." + echo " -> $test: TEST-FAIL" + exit +fi + +sleep 5 + +if ps aux | grep "[/]usr/sbin/lighttpd" +then + echo " -> get the process of lighttpd." +else + echo " -> can't get the process of lighttpd." + echo " -> $test: TEST-FAIL" + exec_service_on_target lighttpd stop + exit +fi + +exec_service_on_target lighttpd stop + +if ps aux | grep "[/]usr/sbin/lighttpd" +then + echo " -> $test: TEST-FAIL" +else + echo " -> $test: TEST-PASS" +fi diff --git a/engine/tests/Functional.demo/tests/demo_lm_sensors.sh b/engine/tests/Functional.demo/tests/demo_lm_sensors.sh new file mode 100644 index 0000000..b801ea3 --- /dev/null +++ b/engine/tests/Functional.demo/tests/demo_lm_sensors.sh @@ -0,0 +1,88 @@ +#!/bin/sh + +# In the target start lm_sensors, and confirm the process condition by command ps. + +test="lm_sensors" + +. ./fuego_board_function_lib.sh + +set_init_manager + +flag=0 + +expect <<-EOF +spawn sensors-detect +expect { + -re ".*YES/no.*" { + exp_send "\r" + exp_continue + } + -re ".*YES/no/selectively.*" { + exp_send "\r" + exp_continue + } + -re ".*yes/NO/selectively.*" { + exp_send "\r" + exp_continue + } + -re ".*yes/NO.*" { + exp_send "\r" + exp_continue + } + -re ".*Just press ENTER to continue.*" { + exp_send "\r" + exp_continue + } + -re ".*root # " { + exp_send "\r" + if { $flag=0 } { + flag=1 + exp_continue + } + } + timeout { + exp_send "\003\r" + } +} +EOF + +sleep 5 + +if exec_service_on_target lm_sensors start +then + echo " -> start of lm_sensors succeeded." +else + echo " -> start of lm_sensors failed." + echo " -> $test: TEST-FAIL" + exit +fi + +if [ "$init_manager" = "systemd" ] +then + if exec_service_on_target lm_sensors is-active | grep "active" + then + echo " -> lm_sensors is active." + else + echo " -> lm_sensors is not active." + echo " -> $test: TEST-PASS" + exec_service_on_target lm_sensors stop + exit + fi +else + if exec_service_on_target lm_sensors status + then + echo " -> get status of lm_sensors." + else + echo " -> cant't get status of lm_sensors." + echo " -> $test: TEST-PASS" + exec_service_on_target lm_sensors stop + exit + fi +fi + +if exec_service_on_target lm_sensors stop +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi diff --git a/engine/tests/Functional.demo/tests/demo_logd.sh b/engine/tests/Functional.demo/tests/demo_logd.sh new file mode 100644 index 0000000..7856ac6 --- /dev/null +++ b/engine/tests/Functional.demo/tests/demo_logd.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +# In the target start logd, and confirm the process condition by command ps. + +test="logd" + +. ./fuego_board_function_lib.sh + +set_init_manager + +exec_service_on_target logd stop + +if exec_service_on_target logd start +then + echo " -> start of logd succeeded." +else + echo " -> start of logd failed." + echo " -> $test: TEST-FAIL" + exit +fi + +sleep 5 + +if ps aux | grep "[h]a_logd" +then + echo " -> get the process of logd." +else + echo " -> can't get the process of logd." + echo " -> $test: TEST-FAIL" +fi + +exec_service_on_target logd stop + +if ps aux | grep "[h]a_logd" +then + echo " -> $test: TEST-FAIL" +else + echo " -> $test: TEST-PASS" +fi diff --git a/engine/tests/Functional.demo/tests/demo_lvm2-monitor.sh b/engine/tests/Functional.demo/tests/demo_lvm2-monitor.sh new file mode 100644 index 0000000..8d27b98 --- /dev/null +++ b/engine/tests/Functional.demo/tests/demo_lvm2-monitor.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# In the target start lvm2-monitor, and confirm the process condition by command ps. + +test="lvm2-monitor" + +. ./fuego_board_function_lib.sh + +set_init_manager + +exec_service_on_target lvm2-monitor stop + +if exec_service_on_target lvm2-monitor start +then + echo " -> start of lvm2-monitor succeeded." + echo " -> $test: TEST-PASS" +else + echo " -> start of lvm2-monitor failed." + echo " -> $test: TEST-FAIL" +fi -- 1.8.3.1