Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 193eb5a

Browse files
hseok-ohjanvorli
authored andcommitted
[x86/Linux] Enable CI unittest (#14442)
* [x86/Linux] Preparing pri2 unittest - Copy test binary from x86 Windows build - Copy CoreFX managed from arm CoreFX managed build - Add archival * Fix to merge test job generation Change approach by expanding existing x64 & arm64 linux infrastructure * [CI][Linux/x86] Fix configuration and architecture in netci.groovy Fix to use configuration instead of lowerConfiguration USe architecture and osGroup * [CI][Linux/x86] Save test native builds in build job Fix to save test native build in build job Saved native builds are used on test job
1 parent 6a100e5 commit 193eb5a

File tree

1 file changed

+104
-7
lines changed

1 file changed

+104
-7
lines changed

netci.groovy

Lines changed: 104 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,52 @@ def static appendStressModeScriptStep(def os, def appendScript, def stepScriptLo
505505
return stepScript
506506
}
507507

508+
def static isNeedDocker(def architecture, def os, def isBuild) {
509+
if (isBuild) {
510+
if (architecture == 'x86' && os == 'Ubuntu') {
511+
return true
512+
}
513+
else if (architecture == 'arm') {
514+
if (os == 'Ubuntu' || os == 'Ubuntu16.04' || os == 'Tizen') {
515+
return true
516+
}
517+
}
518+
}
519+
else {
520+
if (architecture == 'x86' && os == 'Ubuntu') {
521+
return true
522+
}
523+
}
524+
return false
525+
}
526+
527+
def static getDockerImageName(def architecture, def os, def isBuild) {
528+
// We must change some docker private images to official later
529+
if (isBuild) {
530+
if (architecture == 'x86' && os == 'Ubuntu') {
531+
return "hseok82/dotnet-buildtools-prereqs:ubuntu-16.04-crossx86-ef0ac75-20175511035548"
532+
}
533+
else if (architecture == 'arm') {
534+
if (os == 'Ubuntu') {
535+
return "microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20172211042239"
536+
}
537+
else if (os == 'Ubuntu16.04') {
538+
return "microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-cross-ef0ac75-20175511035548"
539+
}
540+
else if (os == 'Tizen') {
541+
return "hqueue/dotnetcore:ubuntu1404_cross_prereqs_v4-tizen_rootfs"
542+
}
543+
}
544+
}
545+
else {
546+
if (architecture == 'x86' && os == 'Ubuntu') {
547+
return "hseok82/dotnet-buildtools-prereqs:ubuntu1604_x86_test"
548+
}
549+
}
550+
println("Unknown architecture to use docker: ${architecture} ${os}");
551+
assert false
552+
}
553+
508554
// Calculates the name of the build job based on some typical parameters.
509555
//
510556
def static getJobName(def configuration, def architecture, def os, def scenario, def isBuildOnly) {
@@ -576,7 +622,7 @@ def static addNonPRTriggers(def job, def branch, def isPR, def architecture, def
576622
switch (architecture) {
577623
case 'x64':
578624
case 'x86':
579-
if (architecture == 'x86' && os == 'Ubuntu') {
625+
if (isFlowJob && architecture == 'x86' && os == 'Ubuntu') {
580626
Utilities.addPeriodicTrigger(job, '@daily')
581627
}
582628
else if (isFlowJob || os == 'Windows_NT' || !(os in Constants.crossList)) {
@@ -1244,6 +1290,10 @@ def static addTriggers(def job, def branch, def isPR, def architecture, def os,
12441290
case 'x86': // editor brace matching: {
12451291
assert ((os == 'Windows_NT') || ((os == 'Ubuntu') && (scenario == 'default')))
12461292
if (os == 'Ubuntu') {
1293+
// Triggers on the non-flow jobs aren't necessary here
1294+
if (!isFlowJob) {
1295+
break
1296+
}
12471297
// on-demand only for ubuntu x86
12481298
Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} ${configuration} Build",
12491299
"(?i).*test\\W+${os}\\W+${architecture}\\W+${configuration}.*")
@@ -1643,7 +1693,11 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
16431693
case 'x86':
16441694
if (architecture == 'x86' && os == 'Ubuntu') {
16451695
// build and PAL test
1646-
buildCommands += "./tests/scripts/x86_ci_script.sh --buildConfig=${lowerConfiguration}"
1696+
def dockerImage = getDockerImageName(architecture, os, true)
1697+
buildCommands += "docker run -i --rm -v \${WORKSPACE}:/opt/code -w /opt/code -e ROOTFS_DIR=/crossrootfs/x86 ${dockerImage} ./build.sh ${architecture} cross ${lowerConfiguration}"
1698+
dockerImage = getDockerImageName(architecture, os, false)
1699+
buildCommands += "docker run -i --rm -v \${WORKSPACE}:/opt/code -w /opt/code ${dockerImage} ./src/pal/tests/palsuite/runpaltests.sh /opt/code/bin/obj/${osGroup}.${architecture}.${configuration} /opt/code/bin/paltestout"
1700+
Utilities.addArchival(newJob, "bin/Product/**,bin/obj/*/tests/**/*.so", "bin/Product/**/.nuget/**")
16471701
Utilities.addXUnitDotNETResults(newJob, '**/pal_tests.xml')
16481702
break
16491703
}
@@ -2080,7 +2134,7 @@ Constants.allScenarios.each { scenario ->
20802134
// Create jobs requiring flow jobs. This includes x64 non-Windows, arm64 Ubuntu, and arm/arm64/armlb Windows.
20812135
Constants.allScenarios.each { scenario ->
20822136
[true, false].each { isPR ->
2083-
['arm', 'armlb', 'x64', 'arm64'].each { architecture ->
2137+
['arm', 'armlb', 'x64', 'arm64', 'x86'].each { architecture ->
20842138
Constants.crossList.each { os ->
20852139
if (architecture == 'arm64') {
20862140
if (os != "Ubuntu" && os != "Windows_NT") {
@@ -2091,6 +2145,11 @@ Constants.allScenarios.each { scenario ->
20912145
return
20922146
}
20932147
}
2148+
else if (architecture == 'x86') {
2149+
if (os != "Ubuntu") {
2150+
return
2151+
}
2152+
}
20942153

20952154
def validWindowsNTCrossArches = ["arm", "armlb", "arm64"]
20962155

@@ -2112,6 +2171,10 @@ Constants.allScenarios.each { scenario ->
21122171
if (scenario != 'default' && scenario != 'r2r' && scenario != 'gcstress0x3' && scenario != 'gcstress0xc') {
21132172
return
21142173
}
2174+
else if (architecture == 'x86') {
2175+
// Linux/x86 only want default test
2176+
if (scenario != 'default') {
2177+
return
21152178
}
21162179
}
21172180

@@ -2369,6 +2432,13 @@ Constants.allScenarios.each { scenario ->
23692432
if (os == 'Ubuntu') {
23702433
osJobName = 'ubuntu14.04'
23712434
}
2435+
else if (architecture == 'x86') {
2436+
if (os == 'Ubuntu') {
2437+
// Linux/x86 corefx jobs does not build managed yet
2438+
// Clone linux/arm corefx managed packages and overwrite linux/x86 native
2439+
osJobName = "linux_arm_cross"
2440+
}
2441+
}
23722442
else {
23732443
osJobName = os.toLowerCase()
23742444
}
@@ -2379,7 +2449,7 @@ Constants.allScenarios.each { scenario ->
23792449
}
23802450
}
23812451

2382-
shell ("mkdir ./bin/CoreFxBinDir")
2452+
shell("mkdir ./bin/CoreFxBinDir")
23832453
// Unpack the corefx binaries
23842454
shell("tar -xf ./bin/build.tar.gz -C ./bin/CoreFxBinDir")
23852455

@@ -2389,11 +2459,33 @@ Constants.allScenarios.each { scenario ->
23892459
shell("cp ./bin/Product/Linux.arm64.${configuration}/corefxNative/* ./bin/CoreFxBinDir")
23902460
shell("chmod +x ./bin/Product/Linux.arm64.${configuration}/corerun")
23912461
}
2462+
else if (architecture == 'x86') {
2463+
shell("mkdir ./bin/CoreFxNative")
2464+
2465+
copyArtifacts("${corefxFolder}/ubuntu16.04_x86_release") {
2466+
includePatterns('bin/build.tar.gz')
2467+
targetDirectory('bin/CoreFxNative')
2468+
buildSelector {
2469+
latestSuccessful(true)
2470+
}
2471+
}
2472+
2473+
shell("tar -xf ./bin/CoreFxNative/bin/build.tar.gz -C ./bin/CoreFxBinDir")
2474+
}
23922475

23932476
// Unzip the tests first. Exit with 0
23942477
shell("unzip -q -o ./bin/tests/tests.zip -d ./bin/tests/Windows_NT.${architecture}.${configuration} || exit 0")
23952478

23962479
// Execute the tests
2480+
def runDocker = isNeedDocker(architecture, os, false)
2481+
def dockerPrefix = ""
2482+
def dockerCmd = ""
2483+
if (runDocker) {
2484+
def dockerImage = getDockerImageName(architecture, os, false)
2485+
dockerPrefix = "docker run -i --rm -v \${WORKSPACE}:\${WORKSPACE} -w \${WORKSPACE} "
2486+
dockerCmd = dockerPrefix + "${dockerImage} "
2487+
}
2488+
23972489
// If we are running a stress mode, we'll set those variables first
23982490
def testEnvOpt = ""
23992491
if (isJitStressScenario(scenario)) {
@@ -2407,7 +2499,7 @@ Constants.allScenarios.each { scenario ->
24072499
shell('./init-tools.sh')
24082500
}
24092501

2410-
shell("""./tests/runtest.sh \\
2502+
shell("""${dockerCmd}./tests/runtest.sh \\
24112503
--testRootDir=\"\${WORKSPACE}/bin/tests/Windows_NT.${architecture}.${configuration}\" \\
24122504
--testNativeBinDir=\"\${WORKSPACE}/bin/obj/${osGroup}.${architecture}.${configuration}/tests\" \\
24132505
--coreClrBinDir=\"\${WORKSPACE}/bin/Product/${osGroup}.${architecture}.${configuration}\" \\
@@ -2418,10 +2510,15 @@ Constants.allScenarios.each { scenario ->
24182510
if (isGcReliabilityFramework(scenario)) {
24192511
// runtest.sh doesn't actually execute the reliability framework - do it here.
24202512
if (serverGCString != '') {
2421-
shell("export COMPlus_gcServer=1")
2513+
if (runDocker) {
2514+
dockerCmd = dockerPrefix + "-e COMPlus_gcServer=1 ${dockerImage} "
2515+
}
2516+
else {
2517+
shell("export COMPlus_gcServer=1")
2518+
}
24222519
}
24232520

2424-
shell("./tests/scripts/run-gc-reliability-framework.sh ${architecture} ${configuration}")
2521+
shell("${dockerCmd}./tests/scripts/run-gc-reliability-framework.sh ${architecture} ${configuration}")
24252522
}
24262523
}
24272524

0 commit comments

Comments
 (0)