From: Ben Crocker <bcrocker@xxxxxxxxxx> Collect the actual testing code into a new checkversion() function; add line breaks and indentation in both prologue() and checkversion() for better readability. Signed-off-by: Ben Crocker <bcrocker@xxxxxxxxxx> --- .../self-test/1005-dist-dump-variables.bats | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/redhat/self-test/1005-dist-dump-variables.bats b/redhat/self-test/1005-dist-dump-variables.bats index a2090b5c2194..9251ca4636d5 100644 --- a/redhat/self-test/1005-dist-dump-variables.bats +++ b/redhat/self-test/1005-dist-dump-variables.bats @@ -5,51 +5,51 @@ function prologue() tag=$1 ofile=$BATS_TMPDIR/$tag.out # Have to unset environment variables that may be inherited from supra-make: - grep "^[ ]*[a-zA-Z_][a-zA-Z_0-9]*[ ]*[:?]*=" $BATS_TEST_DIRNAME/../Makefile.common | sed -e 's/[ ]*\([a-zA-Z_][a-zA-Z_0-9]*\).*/unset \1/' | sort | uniq > $BATS_TMPDIR/unset-vars.sh + grep "^[ ]*[a-zA-Z_][a-zA-Z_0-9]*[ ]*[:?]*=" \ + $BATS_TEST_DIRNAME/../Makefile.common | \ + sed -e 's/[ ]*\([a-zA-Z_][a-zA-Z_0-9]*\).*/unset \1/' | \ + sort | uniq > $BATS_TMPDIR/unset-vars.sh source $BATS_TMPDIR/unset-vars.sh GIT=$BATS_TEST_DIRNAME/egit.sh HEAD=$tag EGIT_OVERRIDE_DESCRIBE=$tag DIST=.fc33 make dist-dump-variables > $ofile } -@test "dist-dump-variables v5.8" { - tag=v5.8 - prologue $tag +function checkversion() +{ status=1 - if grep -x "_TAG=$tag" $ofile && grep -x "RPMKVERSION=5" $ofile && grep -x "RPMKPATCHLEVEL=8" $ofile && grep -x "RPMKSUBLEVEL=0" $ofile && grep -x "RPMKEXTRAVERSION=" $ofile && grep -x "KEXTRAVERSION=" $ofile && grep -x "SNAPSHOT=0" $ofile + if grep -x "_TAG=$1" $ofile && \ + grep -x "RPMKVERSION=$2" $ofile && grep -x "RPMKPATCHLEVEL=$3" $ofile && \ + grep -x "RPMKSUBLEVEL=$4" $ofile && grep -x "RPMKEXTRAVERSION=$5" $ofile && \ + grep -x "KEXTRAVERSION=$6" $ofile && \ + grep -x "SNAPSHOT=$7" $ofile then status=$? fi +} + +@test "dist-dump-variables v5.8" { + tag=v5.8 + prologue $tag + checkversion $tag "5" "8" "0" "" "" "0" [ "$status" = 0 ] } @test "dist-dump-variables v5.8-rc7" { tag=v5.8-rc7 prologue $tag - status=1 - if grep -x "_TAG=$tag" $ofile && grep -x "RPMKVERSION=5" $ofile && grep -x "RPMKPATCHLEVEL=8" $ofile && grep -x "RPMKSUBLEVEL=0" $ofile && grep -x "RPMKEXTRAVERSION=-rc7" $ofile && grep -x "KEXTRAVERSION=.rc7" $ofile && grep -x "SNAPSHOT=0" $ofile - then - status=$? - fi + checkversion $tag "5" "8" "0" "-rc7" ".rc7" "0" [ "$status" = 0 ] } @test "dist-dump-variables v5.8-9-g565674d613d7" { tag=v5.8-9-g565674d613d7 prologue $tag - status=1 - if grep -x "_TAG=$tag" $ofile && grep -x "RPMKVERSION=5" $ofile && grep -x "RPMKPATCHLEVEL=9" $ofile && grep -x "RPMKSUBLEVEL=0" $ofile && grep -x "RPMKEXTRAVERSION=" $ofile && grep -x "KEXTRAVERSION=.rc0" $ofile && grep -x "SNAPSHOT=1" $ofile - then - status=$? - fi + checkversion $tag "5" "9" "0" "" ".rc0" "1" [ "$status" = 0 ] } @test "dist-dump-variables v5.8-rc5-99-g25ccd24ffd91" { tag=v5.8-rc5-99-g25ccd24ffd91 prologue $tag - status=1 - if grep -x "_TAG=$tag" $ofile && grep -x "RPMKVERSION=5" $ofile && grep -x "RPMKPATCHLEVEL=8" $ofile && grep -x "RPMKSUBLEVEL=0" $ofile && grep -x "RPMKEXTRAVERSION=-rc5" $ofile && grep -x "KEXTRAVERSION=.rc5" $ofile && grep -x "SNAPSHOT=1" $ofile - then - status=$? - fi + checkversion $tag "5" "8" "0" "-rc5" ".rc5" "1" [ "$status" = 0 ] } -- GitLab _______________________________________________ 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