aboutsummaryrefslogtreecommitdiff
path: root/jenkins/bisect.jpl
diff options
context:
space:
mode:
authorGuillaume Tucker <guillaume.tucker@collabora.com>2018-11-28 10:06:28 +0000
committerGuillaume Tucker <guillaume.tucker@collabora.com>2018-12-07 13:23:52 +0000
commit02ba84918c24c539493849e25c4a4db8031f7cda (patch)
treee416a3a075fa2d3e3420a0af465d0c64f5735f57 /jenkins/bisect.jpl
parent46aceb3ddbbb57ebf0a22d9c8195587361b4b16e (diff)
bisect.jpl: findMergeBase() to find common git ancestor
Add findMergeBase() function to determine the merge base before starting a bisection if the provided GOOD_COMMIT is not on the same branch as the current BAD_COMMIT HEAD. This relies on a new set of parameters with a reference tree and branch, to find a common ancestor. The idea being that both GOOD_COMMIT and BAD_COMMIT have a common ancestor from the reference branch. The reference is set to mainline/master by default, which should work in most cases, but for stable-rc branches it will need to be the matching stable branch. Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Diffstat (limited to 'jenkins/bisect.jpl')
-rw-r--r--jenkins/bisect.jpl53
1 files changed, 46 insertions, 7 deletions
diff --git a/jenkins/bisect.jpl b/jenkins/bisect.jpl
index 13cf953..3157c95 100644
--- a/jenkins/bisect.jpl
+++ b/jenkins/bisect.jpl
@@ -37,6 +37,12 @@ GOOD_COMMIT
Good known Git revision (SHA1 or any valid reference)
BAD_COMMIT
Bad known Git revision (SHA1 or any valid reference)
+REF_KERNEL_URL (git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git)
+ URL of the reference kernel Git repository used to find merge bases
+REF_KERNEL_BRANCH (master)
+ Name of the branch from the reference kernel Git repository
+REF_KERNEL_TREE (mainline)
+ Name of the reference kernel Git repository
ARCH
CPU architecture as understood by the Linux kernel build system
DEFCONFIG (defconfig)
@@ -323,14 +329,42 @@ def runTest(kci_core, describe, expected=0, runs=0) {
* bisection
*/
-def bisectStart(kdir) {
+def findMergeBase(kdir, good, bad) {
+ def base = good
+
+ dir(kdir) {
+ def good_base = sh(
+ returnStatus: true,
+ script: "git merge-base --is-ancestor ${base} HEAD")
+
+ if (good_base != 0) {
+ def ref = "${params.REF_KERNEL_TREE}/${params.REF_KERNEL_BRANCH}"
+ print("Good commit not in current branch, finding base in ${ref}")
+
+ print("""\
+Reference:
+ Tree: ${params.REF_KERNEL_TREE}
+ URL: ${params.REF_KERNEL_URL}
+ Branch: ${params.REF_KERNEL_BRANCH}""")
+
+ setRemote(kdir, params.REF_KERNEL_TREE, params.REF_KERNEL_URL)
+ base = sh(script: "git merge-base ${bad} ${ref}",
+ returnStdout: true).trim()
+ print("Merge base: ${base}")
+ }
+ }
+
+ return base
+}
+
+def bisectStart(kdir, good, bad) {
def status = null
dir(kdir) {
status = sh(returnStatus: true, script: """
git bisect start
-git bisect good ${params.GOOD_COMMIT}
-git bisect bad ${params.BAD_COMMIT}
+git bisect good ${good}
+git bisect bad ${bad}
""")
}
@@ -440,6 +474,8 @@ def checkAbort(passed, message) {
def bisection(kci_core, kdir, checks) {
def check = null
+ def good = null
+ def bad = null
stage("Init") {
timeout(time: 30, unit: 'MINUTES') {
@@ -448,30 +484,33 @@ def bisection(kci_core, kdir, checks) {
kdir: { cloneLinux(kdir) },
)
}
+
+ bad = params.BAD_COMMIT
+ good = findMergeBase(kdir, params.GOOD_COMMIT, bad)
}
stage("Check pass") {
- check = runCheck(kdir, kci_core, params.GOOD_COMMIT, 'pass', 0)
+ check = runCheck(kdir, kci_core, good, 'pass', 0)
}
if (!checkAbort(check, "Good revision check failed"))
return check
stage("Check fail") {
- check = runCheck(kdir, kci_core, params.BAD_COMMIT, 'fail', 2)
+ check = runCheck(kdir, kci_core, bad, 'fail', 2)
}
if (!checkAbort(check, "Bad revision check failed"))
return check
stage("Start") {
timeout(time: 5, unit: 'MINUTES') {
- check = bisectStart(kdir)
+ check = bisectStart(kdir, good, bad)
}
}
if (!checkAbort(check,
"Failed to start bisection, commits range may be invalid."))
return check
- def previous = params.GOOD_COMMIT
+ def previous = good
def current = getSHA(kdir)
def iteration = 1