Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not move the test to child job if parallel list number=1 #5511

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def setupParallelEnv() {
int childJobNum = 1
def UPSTREAM_TEST_JOB_NAME = ""
def UPSTREAM_TEST_JOB_NUMBER = ""
parallel_tests = [:]

if (params.PARALLEL == "NodesByIterations") {
childJobNum = NUM_MACHINES
Expand Down Expand Up @@ -249,21 +250,24 @@ def setupParallelEnv() {
NUM_LIST = genParallelList(PARALLEL_OPTIONS)
}

if (NUM_LIST > 0) {
if (NUM_LIST > 1) {
childJobNum = NUM_LIST
echo "Saving parallelList.mk file on jenkins..."
dir('aqa-tests/TKG') {
archiveArtifacts artifacts: 'parallelList.mk', fingerprint: true, allowEmptyArchive: false
}
} else if (NUM_LIST == 1) {
echo " Number of test list is 1, no need to run tests in child job."
return NUM_LIST
} else {
assert false : "Build failed because cannot find NUM_LIST in parallelList.mk file."
}
}

UPSTREAM_TEST_JOB_NAME = JOB_NAME
UPSTREAM_TEST_JOB_NUMBER = BUILD_NUMBER

echo "[PARALLEL: ${params.PARALLEL}] childJobNum is ${childJobNum}, creating jobs and running them in parallel..."
parallel_tests = [:]
create_jobs = [:]

for (int i = 0; i < childJobNum; i++) {
Expand Down Expand Up @@ -315,7 +319,7 @@ def setupParallelEnv() {
if (create_jobs) {
parallel create_jobs
}

return NUM_LIST
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable NUM_LIST is not visible here (it's confined to the scope where it's declared, which ends on line 265); our test builds are failing as a result:

00:15:35.923  Exception: groovy.lang.MissingPropertyException: No such property: NUM_LIST for class: Script1

// return to top level pipeline file in order to exit node block before running tests in parallel
}

Expand Down Expand Up @@ -969,7 +973,10 @@ def testBuild() {
// prepare environment and compile test projects
if ((params.PARALLEL == "NodesByIterations" && NUM_MACHINES > 1)
|| (params.PARALLEL == "Dynamic" && (NUM_MACHINES > 1 || (params.TEST_TIME && !params.NUM_MACHINES)))) {
setupParallelEnv()
if (setupParallelEnv() == 1) {
// No need to run tests in parallel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to echo here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is echoed https://github.com/adoptium/aqa-tests/pull/5511/files#diff-21a56f751656da4e3e5abee13913f51a269d6eb43235bc16fc4be21ef70deaf2R260

16:32:34   Number of test list is 1, no need to run tests in child job.

testExecution()
}
} else {
testExecution()
}
Expand Down