gating: import the fuse3 gating test and merge internal/public plans.

Resolves: RHELMISC-7595

Signed-off-by: Boyang Xue <bxue@redhat.com>
This commit is contained in:
Boyang Xue 2024-11-27 14:08:39 +08:00
parent 8a1e37bf38
commit 8d57ebc5c7
12 changed files with 303 additions and 88 deletions

2
ci.fmf
View File

@ -1,2 +0,0 @@
resultsdb-testcase: separate

View File

@ -1,7 +1,5 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/internal.functional}
- !PassingTestCaseRule {test_case_name: osci.brew-build./plans/public.functional}
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -1,4 +1,4 @@
summary: Public fuse3 gating test
summary: fuse3 gating test
execute:
how: tmt
discover:

View File

@ -1,20 +0,0 @@
summary: Private (RHEL) fuse3 gating test
enabled: false
adjust:
- when: distro == rhel
enabled: true
because: private tests are accesible only within rhel pipline
discover:
- name: rhel-fuse3
how: fmf
url: https://gitlab.cee.redhat.com/kernel-qe/kernel.git
test: [
"filesystems/fuse/gating/fuse3",
]
environment:
FSTYP: ext4
TEST_GROUP: fuse3
AVC_ERROR: +no_avc_check
execute:
how: tmt

View File

@ -1,60 +1,79 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of fuse3-sanity-test
# Description: fuse3-sanity-test
# Author: Boyang Xue <bxue@redhat.com>
# Makefile of /kernel/filesystems/fuse/gating/fuse3
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2024 Red Hat, Inc.
# Copyright (c) 2022 Red Hat, Inc. All rights reserved.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
# 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.
# 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, see http://www.gnu.org/licenses/.
# 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Author and description of the test
AUTHOR=Zorro Lang <zlang@redhat.com>
DESCRIPTION=The gating test case of fuse3
# The name of the test.
export TEST=/kernel/filesystems/fuse/gating/fuse3
export TESTVERSION=0.1
FILES=$(METADATA) runtest.sh Makefile PURPOSE
# Version of the test. Used with make tag.
export TESTVERSION=1.0
.PHONY: all install download clean
# data files, .c files, scripts anything needed to either compile the test and/or run it.
FILES=$(METADATA) runtest.sh PURPOSE config
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
build: $(BUILT_FILES) $(FILES)
chmod a+x ./runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
rm -f *~
# Include Common Makefile
include /usr/share/rhts/lib/rhts-make.include
# Generate the testinfo.desc here:
$(METADATA): Makefile
@echo "Owner: Boyang Xue <bxue@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: fuse3-sanity-test" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 15m" >> $(METADATA)
@echo "RunFor: fuse3" >> $(METADATA)
@echo "Requires: fuse3-libs" >> $(METADATA)
@echo "Requires: fuse3-devel" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Owner: $(AUTHOR)" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: $(DESCRIPTION)" >> $(METADATA)
@echo "TestTime: 2h" >> $(METADATA)
@echo "RunFor: fuse3" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "Requires: fuse3" >> $(METADATA)
@echo "Requires: fuse3-devel" >> $(METADATA)
@echo "Requires: fuse3-libs" >> $(METADATA)
@echo "Requires: rpm-build" >> $(METADATA)
@echo "Requires: gcc" >> $(METADATA)
@echo "Requires: gcc-c++" >> $(METADATA)
@echo "Requires: autoconf" >> $(METADATA)
@echo "Requires: automake" >> $(METADATA)
@echo "Requires: gettext-devel" >> $(METADATA)
@echo "Requires: libselinux-devel" >> $(METADATA)
@echo "Requires: libtool" >> $(METADATA)
@echo "Requires: meson" >> $(METADATA)
@echo "Requires: ninja-build" >> $(METADATA)
@echo "Requires: yum-utils" >> $(METADATA)
@echo "Requires: redhat-lsb-core" >> $(METADATA)
@echo "Requires: python3-pip" >> $(METADATA)
rhts-lint $(METADATA)
# The include package trys to install all the potential dependencies.
# Not each them are available on all RHEL old/new systems.

View File

@ -1,5 +1,3 @@
PURPOSE of fuse3-sanity-test
Description: fuse3-sanity-test
Author: Boyang Xue <bxue@redhat.com>
Description:
Note:
This's a simple gating test case for fuse-3.x.

View File

@ -0,0 +1,2 @@
# The cuse module isn't loaded by default, so don't run cuse related test at here.
not cuse

View File

@ -0,0 +1,4 @@
# The cuse module isn't loaded by default, so don't run cuse related test at here.
# passthrough_ll[True-True] always fails as "[Errno 38] Function not implemented"
# passthrough_ll[False-True] sometimes fails as "[Errno 38] Function not implemented"
not test_passthrough_ll[True-True] and not test_passthrough_ll[False-True] and not cuse

View File

@ -0,0 +1,2 @@
# The cuse module isn't loaded by default, so don't run cuse related test at here.
not cuse

View File

@ -0,0 +1,3 @@
# The cuse module isn't loaded by default, so don't run cuse related test at here.
# The passthrough test isn't stable, always fail. So skip it for gating test
not passthrough and not cuse

View File

@ -1,12 +1,26 @@
summary: fuse3-sanity-test
description: |
Note:
contact: Boyang Xue <bxue@redhat.com>
summary: The gating test case of fuse3
description: This's a simple gating test case for fuse-3.x.
contact: Zorro Lang <zlang@redhat.com>
component:
- fuse3
test: ./runtest.sh
framework: beakerlib
framework: shell
recommend:
- fuse3-libs
- fuse3
- fuse3-devel
duration: 15m
- fuse3-libs
- rpm-build
- gcc
- gcc-c++
- autoconf
- automake
- gettext-devel
- libselinux-devel
- libtool
- meson
- ninja-build
- yum-utils
- redhat-lsb-core
- python3-pip
- beakerlib
duration: 2h

View File

@ -1,37 +1,234 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of fuse3-sanity-test
# Description: fuse3-sanity-test
# Author: Boyang Xue <bxue@redhat.com>
# Description: Run for fuse-3.x CI gating test
# Author: Zorro Lang <zlang@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2024 Red Hat, Inc.
# Copyright (c) 2022 Red Hat, Inc. All rights reserved.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
# 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.
# 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, see http://www.gnu.org/licenses/.
# 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.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
set -o pipefail
status=1
trap "cleanup;" 0 1 2 3 9 15
rlJournalStart
rlPhaseStartTest Test
rlRun "fusermount3 --version"
rlPhaseEnd
rlJournalEnd
# Enable all repos by default, to try our best to get some packages
YUM_PROG="yum --enablerepo=*"
WORK_DIR=`pwd`
# test exits here
cleanup()
{
if [ $status -eq 0 ];then
_report "CLEAN" PASS
else
_report "CLEAN" FAIL
fi
exit $status
}
if [ -z "$RECIPEID" -o -z "$TASKID" ]; then
OUTPUTFILE=`pwd`/output.log
fi
function echoo()
{
echo $@ | tee -a $OUTPUTFILE
}
# Wrapper to log the output of the command
function xlog()
{
echoo "$@"
$@ 2>&1 | tee -a $OUTPUTFILE
return $?
}
# Wrapper to report_result, clears $OUTPUTFILE
function _report()
{
local what="$FSTYP:$1"
local status="$2"
local score="$3"
test -z "$score" && score=0
echoo "---------------------------------------------"
echoo -e "|Report:\t" "$what\t" "$status\t" "$score|"
echoo "---------------------------------------------"
rhts-report-result "$what" "$status" "$OUTPUTFILE" "$score"
if [ -f "$OUTPUTFILE" ];then
rm -f $OUTPUTFILE
touch $OUTPUTFILE
fi
}
function prepare_test()
{
local pkgname
local specfile
echoo "* Get building and running dependences"
$YUM_PROG install -y --nogpgcheck fuse3 fuse3-libs fuse3-devel rpm-build gcc \
autoconf automake gettext-devel libselinux-devel libtool yum-utils \
python3 gcc-c++ python3-pip meson ninja-build
echoo "* Get fuse3 srpm"
rm -rf downloaddir
mkdir downloaddir
pushd downloaddir
rlFetchSrcForInstalled fuse3
if [ $? -ne 0 ];then
_report prepare_test:download FAIL
exit 1
fi
echoo "* Install fuse3 srpm"
pkgname=$(ls *.src.rpm 2>/dev/null | head -1)
echoo "Install $pkgname ..."
rpm -ivh $pkgname
specfile=`rpm -ql $pkgname 2>/dev/null | grep .spec`
specfile="$(ls ~/rpmbuild/SPECS/$specfile 2>/dev/null)"
popd
if [ ! -f "$specfile" ];then
_report prepare_test:specfile FAIL
exit 1
fi
echoo "* Unpack and patch fuse3 source"
FUSE3_BUILD_DIR=`rpmbuild --eval %{_builddir}`
# Remove all old build directory, to avoid they affect later testing.
rm -rf $FUSE3_BUILD_DIR/*fuse*
rpmbuild -bp $specfile
if [ $? -eq 0 ];then
FUSE3_BUILD_DIR=`realpath $FUSE3_BUILD_DIR/* | head -n 1`
else
# unset FUSE3_BUILD_DIR to stop later testing, if rpmbuild fails
unset FUSE3_BUILD_DIR
fi
echoo "FUSE3_BUILD_DIR = $FUSE3_BUILD_DIR"
if [ ! -d "$FUSE3_BUILD_DIR" ];then
_report prepare_test:fuse3_unpack FAIL
exit 1
fi
echoo "* Build fuse3 source locally"
pushd $FUSE3_BUILD_DIR
rm -rf build
mkdir build
pushd build
meson .. && ninja
if [ $? -ne 0 ];then
echoo "build fuse3 failed!"
_report prepare_test:fuse3_build FAIL
exit 1
fi
popd
popd
echoo "* Get pytest and looseversion"
which pip3 && which python3
if [ $? -ne 0 ];then
echoo "missing pip3 or python3"
_report prepare_test:python FAIL
exit 1
fi
if ! pip3 install pytest;then
echoo "install pytest failed!"
_report prepare_test:pytest FAIL
exit 1
fi
if ! pip3 install looseversion;then
echoo "install looseversion failed!"
_report prepare_test:looseversion FAIL
exit 1
fi
_report prepare_test PASS
}
function do_test()
{
local rc=0
local ver="DEFAULT"
local expression
local logfile="$WORK_DIR/pytest.log"
local nfail=0
local npass=0
pushd $FUSE3_BUILD_DIR/build
if [ -f ./util/fusermount3 ];then
chown root:root util/fusermount3
chmod 4755 util/fusermount3
ver=`./util/fusermount3 -V|awk '{print $3}'`
fi
if [ ! -f "$WORK_DIR/config/$ver" ];then
ver="DEFAULT"
fi
expression=`cat $WORK_DIR/config/$ver|grep -v ^#`
# remove -x option of pytest, avoid the test exits instantly on first
# error
sed -i /addopts/s/-x// test/pytest.ini
if [ -n "$expression" ];then
echoo "python3 -m pytest -k \"$expression\" test"
python3 -m pytest -k "$expression" test 2>&1 | tee $logfile
else
echoo "python3 -m pytest test"
python3 -m pytest test 2>&1 | tee $logfile
fi
rc=$?
popd
tail -1 $logfile
if [ $rc -eq 0 ];then
if ( tail -1 $logfile | grep -q failed);then
nfail=`tail -1 $logfile | sed -n 's/.* \([0-9]\+\) failed.*/\1/p'`
fi
if ( tail -1 $logfile | grep -q passed);then
npass=`tail -1 $logfile | sed -n 's/.* \([0-9]\+\) passed.*/\1/p'`
fi
else
echoo "pytest failed, please check the log file"
_report do_test:pytest FAIL
exit 1
fi
if [ "$nfail" != "0" ];then
_report do_test:$npass:$nfail FAIL
exit 1
elif [ "$npass" == "0" ];then
echoo "If there's not PASSED test, must be something wrong"
_report do_test:nopass FAIL
exit 1
else
_report do_test:$npass:$nfail PASS
fi
return 0
}
prepare_test
do_test
status=0
exit 0