@@ -135,9 +135,9 @@ class Constants {
135135 ' jitdiff' ,
136136 ' standalone_gc' ,
137137 ' gc_reliability_framework' ,
138- ' illink' ] + r2rStressScenarios . keySet()
138+ ' illink' ]
139139
140- def static allScenarios = basicScenarios + jitStressModeScenarios. keySet()
140+ def static allScenarios = basicScenarios + r2rStressScenarios . keySet() + jitStressModeScenarios. keySet()
141141
142142 // A set of scenarios that are valid for arm/arm64/armlb tests run on hardware. This is a map from valid scenario name
143143 // to Tests.lst file categories to exclude.
@@ -150,27 +150,27 @@ class Constants {
150150 def static validArmWindowsScenarios = [
151151 ' default' : [],
152152 // 'ilrt'
153- // 'r2r': ["R2R_FAIL"],
153+ ' r2r' : [" R2R_FAIL" ],
154154 // 'longgc'
155155 // 'formatting'
156156 // 'gcsimulator'
157157 // 'jitdiff'
158158 // 'standalone_gc'
159159 // 'gc_reliability_framework'
160160 // 'illink'
161- // 'r2r_jitstress1'
162- // 'r2r_jitstress2'
163- // 'r2r_jitstressregs1'
164- // 'r2r_jitstressregs2'
165- // 'r2r_jitstressregs3'
166- // 'r2r_jitstressregs4'
167- // 'r2r_jitstressregs8'
168- // 'r2r_jitstressregs0x10'
169- // 'r2r_jitstressregs0x80'
170- // 'r2r_jitstressregs0x1000'
171- // 'r2r_jitminopts'
172- // 'r2r_jitforcerelocs'
173- // 'r2r_gcstress15'
161+ ' r2r_jitstress1' : [ " R2R_FAIL " , " JITSTRESS_FAIL " , " JITSTRESS_EXCLUDE " ],
162+ ' r2r_jitstress2' : [ " R2R_FAIL " , " JITSTRESS_FAIL " , " JITSTRESS_EXCLUDE " ],
163+ ' r2r_jitstressregs1' : [ " R2R_FAIL " , " JITSTRESS_FAIL " , " JITSTRESS_EXCLUDE " ],
164+ ' r2r_jitstressregs2' : [ " R2R_FAIL " , " JITSTRESS_FAIL " , " JITSTRESS_EXCLUDE " ],
165+ ' r2r_jitstressregs3' : [ " R2R_FAIL " , " JITSTRESS_FAIL " , " JITSTRESS_EXCLUDE " ],
166+ ' r2r_jitstressregs4' : [ " R2R_FAIL " , " JITSTRESS_FAIL " , " JITSTRESS_EXCLUDE " ],
167+ ' r2r_jitstressregs8' : [ " R2R_FAIL " , " JITSTRESS_FAIL " , " JITSTRESS_EXCLUDE " ],
168+ ' r2r_jitstressregs0x10' : [ " R2R_FAIL " , " JITSTRESS_FAIL " , " JITSTRESS_EXCLUDE " ],
169+ ' r2r_jitstressregs0x80' : [ " R2R_FAIL " , " JITSTRESS_FAIL " , " JITSTRESS_EXCLUDE " ],
170+ ' r2r_jitstressregs0x1000' : [ " R2R_FAIL " , " JITSTRESS_FAIL " , " JITSTRESS_EXCLUDE " ],
171+ ' r2r_jitminopts' : [ " R2R_FAIL " , " JITSTRESS_FAIL " , " JITSTRESS_EXCLUDE " ],
172+ ' r2r_jitforcerelocs' : [ " R2R_FAIL " , " JITSTRESS_FAIL " , " JITSTRESS_EXCLUDE " ],
173+ ' r2r_gcstress15' : [ " R2R_FAIL " , " JITSTRESS_FAIL " , " JITSTRESS_EXCLUDE " ],
174174 ' minopts' : [" MINOPTS_FAIL" , " MINOPTS_EXCLUDE" ],
175175 ' tieredcompilation' : [],
176176 ' forcerelocs' : [],
@@ -458,10 +458,19 @@ def static getR2RDisplayName(def scenario) {
458458 return displayStr
459459}
460460
461- // Generates the string for creating a file that sets environment variables
462- // that makes it possible to run stress modes. Writes the script to the file
463- // specified by the stepScriptLocation parameter.
464- def static genStressModeScriptStep (def os , def stressModeName , def stressModeVars , def stepScriptLocation ) {
461+ //
462+ // Functions to create an environment script.
463+ // envScriptCreate -- initialize the script (call first)
464+ // envScriptFinalize -- finalize the script (call last)
465+ // envScriptSetStressModeVariables -- set stress mode variables in the env script
466+ // envScriptAppendExistingScript -- append an existing script to the generated script
467+ //
468+ // Each script returns a string of commands. Concatenate all the strings together before
469+ // adding them to the builds commands, to make sure they get executed as one Jenkins script.
470+ //
471+
472+ // Initialize the environment setting script.
473+ def static envScriptCreate (def os , def stepScriptLocation ) {
465474 def stepScript = ' '
466475 if (os == ' Windows_NT' ) {
467476 // Timeout in ms, default is 10 minutes. For stress modes up this to 30 minutes.
@@ -470,12 +479,24 @@ def static genStressModeScriptStep(def os, def stressModeName, def stressModeVar
470479 def timeout = 1800000
471480 stepScript + = " set __TestTimeout=${ timeout} \r\n "
472481
473- stepScript + = " echo Creating TestEnv Script for ${ stressModeName } \r\n "
482+ stepScript + = " echo Creating TestEnv script \r\n "
474483 stepScript + = " if exist ${ stepScriptLocation} del ${ stepScriptLocation} \r\n "
475484
476485 // Create at least an empty script.
477486 stepScript + = " echo. > ${ stepScriptLocation} \r\n "
487+ }
488+ else {
489+ stepScript + = " echo Creating environment setting script\n "
490+ stepScript + = " echo \\ #\\ !/usr/bin/env bash > ${ stepScriptLocation} \n "
491+ }
492+
493+ return stepScript
494+ }
478495
496+ // Generates the string for setting stress mode variables.
497+ def static envScriptSetStressModeVariables (def os , def stressModeVars , def stepScriptLocation ) {
498+ def stepScript = ' '
499+ if (os == ' Windows_NT' ) {
479500 stressModeVars. each{ k , v ->
480501 // Write out what we are writing to the script file
481502 stepScript + = " echo Setting ${ k} =${ v} \r\n "
@@ -484,31 +505,42 @@ def static genStressModeScriptStep(def os, def stressModeName, def stressModeVar
484505 }
485506 }
486507 else {
487- stepScript + = " echo Setting variables for ${ stressModeName} \n "
488- stepScript + = " echo \\ #\\ !/usr/bin/env bash > ${ stepScriptLocation} \n "
489508 stressModeVars. each{ k , v ->
490509 // Write out what we are writing to the script file
491510 stepScript + = " echo Setting ${ k} =${ v} \n "
492511 // Write out the set itself to the script file`
493512 stepScript + = " echo export ${ k} =${ v} >> ${ stepScriptLocation} \n "
494513 }
495- stepScript + = " chmod +x ${ stepScriptLocation} \n "
496514 }
497515
498516 return stepScript
499517}
500518
501- // Append an existing script to a stress mode script already created by genStressModeScriptStep() .
519+ // Append an existing script to an environment script.
502520// Returns string of commands to do this.
503- def static appendStressModeScriptStep (def os , def appendScript , def stepScriptLocation ) {
521+ def static envScriptAppendExistingScript (def os , def appendScript , def stepScriptLocation ) {
504522 assert (os == ' Windows_NT' )
505523 def stepScript = ' '
524+
506525 stepScript + = " echo Appending ${ appendScript} to ${ stepScriptLocation} \r\n "
507526 stepScript + = " type ${ appendScript} >> ${ stepScriptLocation} \r\n "
508527
509- // Display the resulting script. This is useful when looking at the output log file.
510- stepScript + = " echo Display the total script ${ stepScriptLocation} \r\n "
511- stepScript + = " type ${ stepScriptLocation} \r\n "
528+ return stepScript
529+ }
530+
531+ // Finalize an environment setting script.
532+ // Returns string of commands to do this.
533+ def static envScriptFinalize (def os , def stepScriptLocation ) {
534+ def stepScript = ' '
535+
536+ if (os == ' Windows_NT' ) {
537+ // Display the resulting script. This is useful when looking at the output log file.
538+ stepScript + = " echo Display the total script ${ stepScriptLocation} \r\n "
539+ stepScript + = " type ${ stepScriptLocation} \r\n "
540+ }
541+ else {
542+ stepScript + = " chmod +x ${ stepScriptLocation} \n "
543+ }
512544
513545 return stepScript
514546}
@@ -1479,46 +1511,6 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
14791511 }
14801512
14811513 testOpts + = ' runcrossgentests'
1482-
1483- if (scenario == ' r2r_jitstress1' ) {
1484- testOpts + = ' jitstress 1'
1485- }
1486- else if (scenario == ' r2r_jitstress2' ) {
1487- testOpts + = ' jitstress 2'
1488- }
1489- else if (scenario == ' r2r_jitstressregs1' ) {
1490- testOpts + = ' jitstressregs 1'
1491- }
1492- else if (scenario == ' r2r_jitstressregs2' ) {
1493- testOpts + = ' jitstressregs 2'
1494- }
1495- else if (scenario == ' r2r_jitstressregs3' ) {
1496- testOpts + = ' jitstressregs 3'
1497- }
1498- else if (scenario == ' r2r_jitstressregs4' ) {
1499- testOpts + = ' jitstressregs 4'
1500- }
1501- else if (scenario == ' r2r_jitstressregs8' ) {
1502- testOpts + = ' jitstressregs 8'
1503- }
1504- else if (scenario == ' r2r_jitstressregs0x10' ) {
1505- testOpts + = ' jitstressregs 0x10'
1506- }
1507- else if (scenario == ' r2r_jitstressregs0x80' ) {
1508- testOpts + = ' jitstressregs 0x80'
1509- }
1510- else if (scenario == ' r2r_jitstressregs0x1000' ) {
1511- testOpts + = ' jitstressregs 0x1000'
1512- }
1513- else if (scenario == ' r2r_jitminopts' ) {
1514- testOpts + = ' jitminopts'
1515- }
1516- else if (scenario == ' r2r_jitforcerelocs' ) {
1517- testOpts + = ' jitforcerelocs'
1518- }
1519- else if (scenario == ' r2r_gcstress15' ) {
1520- testOpts + = ' gcstresslevel 0xF'
1521- }
15221514 }
15231515 else if (scenario == ' jitdiff' ) {
15241516 testOpts + = ' jitdisasm crossgen'
@@ -1540,17 +1532,27 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
15401532 // value env pairs to a file at this point and then we'll pass that to runtest.cmd
15411533
15421534 def envScriptPath = ' '
1543- if (isJitStressScenario(scenario)) {
1535+ if (isJitStressScenario(scenario) || isR2RStressScenario(scenario) ) {
15441536 def buildCommandsStr = ' '
15451537 envScriptPath = " %WORKSPACE%\\ SetStressModes.bat"
1546- buildCommandsStr + = genStressModeScriptStep(os, scenario, Constants . jitStressModeScenarios[scenario], envScriptPath)
1538+ buildCommandsStr + = envScriptCreate(os, envScriptPath)
1539+
1540+ if (isJitStressScenario(scenario)) {
1541+ buildCommandsStr + = envScriptSetStressModeVariables(os, Constants . jitStressModeScenarios[scenario], envScriptPath)
1542+ }
1543+ else if (isR2RStressScenario(scenario)) {
1544+ buildCommandsStr + = envScriptSetStressModeVariables(os, Constants . r2rStressScenarios[scenario], envScriptPath)
1545+ }
1546+
15471547 if (architecture == ' x86_arm_altjit' ) {
1548- buildCommandsStr + = appendStressModeScriptStep (os, " %WORKSPACE%\\ tests\\ x86_arm_altjit.cmd" , envScriptPath)
1548+ buildCommandsStr + = envScriptAppendExistingScript (os, " %WORKSPACE%\\ tests\\ x86_arm_altjit.cmd" , envScriptPath)
15491549 }
15501550 else if (architecture == ' x64_arm64_altjit' ) {
1551- buildCommandsStr + = appendStressModeScriptStep (os, " %WORKSPACE%\\ tests\\ x64_arm64_altjit.cmd" , envScriptPath)
1551+ buildCommandsStr + = envScriptAppendExistingScript (os, " %WORKSPACE%\\ tests\\ x64_arm64_altjit.cmd" , envScriptPath)
15521552 }
15531553
1554+ envScriptFinalize(os, envScriptPath)
1555+
15541556 // Note that buildCommands is an array of individually executed commands; we want all the commands used to
15551557 // create the SetStressModes.bat script to be executed together, hence we accumulate them as strings
15561558 // into a single script.
@@ -1746,7 +1748,11 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
17461748 buildCommands + = " ./build.sh verbose ${ lowerConfiguration} ${ architecture} "
17471749
17481750 def scriptFileName = " \$ WORKSPACE/set_stress_test_env.sh"
1749- buildCommands + = genStressModeScriptStep(os, scenario, Constants . jitStressModeScenarios[scenario], scriptFileName)
1751+
1752+ def envScriptCmds = envScriptCreate(os, scriptFileName)
1753+ envScriptCmds + = envScriptSetStressModeVariables(os, Constants . jitStressModeScenarios[scenario], scriptFileName)
1754+ envScriptCmds + = envScriptFinalize(os, scriptFileName)
1755+ buildCommands + = envScriptCmds
17501756
17511757 // Build and text corefx
17521758 def workspaceRelativeFxRoot = " _/fx"
@@ -1930,10 +1936,6 @@ Constants.allScenarios.each { scenario ->
19301936 if (os != ' Windows_NT' ) {
19311937 return
19321938 }
1933- // R2R test runs are not implemented for arm/armlb/arm64.
1934- if (architecture == ' arm' || architecture == ' armlb' || architecture == ' arm64' ) {
1935- return
1936- }
19371939 // Stress scenarios only run with Checked builds, not Release (they would work with Debug, but be slow).
19381940 if ((configuration != ' Checked' ) && isR2RStressScenario(scenario)) {
19391941 return
@@ -2498,8 +2500,10 @@ Constants.allScenarios.each { scenario ->
24982500 def testEnvOpt = " "
24992501 if (isJitStressScenario(scenario)) {
25002502 def scriptFileName = " \$ WORKSPACE/set_stress_test_env.sh"
2501- def createScriptCmds = genStressModeScriptStep(os, scenario, Constants . jitStressModeScenarios[scenario], scriptFileName)
2502- shell(" ${ createScriptCmds} " )
2503+ def envScriptCmds = envScriptCreate(os, scriptFileName)
2504+ envScriptCmds + = envScriptSetStressModeVariables(os, Constants . jitStressModeScenarios[scenario], scriptFileName)
2505+ envScriptCmds + = envScriptFinalize(os, scriptFileName)
2506+ shell(" ${ envScriptCmds} " )
25032507 testEnvOpt = " --test-env=" + scriptFileName
25042508 }
25052509
@@ -2573,8 +2577,11 @@ Constants.allScenarios.each { scenario ->
25732577 }
25742578 }
25752579
2576- // TODO: do whatever is necessary to support enabling R2R testing. Environment variables,
2577- // crossgen the framework assemblies, etc.
2580+ if (isR2RScenario(scenario)) {
2581+ addEnvVariable(" RunCrossGen" , " true" )
2582+
2583+ // TODO: crossgen the framework assemblies
2584+ }
25782585
25792586 // Create the smarty command
25802587 def smartyCommand = " C:\\ Tools\\ Smarty.exe /noecid /noie /workers 9 /inc EXPECTED_PASS "
0 commit comments