[OS-BUILD PATCH 2/3] redhat/self-test: Reformat tests to kernel standard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

redhat/self-test: Reformat tests to kernel standard

Reformat the tests to kernel standard.

Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>

diff --git a/redhat/self-test/0001-shellcheck.bats b/redhat/self-test/0001-shellcheck.bats
index blahblah..blahblah 100644
--- a/redhat/self-test/0001-shellcheck.bats
+++ b/redhat/self-test/0001-shellcheck.bats
@@ -2,9 +2,8 @@
 # Purpose: This test runs shellcheck on all .sh files in the redhat directory.
 
 @test "shellcheck" {
-    if ! test -x /usr/bin/shellcheck
-    then
-        skip "The ShellCheck package is not installed"
-    fi
-    shellcheck $(find $BATS_TEST_DIRNAME/.. -name "*.sh" -not -path "$BATS_TEST_DIRNAME/../rpm/*")
+	if ! test -x /usr/bin/shellcheck; then
+		skip "The ShellCheck package is not installed"
+	fi
+	shellcheck $(find $BATS_TEST_DIRNAME/.. -name "*.sh" -not -path "$BATS_TEST_DIRNAME/../rpm/*")
 }
diff --git a/redhat/self-test/1001-rpmlint.bats b/redhat/self-test/1001-rpmlint.bats
index blahblah..blahblah 100644
--- a/redhat/self-test/1001-rpmlint.bats
+++ b/redhat/self-test/1001-rpmlint.bats
@@ -2,20 +2,19 @@
 # Purpose: This test runs rpmlint on the source rpm.
 
 @test "rpmlint" {
-    if ! test -x /usr/bin/rpmlint
-    then
-        skip "The rpmlint package is not installed"
-    else
-        skip "Skip rpmlint test pending kernel.spec.template changes"
-    fi
+	if ! test -x /usr/bin/rpmlint; then
+		skip "The rpmlint package is not installed"
+	else
+		skip "Skip rpmlint test pending kernel.spec.template changes"
+	fi
 
-    numsrpms=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm" | wc -l)
-    if [ "$numsrpms" != "1" ]; then
-	skip "Only one SRPM should be in $BATS_TEST_DIRNAME/redhat/rpms/SRPMS."
-    fi
+	numsrpms=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm" | wc -l)
+	if [ "$numsrpms" != "1" ]; then
+		skip "Only one SRPM should be in $BATS_TEST_DIRNAME/redhat/rpms/SRPMS."
+	fi
 
-    srpm=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm")
-    run rpmlint $srpm
-    status=$?
-    [ "$status" = 0 ]
+	srpm=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm")
+	run rpmlint $srpm
+	status=$?
+	[ "$status" = 0 ]
 }
diff --git a/redhat/self-test/1002-basic-structural-test.bats b/redhat/self-test/1002-basic-structural-test.bats
index blahblah..blahblah 100644
--- a/redhat/self-test/1002-basic-structural-test.bats
+++ b/redhat/self-test/1002-basic-structural-test.bats
@@ -2,72 +2,71 @@
 # Purpose: This test runs tests on the SRPM.
 
 @test "SRPM unpacks OK" {
-    numsrpms=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm" | wc -l)
-    if [ "$numsrpms" != "1" ]; then
-	skip "Only one SRPM should be in $BATS_TEST_DIRNAME/redhat/rpms/SRPMS."
-    fi
+	numsrpms=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm" | wc -l)
+	if [ "$numsrpms" != "1" ]; then
+		skip "Only one SRPM should be in $BATS_TEST_DIRNAME/redhat/rpms/SRPMS."
+	fi
 
-    srpm=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm")
-    pushd "$BATS_TMPDIR"
-    if [ -e SRPMS ]
-    then
-        rm -fr SRPMS
-    fi
-    mkdir SRPMS
-    cd SRPMS
-    rpm2cpio "$srpm" | cpio -idm
-    status=$?
-    [ "$status" = 0 ]
-    popd >& /dev/null
+	srpm=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm")
+	pushd "$BATS_TMPDIR"
+	if [ -e SRPMS ]; then
+		rm -fr SRPMS
+	fi
+	mkdir SRPMS
+	cd SRPMS
+	rpm2cpio "$srpm" | cpio -idm
+	status=$?
+	[ "$status" = 0 ]
+	popd >& /dev/null
 }
 
 @test "Linux tree unpacks OK" {
-    numsrpms=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm" | wc -l)
-    if [ "$numsrpms" != "1" ]; then
-	skip "Only one SRPM should be in $BATS_TEST_DIRNAME/redhat/rpms/SRPMS."
-    fi
+numsrpms=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm" | wc -l)
+	if [ "$numsrpms" != "1" ]; then
+		skip "Only one SRPM should be in $BATS_TEST_DIRNAME/redhat/rpms/SRPMS."
+	fi
 
-    pushd "$BATS_TMPDIR"/SRPMS >& /dev/null
-    ls | wc
-    linuxname=$(ls linux*.tar.xz)
-    run tar --extract --xz -f "$linuxname"
-    [ "$status" = 0 ]
-    popd >& /dev/null
+	pushd "$BATS_TMPDIR"/SRPMS >& /dev/null
+	ls | wc
+	linuxname=$(ls linux*.tar.xz)
+	run tar --extract --xz -f "$linuxname"
+	[ "$status" = 0 ]
+	popd >& /dev/null
 }
 
 @test "Linux top level structural check" {
-    numsrpms=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm" | wc -l)
-    if [ "$numsrpms" != "1" ]; then
-	skip "Only one SRPM should be in $BATS_TEST_DIRNAME/redhat/rpms/SRPMS."
-    fi
+	numsrpms=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm" | wc -l)
+	if [ "$numsrpms" != "1" ]; then
+		skip "Only one SRPM should be in $BATS_TEST_DIRNAME/redhat/rpms/SRPMS."
+	fi
 
-    pushd "$BATS_TMPDIR"/SRPMS >& /dev/null
-    linuxtree=$(ls linux*.tar.xz)
-    linuxtree=${linuxtree/.tar.xz}
-    cd $linuxtree
-    test -d arch	&& \
-    test -d block	&& \
-    test -d certs	&& \
-    test -d crypto	&& \
-    test -d Documentation	&& \
-    test -d drivers	&& \
-    test -d fs		&& \
-    test -d include	&& \
-    test -d init	&& \
-    test -d ipc		&& \
-    test -d kernel	&& \
-    test -d lib
-    test -d LICENSES	&& \
-    test -d mm		&& \
-    test -d net		&& \
-    test -d samples	&& \
-    test -d scripts	&& \
-    test -d security	&& \
-    test -d sound	&& \
-    test -d tools	&& \
-    test -d usr		&& \
-    test -d virt
-    status=$?
-    popd >& /dev/null
-    [ "$status" = 0 ]
+	pushd "$BATS_TMPDIR"/SRPMS >& /dev/null
+	linuxtree=$(ls linux*.tar.xz)
+	linuxtree=${linuxtree/.tar.xz}
+	cd $linuxtree
+	test -d arch	&& \
+	test -d block	&& \
+	test -d certs	&& \
+	test -d crypto	&& \
+	test -d Documentation	&& \
+	test -d drivers	&& \
+	test -d fs		&& \
+	test -d include	&& \
+	test -d init	&& \
+	test -d ipc		&& \
+	test -d kernel	&& \
+	test -d lib
+	test -d LICENSES	&& \
+	test -d mm		&& \
+	test -d net		&& \
+	test -d samples	&& \
+	test -d scripts	&& \
+	test -d security	&& \
+	test -d sound	&& \
+	test -d tools	&& \
+	test -d usr		&& \
+	test -d virt
+	status=$?
+	popd >& /dev/null
+	[ "$status" = 0 ]
 }
diff --git a/redhat/self-test/1003-rpminspect.bats b/redhat/self-test/1003-rpminspect.bats
index blahblah..blahblah 100644
--- a/redhat/self-test/1003-rpminspect.bats
+++ b/redhat/self-test/1003-rpminspect.bats
@@ -2,19 +2,18 @@
 # Purpose: This test runs rpminspect on the SRPM.
 
 @test "rpminspect" {
-    if ! test -x /usr/bin/rpminspect
-    then
-        skip "The rpminspect package is not installed"
-    else
-        skip "Skip rpminspect test pending fixes"
-    fi
+	if ! test -x /usr/bin/rpminspect; then
+		skip "The rpminspect package is not installed"
+	else
+		skip "Skip rpminspect test pending fixes"
+	fi
 
-    numsrpms=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm" | wc -l)
-    if [ "$numsrpms" != "1" ]; then
-	skip "Only one SRPM should be in $BATS_TEST_DIRNAME/redhat/rpms/SRPMS."
-    fi
+	numsrpms=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm" | wc -l)
+	if [ "$numsrpms" != "1" ]; then
+		skip "Only one SRPM should be in $BATS_TEST_DIRNAME/redhat/rpms/SRPMS."
+	fi
 
-    srpm=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm")
-    run rpminspect $srpm
-    [ "$status" = 0 ]
+	srpm=$(find "$BATS_TEST_DIRNAME"/.. -name "*.rpm")
+	run rpminspect $srpm
+	[ "$status" = 0 ]
 }
diff --git a/redhat/self-test/2001-dist-release.bats b/redhat/self-test/2001-dist-release.bats
index blahblah..blahblah 100644
--- a/redhat/self-test/2001-dist-release.bats
+++ b/redhat/self-test/2001-dist-release.bats
@@ -3,64 +3,64 @@
 # worktree created by the first test.
 
 @test "dist-release prologue" {
-    git worktree add $BATS_TMPDIR/distrelease
-    cd $BATS_TMPDIR/distrelease
-    # All the tests start off with 'make dist-release', so we can pull
-    # that out and put it here in the prologue:
-    DIST=.fc33 make dist-release
+	git worktree add $BATS_TMPDIR/distrelease
+	cd $BATS_TMPDIR/distrelease
+	# All the tests start off with 'make dist-release', so we can pull
+	# that out and put it here in the prologue:
+	DIST=.fc33 make dist-release
 }
 
 @test "dist-release test 1" {
-    # Test whether a second 'make dist-release' operation creates
-    # a second commit.  It SHOULD NOT.
-    # Capture 2nd line of log in array; ${loga[0]} is SHA1
-    cd $BATS_TMPDIR/distrelease
-    loga=($(git log --oneline -n 2 | tail -1))
-    DIST=.fc33 make dist-release
-    # Capture 2nd line of log in array; ${logb[0]} is SHA1
-    logb=($(git log --oneline -n 2 | tail -1))
-    # If SHA1 in loga is the same as the SHA1 in logb, then no
-    # 2nd commit has been created and the test has succeeded:
-    [ ${loga[0]} = ${logb[0]} ]
+	# Test whether a second 'make dist-release' operation creates
+	# a second commit.  It SHOULD NOT.
+	# Capture 2nd line of log in array; ${loga[0]} is SHA1
+	cd $BATS_TMPDIR/distrelease
+	loga=($(git log --oneline -n 2 | tail -1))
+	DIST=.fc33 make dist-release
+	# Capture 2nd line of log in array; ${logb[0]} is SHA1
+	logb=($(git log --oneline -n 2 | tail -1))
+	# If SHA1 in loga is the same as the SHA1 in logb, then no
+	# 2nd commit has been created and the test has succeeded:
+	[ ${loga[0]} = ${logb[0]} ]
 }
 
 @test "dist-release test 2" {
-    # Test whether release number in commit message matches
-    # release number in Makefile.rhelver.
-    # and above in prologue.
-    cd $BATS_TMPDIR/distrelease
-    title="$(git log --oneline --all  --grep "\[redhat\] kernel" -n 1 --pretty="format:%s")"
-    # title = ... [redhat] kernel-5.11.0-0.rc0.20201220git467f8165a2b0.104
-    # Just the title message part AFTER "[redhat] ":
-    title=${title##*\[redhat\] }
-    # Strip off ...kernel-VV.PP.SS-:
-    pkgrelease=${title##*kernel-+([5-9]).+([0-9]).+([0-9])-}
-    build=$(BUILD= DIST=.fc33 make dist-dump-variables | grep -E "^BUILD=" | cut -d"=" -f2 | xargs)
-    ((build--))
-    echo "pkgrelease=$pkgrelease"
-    echo "build=$build"
-    echo $pkgrelease | grep -q -w "$build"
-    status=$?
-    [ "$status" = 0 ]
+	# Test whether release number in commit message matches
+	# release number in Makefile.rhelver.
+	# and above in prologue.
+	cd $BATS_TMPDIR/distrelease
+	title="$(git log --oneline --all  --grep "\[redhat\] kernel" -n 1 --pretty="format:%s")"
+	# title = ... [redhat] kernel-5.11.0-0.rc0.20201220git467f8165a2b0.104
+	# Just the title message part AFTER "[redhat] ":
+	title=${title##*\[redhat\] }
+	# Strip off ...kernel-VV.PP.SS-:
+	pkgrelease=${title##*kernel-+([5-9]).+([0-9]).+([0-9])-}
+	build=$(BUILD= DIST=.fc33 make dist-dump-variables | grep -E "^BUILD=" | cut -d"=" -f2 | xargs)
+	((build--))
+	echo "pkgrelease=$pkgrelease"
+	echo "build=$build"
+	echo $pkgrelease | grep -q -w "$build"
+	status=$?
+	[ "$status" = 0 ]
 }
 
 @test "dist-release test 3" {
-    # Test whether the version in the commit message matches
-    # the version in the change log.
-    cd $BATS_TMPDIR/distrelease
-    # Extract just the version part (the part between [ ]) on the first line of
-    # the change log:
-    changelog=$(head -1 ./redhat/kernel.changelog-${RHEL_MAJOR}.${RHEL_MINOR} | sed -e 's/.*\[\(.*\)\].*/\1/')
-    commit="$(git log --oneline --all  --grep "\[redhat\] kernel" -n 1 --pretty="format:%s")"
-    # Extract just the commit message part AFTER "[redhat] ":
-    gitlog=${commit##*\[redhat\] }
-    # This time, strip off "kernel-" also:
-    gitlog=${gitlog/kernel-/}
-    echo "The kernel version in the changelog ($changelog) differs from the version in the git log ($gitlog)"
-    [ "$changelog" = "$gitlog" ]
+	# Test whether the version in the commit message matches
+	# the version in the change log.
+	cd $BATS_TMPDIR/distrelease
+	# Extract just the version part (the part between [ ]) on the first line of
+	# the change log:
+	changelog=$(head -1 ./redhat/kernel.changelog-${RHEL_MAJOR}.${RHEL_MINOR} | sed -e 's/.*\[\(.*\)\].*/\1/')
+	commit="$(git log --oneline --all  --grep "\[redhat\] kernel" -n 1 --pretty="format:%s")"
+	# Extract just the commit message part AFTER "[redhat] ":
+	gitlog=${commit##*\[redhat\] }
+	# This time, strip off "kernel-" also:
+	gitlog=${gitlog/kernel-/}
+	echo "The kernel version in the changelog ($changelog) differs from the version in the git log ($gitlog)"
+	[ "$changelog" = "$gitlog" ]
 }
 
 @test "dist-release epilogue" {
-    git worktree remove --force $BATS_TMPDIR/distrelease
-    git branch -D distrelease
+	git worktree remove --force $BATS_TMPDIR/distrelease
+	git branch -D distrelease
 }

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1881
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux