From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Sony.onmicrosoft.com; s=selector2-Sony-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=noO7t9JOjomP6nmjz0IkH7FzM4Srp04MSLN+3NURN6s=; b=MnV5j2c5UQJBlxGi78lQ3UoaVb+1egIRbc6Qt2vTJ92jyZwcLViYoERt6pmS/Y11rdYy2HInRRidlz+n4hq+bv6ww0dsVcKdCXLiJc5b224a71G1IPmunlnADJuNCWkqHVe5Q3rgct6GKGSSTRSAUH32DMU0FI7Hk1AVIY5HMHo= From: Date: Sat, 21 Sep 2019 01:40:44 +0000 Message-ID: References: <1567559361-113472-1-git-send-email-wangmy@cn.fujitsu.com> <1567559361-113472-3-git-send-email-wangmy@cn.fujitsu.com> In-Reply-To: <1567559361-113472-3-git-send-email-wangmy@cn.fujitsu.com> Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [Fuego] [PATCH] nfs: Add test cases for nfs. List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: wangmy@cn.fujitsu.com, fuego@lists.linuxfoundation.org > -----Original Message----- > From: Wang Mingyu >=20 > This test set is used to check service(nfs-mountd/nfs-statd) and > commands(nfsiostat/nfsserver/nfsstat) of nfs. >=20 > Signed-off-by: Wang Mingyu > --- > tests/Functional.nfs/fuego_test.sh | 22 +++++ > tests/Functional.nfs/nfs_test.sh | 4 + > tests/Functional.nfs/spec.json | 7 ++ > tests/Functional.nfs/tests/nfs-mountd_ps.sh | 69 +++++++++++++++ > tests/Functional.nfs/tests/nfs-statd_ps.sh | 50 +++++++++++ > tests/Functional.nfs/tests/nfsiostat.sh | 60 +++++++++++++ > tests/Functional.nfs/tests/nfsserver_ps.sh | 96 +++++++++++++++++++++ > tests/Functional.nfs/tests/nfsstat.sh | 32 +++++++ > 8 files changed, 340 insertions(+) > create mode 100644 tests/Functional.nfs/fuego_test.sh > create mode 100755 tests/Functional.nfs/nfs_test.sh > create mode 100644 tests/Functional.nfs/spec.json > create mode 100644 tests/Functional.nfs/tests/nfs-mountd_ps.sh > create mode 100644 tests/Functional.nfs/tests/nfs-statd_ps.sh > create mode 100644 tests/Functional.nfs/tests/nfsiostat.sh > create mode 100644 tests/Functional.nfs/tests/nfsserver_ps.sh > create mode 100644 tests/Functional.nfs/tests/nfsstat.sh >=20 > diff --git a/tests/Functional.nfs/fuego_test.sh > b/tests/Functional.nfs/fuego_test.sh > new file mode 100644 > index 0000000..624c25f > --- /dev/null > +++ b/tests/Functional.nfs/fuego_test.sh > @@ -0,0 +1,22 @@ > +function test_pre_check { > + assert_has_program nfsstat > + assert_has_program nfsiostat > + assert_has_program rpc.nfsd > + assert_has_program rpc.statd > + assert_has_program rpc.mountd > +} > + > +function test_deploy { > + put $TEST_HOME/nfs_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ > + put $FUEGO_CORE/scripts/fuego_board_function_lib.sh > $BOARD_TESTDIR/fuego.$TESTDIR > + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ > +} > + > +function test_run { > + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ > + ./nfs_test.sh" > +} > + > +function test_processing { > + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" > +} > diff --git a/tests/Functional.nfs/nfs_test.sh > b/tests/Functional.nfs/nfs_test.sh > new file mode 100755 > index 0000000..dd5ce37 > --- /dev/null > +++ b/tests/Functional.nfs/nfs_test.sh > @@ -0,0 +1,4 @@ > +#!/bin/sh > +for i in tests/*.sh; do > + sh $i > +done > diff --git a/tests/Functional.nfs/spec.json b/tests/Functional.nfs/spec.j= son > new file mode 100644 > index 0000000..69a241c > --- /dev/null > +++ b/tests/Functional.nfs/spec.json > @@ -0,0 +1,7 @@ > +{ > + "testName": "Functional.nfs", > + "specs": { > + "default": {} > + } > +} > + > diff --git a/tests/Functional.nfs/tests/nfs-mountd_ps.sh > b/tests/Functional.nfs/tests/nfs-mountd_ps.sh > new file mode 100644 > index 0000000..c24345e > --- /dev/null > +++ b/tests/Functional.nfs/tests/nfs-mountd_ps.sh > @@ -0,0 +1,69 @@ > +#!/bin/sh > + > +# In the target start nfs-mountd, and confirm the process condition by > command ps. > + > +test=3D"nfs-mountd_ps" > + > +. ./fuego_board_function_lib.sh > + > +set_init_manager > + > +service_status=3D$(get_service_status nfs-mountd) > +exec_service_on_target nfs-mountd stop > + > +if [ -f /etc/exports ] > +then > + mv /etc/exports /etc/exports_bak > +fi > + > +touch /etc/exports > + > +restore_target() { > + if [ -f /etc/exports_bak ] > + then > + mv /etc/exports_bak /etc/exports > + else > + rm -f /etc/exports > + fi > +} > + > +if exec_service_on_target nfs-mountd start > +then > + echo " -> start of nfs-mountd succeeded." > +else > + echo " -> start of nfs-mountd failed." > + echo " -> $test: TEST-FAIL" > + restore_target > + exit > +fi > + > +sleep 5 > + > +if ps aux | grep "[/]usr/sbin/rpc.mountd" > +then > + echo " -> get the process of rpc.mountd." Different wording would be more clear here. Maybe "rpc.mountd process is running"? > +else > + echo " -> can't get the process of rpc.mountd." Maybe change to "rpc.mountd process is not running" > + echo " -> $test: TEST-FAIL" > + if [ "$service_status" =3D "inactive" ] > + then > + exec_service_on_target nfs-mountd stop > + fi > + restore_target > + exit > +fi > + > +exec_service_on_target nfs-mountd stop > + > +if ps aux | grep "[/]usr/sbin/rpc.mountd" > +then > + echo " -> $test: TEST-FAIL" > +else > + echo " -> $test: TEST-PASS" > +fi > + > +if [ "$service_status" =3D "active" -o "$service_status" =3D "unknown"] > +then > + exec_service_on_target nfs-mountd start > +fi > +restore_target > diff --git a/tests/Functional.nfs/tests/nfs-statd_ps.sh > b/tests/Functional.nfs/tests/nfs-statd_ps.sh > new file mode 100644 > index 0000000..43dc43b > --- /dev/null > +++ b/tests/Functional.nfs/tests/nfs-statd_ps.sh > @@ -0,0 +1,50 @@ > +#!/bin/sh > + > +# In the target start nfs-statd, and confirm the process condition by > command ps. > + > +test=3D"nfs-statd_ps" > + > +. ./fuego_board_function_lib.sh > + > +set_init_manager > + > +service_status=3D$(get_service_status nfs-statd) > +exec_service_on_target nfs-statd stop > + > +if exec_service_on_target nfs-statd start > +then > + echo " -> start of nfs-statd succeeded." > +else > + echo " -> start of nfs-statd failed." > + echo " -> $test: TEST-FAIL" > + exit > +fi > + > +sleep 5 > + > +if ps aux | grep "[/]usr/sbin/rpc.statd" > +then > + echo " -> get the process of rpc.statd." same here. I would like to see a more clear message. > +else > + echo " -> can't get the process of rpc.statd." > + echo " -> $test: TEST-FAIL" > + if [ "$service_status" =3D "inactive" ] > + then > + exec_service_on_target nfs-statd stop > + fi > + exit > +fi > + > +exec_service_on_target nfs-statd stop > + > +if ps aux | grep "[/]usr/sbin/rpc.statd" > +then > + echo " -> $test: TEST-FAIL" > +else > + echo " -> $test: TEST-PASS" > +fi > + > +if [ "$service_status" =3D "active" -o "$service_status" =3D "unknown" ] > +then > + exec_service_on_target nfs-statd start > +fi > diff --git a/tests/Functional.nfs/tests/nfsiostat.sh > b/tests/Functional.nfs/tests/nfsiostat.sh > new file mode 100644 > index 0000000..c1a683d > --- /dev/null > +++ b/tests/Functional.nfs/tests/nfsiostat.sh > @@ -0,0 +1,60 @@ > +#!/bin/sh > + > +# In the target run the command nfiosstat, and displays NFS client per- > mount statisitics.. > +# option : -a, -d, -h, -p, -s, --version > + > +test=3D"nfsiostat" > + > +if nfsiostat -a | grep "attribute cache" > +then > + echo " -> Display statistics related to the attribute cache succeede= d." > +else > + echo " -> Display statistics related to the attribute cache failed." > + echo " -> $test: TEST-FAIL" > + exit > +fi > + > +if nfsiostat -d | grep "lookup" > +then > + echo " -> Display statistics related to directory operations succeed= ed." > +else > + echo " -> Display statistics related to directory operations failed.= " > + echo " -> $test: TEST-FAIL" > + exit > +fi > + > +if nfsiostat -h | grep "Usage" > +then > + echo " -> Show help message succeeded." > +else > + echo " -> Show help message failed." > + echo " -> $test: TEST-FAIL" > + exit > +fi > + > +if nfsiostat -p | grep "page" > +then > + echo " -> Display statistics related to the page cache succeeded." > +else > + echo " -> Display statistics related to the page cache failed." > + echo " -> $test: TEST-FAIL" > + exit > +fi > + > + > +if nfsiostat -s | grep "ops" > +then > + echo " -> Sort NFS mount points by ops/second succeeded." > +else > + echo " -> Sort NFS mount points by ops/second failed." > + echo " -> $test: TEST-FAIL" > + exit > +fi > + > +if nfsiostat --version | grep "version" > +then > + echo " -> $test: TEST-PASS" > +else > + echo " -> Show version number failed." > + echo " -> $test: TEST-FAIL" > +fi > diff --git a/tests/Functional.nfs/tests/nfsserver_ps.sh > b/tests/Functional.nfs/tests/nfsserver_ps.sh > new file mode 100644 > index 0000000..ddb4483 > --- /dev/null > +++ b/tests/Functional.nfs/tests/nfsserver_ps.sh > @@ -0,0 +1,96 @@ > +#!/bin/sh > + > +# In the target start nfsserver, and confirm the process condition by > command ps. > + > +test=3D"nfsserver_ps" > + > +. ./fuego_board_function_lib.sh > + > +set_init_manager > + > +if [ "$init_manager" =3D "systemd" ] > +then > + service_name=3D"nfs-server" > +else > + service_name=3D"nfsserver" > +fi > + > +nfs_status=3D$(get_service_status $service_name) > + > +rpcbind_status=3D$(get_service_status rpcbind) > + > +exec_service_on_target $service_name stop > +exec_service_on_target rpcbind stop > + > +if [ -f /etc/exports ] > +then > + mv /etc/exports /etc/exports_bak > +fi > + > +touch /etc/exports > + > +restore_target() { > + if [ -f /etc/exports_bak ] > + then > + mv /etc/exports_bak /etc/exports > + else > + rm -f /etc/exports > + fi > +} > + > +exec_service_on_target rpcbind start > +if exec_service_on_target $service_name start > +then > + echo " -> start of nfsserver succeeded." > +else > + echo " -> start of nfsserver failed." > + echo " -> $test: TEST-FAIL" > + if [ "$rpcbind_status" =3D "inactive" ] > + then > + exec_service_on_target rpcbind stop > + fi > + restore_target > + exit > +fi > + > +sleep 5 > + > +if ps aux | grep "[\[]nfsd" > +then > + echo " -> get the process of nfsd." > +else > + echo " -> can't get the process of nfsd." > + echo " -> $test: TEST-FAIL" > + if [ "$rpcbind_status" =3D "inactive" ] > + then > + exec_service_on_target rpcbind stop > + fi > + if [ "$nfs_status" =3D "inactive" ] > + then > + exec_service_on_target $service_name stop > + fi > + restore_target > + exit > +fi > + > +exec_service_on_target rpcbind stop > +exec_service_on_target $service_name stop > + > +sleep 5 > + > +if ps aux | grep "[\[]nfsd" > +then > + echo " -> $test: TEST-FAIL" > +else > + echo " -> $test: TEST-PASS" > +fi > +restore_target > +if [ "$rpcbind_status" =3D "active" -o "$rpcbind_status" =3D "unknown" ] > +then > + exec_service_on_target rpcbind start > +fi > + > +if [ "$nfs_status" =3D "active" -o "$nfs_status" =3D "unknown" ] > +then > + exec_service_on_target $service_name start > +fi > diff --git a/tests/Functional.nfs/tests/nfsstat.sh > b/tests/Functional.nfs/tests/nfsstat.sh > new file mode 100644 > index 0000000..b579206 > --- /dev/null > +++ b/tests/Functional.nfs/tests/nfsstat.sh > @@ -0,0 +1,32 @@ > +#!/bin/sh > + > +# In the target run the command nfsstat, and display statistics kept ab= out > NFS client and server activity. line length too long. > +# option : -r, -c, -s > + > +test=3D"nfsstat" > + > +if nfsstat -c | grep "Client" > +then > + echo " -> Print only client-side statistics succeeded." > +else > + echo " -> Print only client-side statistics failed." > + echo " -> $test: TEST-FAIL" > + exit > +fi > + > +if nfsstat -r | grep "rpc" > +then > + echo " -> Print only RPC statistics succeeded." > +else > + echo " -> Print only RPC statistics failed." > + echo " -> $test: TEST-FAIL" > + exit > +fi > + > +if nfsstat -s | grep "Server" > +then > + echo " -> $test: TEST-PASS" > +else > + echo " -> Print only server-side statistics failed." > + echo " -> $test: TEST-FAIL" > +fi > -- > 2.17.1 This looks mostly OK. If you don't mind, I'm going to change a few of the echo lines to wording that I think is more clear, and maybe wrap some long lines of comments. Applied to the 'master' branch. Thanks, -- Tim