From: Prarit Bhargava <prarit(a)redhat.com>
redhat/self-test: Remove --all from git query
It was reported that executing this test on an older tag failed. This
occurs because the git query to find the most recent "[redhat] kernel"
commit looks at the entire git history instead of the branch's history.
Removing the '--all' from the "[redhat] kernel" lookup resolves this
problem.
Testing:
There are 3 cases that I considered which all succeed with this change:
1. running on os-build or ark-latest
git co origin/os-build
RHEL_MAJOR=9 RHEL_MINOR=99 bats redhat/self-test/2001-dist-release.bats
2. a new branch based on os-build/ark-latest
git co origin/ark-latest
git checkout -b junk
/# make some changes
RHEL_MAJOR=9 RHEL_MINOR=99 bats redhat/self-test/2001-dist-release.bats
3. an older branch based on a tag
git co kernel-6.6.0-0.rc7.56567a20b22b.59
RHEL_MAJOR=9 RHEL_MINOR=99 bats redhat/self-test/2001-dist-release.bats
Signed-off-by: Prarit Bhargava <prarit(a)redhat.com>
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
@@ -60,15 +60,20 @@ _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 the tag in the latest [redhat] kernel commit message
+ commit="$(git log --oneline --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-${RHEL_MAJOR}.${RHEL_MINOR}
("${changelog}") differs from the version in the git log ($gitlog)"
+
run _dist-release_test_3
check_status
}
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2837