#1 initial commit of e2fsprogs tests from upstreamfirst project
Closed a year ago by mgahagan. Opened 2 years ago by mgahagan.
rpms/ mgahagan/e2fsprogs e2fsprogs-tests  into  master

file added
+3

@@ -0,0 +1,3 @@ 

+ #!/bin/bash

+ export TEST_DOCKER_EXTRA_ARGS="--privileged -v /dev:/dev"

+ exec merge-standard-inventory "$@"

@@ -0,0 +1,59 @@ 

+ # Copyright (c) 2017 Red Hat, Inc.

+ # 

+ # 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 3 of the License, or

+ # (at your option) any later version.

+ # 

+ # 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, see <http://www.gnu.org/licenses/>.

+ # 

+ # Author: Branislav Nater <bnater@redhat.com>

+ 

+ TOPLEVEL_NAMESPACE=

+ PACKAGE_NAME=e2fsprogs

+ RELATIVE_PATH=Regression/smoke-test

+ 

+ export TEST=/e2fsprogs/Regression/smoke-test

+ export TESTVERSION=1.0

+ 

+ BUILT_FILES=

+ 

+ FILES=$(METADATA) runtest.sh Makefile

+ 

+ .PHONY: all install download clean

+ 

+ run: $(FILES) build

+ 	./runtest.sh

+ 

+ build: $(BUILT_FILES)

+ 	chmod a+x ./runtest.sh

+ 

+ clean:

+ 	rm -f *~ $(BUILT_FILES)

+ 

+ 

+ include /usr/share/rhts/lib/rhts-make.include

+ 

+ 

+ $(METADATA): Makefile

+ 	@echo "Owner:           Branislav Nater <bnater@redhat.com>" > $(METADATA)

+ 	@echo "Name:            $(TEST)" >> $(METADATA)

+ 	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)

+ 	@echo "Path:            $(TEST_DIR)" >> $(METADATA)

+ 	@echo "Description:     This test intends to shortly test the basic functionality of e2fsprogs" >> $(METADATA)

+ 	@echo "Type:            Regression" >> $(METADATA)

+ 	@echo "TestTime:        2h" >> $(METADATA)

+ 	@echo "RunFor:          e2fsprogs" >> $(METADATA)

+ 	@echo "Requires:        e2fsprogs" >> $(METADATA)

+ 	@echo "Priority:        Normal" >> $(METADATA)

+ 	@echo "License:         GPLv3" >> $(METADATA)

+ 	@echo "Confidential:    no" >> $(METADATA)

+ 	@echo "Destructive:     no" >> $(METADATA)

+ 

+ 	rhts-lint $(METADATA)

@@ -0,0 +1,10 @@ 

+ Test Name: smoke-test

+ Author: Petr Muller <pmuller@redhat.com>

+ Location: /e2fsprogs/Regression/smoke-test

+ 

+ Short Description: This test intends to shortly test the basic functionality of e2fsprogs

+ 

+ 

+ Long Description:

+ 

+ This test intends to shortly test the basic functionality of e2fsprogs

@@ -0,0 +1,246 @@ 

+ #!/bin/bash

+ #

+ # Copyright (c) 2017 Red Hat, Inc.

+ # 

+ # 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 3 of the License, or

+ # (at your option) any later version.

+ # 

+ # 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, see <http://www.gnu.org/licenses/>.

+ # 

+ # Author: Branislav Nater <bnater@redhat.com>

+ 

+ PACKAGE=e2fsprogs

+ 

+ #rpm -q rhtslib --quiet || rpm -ihv http://nest.test.redhat.com/mnt/qa/scratch/pmuller/rhtslib/rhtslib.rpm

+ #. /usr/bin/rhts_environment.sh

+ . /usr/share/rhts-library/rhtslib.sh

+ 

+ rlJournalStart

+ 

+ rlPhaseStartSetup "Creating few loop devices with various filesystems"

+   LOOPDIR=`mktemp -d`

+   FAKE=$LOOPDIR/fake-disk

+   MOUNTPOINT=/tmp/testing-mountpoint

+   mkdir -p $MOUNTPOINT

+   rlRun "dd if=/dev/zero of=$FAKE count=50 bs=1024k" 0 "Creating $FAKE (50 MB)"

+   LOOP_DEV=`losetup -f`

+   rlRun "losetup $LOOP_DEV $FAKE" 0 "Assign $FAKE to $LOOP_DEV"

+   DEBUGFS=debugfs

+   RESIZEFS=resize2fs

+   DUMPFS=dumpe2fs

+   TUNEFS=tune2fs

+   FSCK=e2fsck

+   IMAGE=e2image

+   LABEL=e2label

+ rlPhaseEnd

+ 

+ debugfs_test(){

+   TARGET=$1

+   BLOCKSIZE="$2"

+   rlRun "$DEBUGFS $TARGET -R 'quit'"

+   rlRun "$DEBUGFS $TARGET -R 'quit' -w"

+   rlRun "$DEBUGFS $TARGET -R 'quit' -c"

+   rlRun "$DEBUGFS $TARGET -R 'quit' -cw"

+   if [ "$BLOCKSIZE" != "" ]

+   then

+     rlRun "$DEBUGFS $TARGET -R 'quit' $BLOCKSIZE"

+     rlRun "$DEBUGFS $TARGET -R 'quit' -w $BLOCKSIZE"

+     rlRun "$DEBUGFS $TARGET -R 'quit' -c $BLOCKSIZE"

+     rlRun "$DEBUGFS $TARGET -R 'quit' -cw $BLOCKSIZE"

+   fi

+   rlRun "$DEBUGFS -V"

+ }

+ 

+ dumpe2fs_test(){

+   TARGET=$1

+   BLOCKSIZE="${2:3}"

+   rlRun "$DUMPFS -b $TARGET"

+   rlRun "$DUMPFS -f $TARGET"

+   rlRun "$DUMPFS -b -f $TARGET"

+   rlRun "$DUMPFS -h $TARGET"

+   rlRun "$DUMPFS -x $TARGET"

+   rlRun "$DUMPFS -V"

+ }

+ 

+ e2fsck_test(){

+   TARGET=$1

+   for op0 in "-n" "-p" "-y"

+   do

+     for op1 in "" "-c" "-c -c" "-f" "-f -c" "-f -c -c" "-c -k" "-c -c -k" "-f -c -k" "-f -c -c -k"

+     do

+       for op2 in "" "-d" "-d -D" "-D"

+       do

+         for op3 in "" "-t" "-t -t" "-v" "-v -t" "-v -t -t"

+         do

+           # -n isn't compatible with -D

+           if echo "$op0 $op1 $op2 $op3" | grep -- "-n" | grep -q -- "-D"; then continue; fi

+           # -n isn't compatilble with -c

+           if echo "$op0 $op1 $op2 $op3" | grep -- "-n" | grep -q -- "-c"; then continue; fi

+ 

+           echo "$FSCK $TARGET $op0 $op1 $op2 $op3"

+           # options "-c" or "-f -D" will cause e2fsck returns 1

+           if echo "$op1" | grep -q -- "-c" || echo "$op0 $op1 $op2 $op3" | grep -- "-f" | grep -q -- "-D"

+           then

+                   rlRun "$FSCK $TARGET $op0 $op1 $op2 $op3 > /dev/null" 1

+           else

+                   rlRun "$FSCK $TARGET $op0 $op1 $op2 $op3 > /dev/null" 0

+           fi

+         done

+       done

+     done

+   done

+   rlRun "$FSCK -V"

+ }

+ 

+ e2image_test(){

+   TARGET=$1

+   fil=`mktemp`

+   f="f"

+ 

+   # -f option only supports on RHEL7 and e2fsprogs-1.41.12-20.el6 (6.6 and later)

+   if rlIsRHEL "<6.6"; then

+     f=""

+   fi

+ 

+   rlRun "$IMAGE $TARGET - >/dev/null"

+   rlRun "$IMAGE -r$f $TARGET - >/dev/null"

+ 

+   if rlIsRHEL 5

+   then

+     rlRun "$IMAGE -s $TARGET - >/dev/null"

+     rlRun "$IMAGE -rs $TARGET - >/dev/null"

+   fi

+ 

+   rlRun "$IMAGE $TARGET $fil"

+   rlRun "$IMAGE -r$f $TARGET $fil"

+   if rlIsRHEL 5

+   then

+     rlRun "$IMAGE -s $TARGET $fil"

+     rlRun "$IMAGE -rs $TARGET $fil"

+   fi

+ }

+ 

+ e2label_test(){

+   TARGET=$1

+   rlRun "$LABEL $TARGET mylabel" 0

+   rlAssertEquals "Testing the label was correctly set" "`$LABEL $TARGET`" "mylabel"

+ }

+ 

+ resize2fs_test(){

+   TARGET=$1

+   rlRun "$RESIZEFS $TARGET"

+   rlRun "$RESIZEFS $TARGET rd" 1

+   rlRun "$RESIZEFS $TARGET 30M"

+   if [ "$FSTYPE" != "ext4" ]; then

+     # ext4 with 4k block size require min size > 20M

+     rlRun "$RESIZEFS $TARGET 20M"

+     rlRun "$RESIZEFS $TARGET 10M"

+   fi

+   rlRun "$RESIZEFS $TARGET 50M"

+   rlRun "$RESIZEFS $TARGET 30M"

+   rlRun "$RESIZEFS $TARGET 50M"

+   for fl0 in "" "-d 1" "-F" "-d 1 -F"

+   do

+     for fl1 in "" "-p" "-f" "-p -f"

+     do

+       rlRun "$RESIZEFS $TARGET 30M $fl0 $fl1"

+       rlRun "$RESIZEFS $TARGET 50M $fl0 $fl1"

+     done

+   done

+ }

+ 

+ tune2fs_test(){

+   TARGET=$1

+   MNT=$2

+   rlRun "$TUNEFS -c 100 $TARGET"

+   rlRun "$TUNEFS -C 100 $TARGET"

+   rlRun "$TUNEFS -c bogus $TARGET" 1

+   rlRun "$TUNEFS -C bogus $TARGET" 1

+ 

+   for t in d m w

+   do

+     rlRun "$TUNEFS -i 2$t $TARGET" 0

+     if rlIsRHEL 5

+     then

+       rlRun "$TUNEFS -i 9999999999$t $TARGET" 0

+     fi

+     rlRun "$TUNEFS -i 0$t $TARGET" 0

+   done

+   rlRun "$TUNEFS -i bogus $TARGET" 1

+   rlRun "$TUNEFS -l $TARGET" 0

+   rlRun "$TUNEFS -L tune2 $TARGET" 0

+   rlAssertEquals "Checking if label was set correctly" `$LABEL $TARGET` "tune2"

+   rlRun "$TUNEFS -m 10 $TARGET" 0

+   rlRun "$TUNEFS -m 5 $TARGET" 0

+   rlRun "$TUNEFS -M /root $TARGET" 0

+   rlRun "$TUNEFS -M $MNT $TARGET" 0

+   rlRun "$TUNEFS -r 1000 $TARGET" 0

+   rlRun "$TUNEFS -T now $TARGET" 0

+   rlRun "$TUNEFS -T 20081212 $TARGET" 0

+   rlRun "$TUNEFS -T 20081212121212 $TARGET" 0

+   rlRun "$TUNEFS -u root $TARGET" 0

+   umount $TARGET

+   # It refuses to run '$TUNEFS -U clear $TARGET' without do fsck first.

+   $FSCK -fy $TARGET > /dev/null

+   original="`$TUNEFS -l $TARGET | grep UUID`"

+   rlRun "$TUNEFS -U clear $TARGET" 0

+   rlAssertNotEquals "Check the UUID was cleared" "$original" "`$TUNEFS -l $TARGET | grep UUID`"

+   original="`$TUNEFS -l $TARGET | grep UUID`"

+   rlRun "$TUNEFS -U random $TARGET" 0

+   rlAssertNotEquals "Check the UUID was randomed" "$original" "`$TUNEFS -l $TARGET | grep UUID`"

+   original="`$TUNEFS -l $TARGET | grep UUID`"

+   rlRun "$TUNEFS -U time $TARGET" 0

+   rlAssertNotEquals "Check the UUID was changed to time-based" "$original" "`$TUNEFS -l $TARGET | grep UUID`"

+   if [ "$FSTYPE" == "ext4" ]; then

+     mount $TARGET $MNT

+   fi

+ }

+ 

+ for fs in ext2 ext3 ext4; do

+   export FSTYPE=$fs

+   if rlIsRHEL 5 && [ "$fs" == "ext4" ]; then

+     export DEBUGFS=debuge4fs

+     export RESIZEFS=resize4fs

+     export DUMPFS=dumpe4fs

+     export TUNEFS=tune4fs

+     export FSCK=e4fsck

+     export IMAGE=e4image

+     export LABEL=e4label

+   fi

+   for additional in "" "-b 1024" "-b 2048" "-b 4096"

+   do

+     rlPhaseStartTest "Testing on $fs with blocksize $additional"

+       rlRun "mkfs -F -t $fs $additional $LOOP_DEV" 0

+       mount $LOOP_DEV $MOUNTPOINT

+       debugfs_test $LOOP_DEV "$additional"

+       dumpe2fs_test $LOOP_DEV "$additional"

+       e2image_test $LOOP_DEV

+       e2label_test $LOOP_DEV

+       tune2fs_test $LOOP_DEV $MOUNTPOINT

+       umount $MOUNTPOINT; sleep 10

+       rlRun "$FSCK -f -y $LOOP_DEV" 0,1,2

+       resize2fs_test $LOOP_DEV

+       e2fsck_test $LOOP_DEV

+     rlPhaseEnd

+   done

+ done

+ 

+ 

+ rlPhaseStartCleanup

+   losetup -d $LOOP_DEV

+   rm -rf $FAKE $MOUNTPOINT

+   rlAssertNotExists $FAKE

+   rlAssertNotExists $MOUNTPOINT

+ #  rlCreateLogFromJournal > $OUTPUTFILE

+ rlPhaseEnd

+ 

+ rlJournalPrintText

+ rlJournalEnd

file added
+33

@@ -0,0 +1,33 @@ 

+ ---

+ # Tests suitable to run in a classic environment

+ - hosts: localhost

+   tags:

+   - classic

+   roles:

+   - role: standard-test-beakerlib

+     tests:

+     - smoke-test

+     required_packages:

+     - e2fsprogs

+ 

+ # Tests suitable to run in a docker environment

+ - hosts: localhost

+   tags:

+   - container

+   roles:

+   - role: standard-test-beakerlib

+     tests:

+     - smoke-test

+     required_packages:

+     - e2fsprogs

+ 

+ # Tests suitable to run in an Atomic Host environment

+ - hosts: localhost

+   tags:

+   - atomic

+   roles:

+   - role: standard-test-beakerlib

+     tests:

+     - smoke-test

+     required_packages:

+     - e2fsprogs

Adds tests according to the CI wiki [0] specifically the standard test interface in the spec [1].

The playbook includes Tier1 level test cases that have been tested in the following contexts and is passing reliably: Atomic Host, Docker, and Classic.
Test logs are stored in the artifacts directory.

The following steps are used to execute the tests using the standard test interface:

Atomic
sudo ANSIBLE_INVENTORY=$(test -e inventory && echo inventory || echo /usr/share/ansible/inventory) TEST_SUBJECTS=../atomic.qcow2 TEST_ARTIFACTS=$PWD/artifacts ansible-playbook --tags atomic tests.yml

Docker
sudo ANSIBLE_INVENTORY=$(test -e inventory && echo inventory || echo /usr/share/ansible/inventory) TEST_SUBJECTS=docker:docker.io/library/fedora:26 TEST_ARTIFACTS=$PWD/artifacts ansible-playbook --tags container tests.yml

Classic
sudo ANSIBLE_INVENTORY=$(test -e inventory && echo inventory || echo /usr/share/ansible/inventory) TEST_SUBJECTS="" TEST_ARTIFACTS=$PWD/artifacts ansible-playbook --tags classic tests.yml

[0] https://fedoraproject.org/wiki/CI
[1] https://fedoraproject.org/wiki/Changes/InvokingTests

Sorry for the late reply; I'm a little confused by this. e2fsprogs has regression tests built in, upstream, and they are run at build time.

I need to look at this PR more closely but it seems to be a bunch of new hand-rolled, custom tests. What is the advantage to merging a new test infrastructure, vs. updating the existing regression tests built into the upstream project?

Hi,

I spoke with the filesystem QE maintainer for e2fsprogs and he thinks the upstream regression tests already cover the cases in the smoke test. He said any future regression tests they come up with he can submit upstream. Is Fedora dist-git fine for this or would you rather have test updates go into a different upstream repo? In either case I think we can close out this PR as it is not needed.

Pull-Request has been closed by mgahagan

a year ago