forked from cki-project/tests-beaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Vector Li <[email protected]>
Showing
7 changed files
with
347 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2019 Red Hat, Inc. All rights reserved. | ||
# | ||
# This copyrighted material is made available to anyone wishing | ||
# to use, modify, copy, or redistribute it subject to the terms | ||
# and conditions of the GNU General Public License version 2. | ||
# | ||
# This program is distributed in the hope that it will be | ||
# useful, but WITHOUT ANY WARRANTY; without even the implied | ||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
# PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public | ||
# License along with this program; if not, write to the Free | ||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
# Boston, MA 02110-1301, USA. | ||
# | ||
|
||
source /usr/bin/rhts_environment.sh | ||
source /usr/share/beakerlib/beakerlib.sh | ||
|
||
# | ||
# A simple wrapper function to skip a test because beakerlib doesn't support | ||
# such an important feature, right here we just leverage 'rhts'. Note we | ||
# don't call function report_result() as it directly invoke command | ||
# rhts-report-result actually | ||
# | ||
function rlSkip | ||
{ | ||
rlLog "Skipping test because $*" | ||
rhts-report-result "$TEST" SKIP "$OUTPUTFILE" | ||
|
||
# | ||
# As we want result="Skip" status="Completed" for all scenarios, right here | ||
# we always exit 0, otherwise the test will skip/abort | ||
# | ||
exit 0 | ||
} | ||
|
||
# | ||
# A simple wrapper function to skip a test | ||
# | ||
function rlAbort | ||
{ | ||
rlLog "Aborting test because $*" | ||
rhts-report-result "$TEST" ABORTED "$OUTPUTFILE" | ||
rhts-abort -t recipe | ||
exit 1 | ||
} | ||
|
||
function tc_hook_init | ||
{ | ||
g_startup_hook=${1?"*** startup hook, e.g. startup"} | ||
g_cleanup_hook=${2?"*** cleanup hook, e.g. cleanup"} | ||
g_runtest_hook=${3?"*** runtest hook, e.g. runtest"} | ||
} | ||
|
||
function tc_hook_fini | ||
{ | ||
unset g_startup_hook | ||
unset g_cleanup_hook | ||
unset g_runtest_hook | ||
} | ||
|
||
function _startup | ||
{ | ||
rlPhaseStartSetup | ||
[[ -n $g_startup_hook ]] && eval $g_startup_hook | ||
rlPhaseEnd | ||
} | ||
|
||
function _cleanup | ||
{ | ||
rlPhaseStartCleanup | ||
[[ -n $g_cleanup_hook ]] && eval $g_cleanup_hook | ||
rlPhaseEnd | ||
} | ||
|
||
function _runtest | ||
{ | ||
rlPhaseStartTest | ||
[[ -n $g_runtest_hook ]] && eval $g_runtest_hook | ||
rlPhaseEnd | ||
} | ||
|
||
function tc_main | ||
{ | ||
rlJournalStart | ||
_startup | ||
_runtest | ||
_cleanup | ||
rlJournalEnd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2019 Red Hat, Inc. All rights reserved. | ||
# | ||
# This copyrighted material is made available to anyone wishing | ||
# to use, modify, copy, or redistribute it subject to the terms | ||
# and conditions of the GNU General Public License version 2. | ||
# | ||
# This program is distributed in the hope that it will be | ||
# useful, but WITHOUT ANY WARRANTY; without even the implied | ||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
# PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public | ||
# License along with this program; if not, write to the Free | ||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
# Boston, MA 02110-1301, USA. | ||
# | ||
|
||
function _initPS4 | ||
{ | ||
export PS4='__DEBUG__: [${FUNCNAME}@${BASH_SOURCE}:${LINENO}|${SECONDS}]+ ' | ||
} | ||
|
||
function DEBUG | ||
{ | ||
typeset -l s=$DEBUG | ||
[[ $s == "yes" || $s == "true" ]] && _initPS4 && set -x | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2019 Red Hat, Inc. All rights reserved. | ||
# | ||
# This copyrighted material is made available to anyone wishing | ||
# to use, modify, copy, or redistribute it subject to the terms | ||
# and conditions of the GNU General Public License version 2. | ||
# | ||
# This program is distributed in the hope that it will be | ||
# useful, but WITHOUT ANY WARRANTY; without even the implied | ||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
# PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public | ||
# License along with this program; if not, write to the Free | ||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
# Boston, MA 02110-1301, USA. | ||
# | ||
|
||
source /usr/share/beakerlib/beakerlib.sh | ||
source $(dirname $(readlink -f $BASH_SOURCE))/libbkrm.sh | ||
|
||
STQE_GIT="https://gitlab.com/rh-kernel-stqe/python-stqe.git" | ||
STQE_STABLE_VERSION=${STQE_STABLE_VERSION:-"ad38f15"} | ||
LIBSAN_STABLE_VERSION=${LIBSAN_STABLE_VERSION:-"0.3.0"} | ||
|
||
function stqe_get_fwroot | ||
{ | ||
typeset fwroot="/var/tmp/$(basename $STQE_GIT | sed 's/.git//')" | ||
echo $fwroot | ||
} | ||
|
||
function stqe_init_fwroot | ||
{ | ||
typeset fwbranch=$1 | ||
|
||
# clone the framework | ||
typeset fwroot=$(stqe_get_fwroot) | ||
rlRun "rm -rf $fwroot" | ||
rlRun "git clone $STQE_GIT $fwroot" || rlAbort "fail to clone $STQE_GIT" | ||
|
||
# install the framework | ||
pushd "." && rlRun "cd $fwroot" | ||
|
||
if [[ $fwbranch != "master" ]]; then | ||
if [[ -n $STQE_STABLE_VERSION ]]; then | ||
rlRun "git checkout $STQE_STABLE_VERSION" || \ | ||
rlAbort "fail to checkout $STQE_STABLE_VERSION" | ||
fi | ||
if [[ -n $LIBSAN_STABLE_VERSION ]]; then | ||
rlRun "pip3 install libsan==$LIBSAN_STABLE_VERSION" || \ | ||
rlAbort "fail to install libsan==$LIBSAN_STABLE_VERSION" | ||
fi | ||
fi | ||
|
||
rlRun "python3 setup.py install --prefix=" || \ | ||
rlAbort "fail to install test framework" | ||
|
||
popd | ||
|
||
return 0 | ||
} | ||
|
||
function stqe_fini_fwroot | ||
{ | ||
typeset fwroot=$(stqe_get_fwroot) | ||
rlRun "rm -rf $fwroot" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# | ||
# Copyright (c) 2019 Red Hat, Inc. All rights reserved. | ||
# | ||
# This copyrighted material is made available to anyone wishing | ||
# to use, modify, copy, or redistribute it subject to the terms | ||
# and conditions of the GNU General Public License version 2. | ||
# | ||
# This program is distributed in the hope that it will be | ||
# useful, but WITHOUT ANY WARRANTY; without even the implied | ||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
# PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public | ||
# License along with this program; if not, write to the Free | ||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
# Boston, MA 02110-1301, USA. | ||
# | ||
|
||
export TEST=/kernel/storage/iscsi/params | ||
export TESTVERSION=1.0 | ||
|
||
BUILT_FILES= runtest | ||
|
||
FILES=$(METADATA) runtest.sh Makefile README.md | ||
|
||
.PHONY: all install download clean | ||
|
||
run: $(FILES) build | ||
./runtest | ||
|
||
runtest: runtest.sh | ||
cp $< $@ && chmod +x $@ | ||
|
||
build: $(BUILT_FILES) | ||
|
||
clean: | ||
|
||
clobber: clean | ||
rm -f *~ $(BUILT_FILES) | ||
cl: clobber | ||
|
||
include /usr/share/rhts/lib/rhts-make.include | ||
|
||
$(METADATA): Makefile | ||
@echo "Owner: Filip Suba <[email protected]>" > $(METADATA) | ||
@echo "Name: $(TEST)" >> $(METADATA) | ||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA) | ||
@echo "Path: $(TEST_DIR)" >> $(METADATA) | ||
@echo "Description: iSCSI parameters testing" >> $(METADATA) | ||
@echo "Type: Functional" >> $(METADATA) | ||
@echo "TestTime: 30m" >> $(METADATA) | ||
@echo "RunFor: kernel" >> $(METADATA) | ||
@echo "Requires: git" >> $(METADATA) | ||
@echo "Requires: augeas" >> $(METADATA) | ||
@echo "Requires: python3" >> $(METADATA) | ||
@echo "Requires: python2-lxml" >> $(METADATA) | ||
@echo "Requires: python3-lxml" >> $(METADATA) | ||
@echo "RepoRequires: storage/include" >> $(METADATA) | ||
@echo "Priority: Normal" >> $(METADATA) | ||
@echo "License: GPLv2" >> $(METADATA) | ||
@echo "Confidential: no" >> $(METADATA) | ||
@echo "Destructive: no" >> $(METADATA) | ||
|
||
rhts-lint $(METADATA) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
PURPOSE of /kernel/storage/iscsi/params | ||
|
||
DESCRIPTION: This test randomly generates values for following iSCSI parameters | ||
[ | ||
'HeaderDigest', | ||
'MaxRecvDataSegmentLength', | ||
'MaxXmitDataSegmentLength', | ||
'FirstBurstLength', | ||
'MaxBurstLength', | ||
'ImmediateData', | ||
'InitialR2T' | ||
] | ||
And | ||
o applies generated values to both initiator and local LIO target | ||
o establishes iSCSI session | ||
o prints negotiated values | ||
o do IO with data verification using fio | ||
|
||
If you'd like to check values manually, please try: | ||
# iscsiadm -m session -P2 | grep HeaderDigest | cut -d " " -f 2 | ||
# cat /sys/class/iscsi_connection/connection*/header_digest | ||
# cat /sys/class/iscsi_session/session*/first_burst_len | ||
|
||
NOTES: | ||
This test is using python-libsan and python-stqe. python-libsan is listed | ||
in python-stqe dependencies in setup.py, so we need to clone just | ||
python-stqe from gitlab and install it. Package 'Augeas' is required by | ||
python-stqe. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# storage/iscsi/params suite | ||
storage/iscsi/params provides parameters testing for iSCSI. The source code | ||
can be found at https://gitlab.com/rh-kernel-stqe/python-stqe. | ||
Test Maintainer: [Filip Suba](mailto:[email protected]) | ||
|
||
## How to run it | ||
|
||
### Dependencies | ||
Please refer to the top-leve README.md for common dependencies. Test-specific | ||
dependencies will automatically be installed when executing 'make run'. | ||
|
||
### Execute the test | ||
```bash | ||
$ make run | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (c) 2019 Red Hat, Inc. All rights reserved. | ||
# | ||
# This copyrighted material is made available to anyone wishing | ||
# to use, modify, copy, or redistribute it subject to the terms | ||
# and conditions of the GNU General Public License version 2. | ||
# | ||
# This program is distributed in the hope that it will be | ||
# useful, but WITHOUT ANY WARRANTY; without even the implied | ||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
# PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public | ||
# License along with this program; if not, write to the Free | ||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
# Boston, MA 02110-1301, USA. | ||
# | ||
|
||
FILE=$(readlink -f ${BASH_SOURCE}) | ||
NAME=$(basename $FILE) | ||
CDIR=$(dirname $FILE) | ||
|
||
source ${CDIR%/storage/iscsi/*}/storage/include/libdebug.sh | ||
source ${CDIR%/storage/iscsi/*}/storage/include/libbkrm.sh | ||
source ${CDIR%/storage/iscsi/*}/storage/include/libstqe.sh | ||
|
||
function startup | ||
{ | ||
stqe_init_fwroot "master" | ||
} | ||
|
||
function cleanup | ||
{ | ||
stqe_fini_fwroot | ||
} | ||
|
||
function runtest | ||
{ | ||
typeset fwroot=$(stqe_get_fwroot) | ||
pushd "." && rlRun "cd $fwroot" | ||
rlRun "stqe-test run -t iscsi/iscsi_params.py" | ||
popd | ||
} | ||
|
||
DEBUG | ||
tc_hook_init startup cleanup runtest | ||
tc_main | ||
tc_hook_fini |