From b1cc88e4f402c70b7d982a2414afcba4f919da34 Mon Sep 17 00:00:00 2001 From: sophia-guo Date: Wed, 19 Jun 2024 17:18:25 -0400 Subject: [PATCH] Using custom target for rerun builds (#5382) (#5398) * Using custom target for rerun builds * Leave CUSTOM_TARGET as is if custom testcases can't work for rerun * Comment for selected test cases size --------- Signed-off-by: Sophia Guo --- buildenv/jenkins/JenkinsfileBase | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/buildenv/jenkins/JenkinsfileBase b/buildenv/jenkins/JenkinsfileBase index d6ca6925ca..f270028f8b 100644 --- a/buildenv/jenkins/JenkinsfileBase +++ b/buildenv/jenkins/JenkinsfileBase @@ -1266,6 +1266,7 @@ def addFailedTestsGrinderLink(paths=""){ if (failedTestList) { String failedTests = failedTestList.substring(0, failedTestList.length() - 1) env.FAILED_TESTS= failedTests ?: "" + env.RERUN_TESTCASES="" failedTestList = "testList+TESTLIST=" + failedTests String url = env.RERUN_LINK def failedTestUrl = url.replace(env.FAILED_TEST_TARGET, "TARGET=$failedTestList") @@ -1287,6 +1288,17 @@ def addFailedTestsGrinderLink(paths=""){ if (jckDevtoolsFailedTestCaseList) { customizedTestCases['jckdevtools'] = "${jckDevtoolsFailedTestCaseList}" } + + if (customizedTestCases.size() == 1) { + def testCases=customizedTestCases.values().first() + def customTarget=customizedTestCases.keySet().first() + def testCaseSize=testCases.count(' ') + // Limitation of Header Fields https://github.com/adoptium/aqa-tests/issues/5241#issuecomment-2161927014 + if (testCaseSize < 80) { + env.RERUN_CUSTOMTARGET="${customTarget}_custom" + env.RERUN_TESTCASES="${testCases}" + } + } customizedTestCases.each { target, testcases -> def tempTestCases = testcases.substring(0, testcases.length() - 1) tempTestCases = URLEncoder.encode(tempTestCases.toString(), "UTF-8") @@ -1342,7 +1354,21 @@ def triggerRerunJob () { // set PARALLEL, NUM_MACHINES and TEST_TIME to default values // set TARGET to failed tests and set ITERATIONS to rerunIterations if (param.key == "TARGET") { - childParams << string(name: param.key, value: "testList TESTLIST=" + env.FAILED_TESTS) + if (env.RERUN_TESTCASES) { + childParams << string(name: param.key, value: env.RERUN_CUSTOMTARGET) + } else { + if (env.FAILED_TESTS.contains("_custom")) { + childParams << string(name: param.key, value: env.FAILED_TESTS) + } else { + childParams << string(name: param.key, value: "testList TESTLIST=" + env.FAILED_TESTS) + } + } + } else if (param.key == "CUSTOM_TARGET") { + if (env.RERUN_TESTCASES) { + childParams << string(name: param.key, value: env.RERUN_TESTCASES) + } else { + childParams << string(name: param.key, value: param.value.toString()) + } } else if (param.key == "PARALLEL") { childParams << string(name: param.key, value: "None") } else if (param.key == "NUM_MACHINES") {