summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/project-docs/ci-trigger-phrases.md2
-rwxr-xr-xnetci.groovy46
-rw-r--r--tests/scripts/format.py149
3 files changed, 196 insertions, 1 deletions
diff --git a/Documentation/project-docs/ci-trigger-phrases.md b/Documentation/project-docs/ci-trigger-phrases.md
index 95d982189b..3652565498 100644
--- a/Documentation/project-docs/ci-trigger-phrases.md
+++ b/Documentation/project-docs/ci-trigger-phrases.md
@@ -67,6 +67,7 @@ To trigger a job, post a comment on your PR with "@dotnet-bot {trigger-phrase}".
- **Windows_NT x64 Checked GCStress=0xc JitStress=2 Build & Test:** "test Windows_NT gcstress0xc_jitstress2"
- **Windows_NT x64 Checked GCStress=0xc MinOpts Heap Verify 1 Build & Test:** "test Windows_NT gcstress0xc_minopts_heapverify1"
- **Windows_NT x64 Checked Long-Running GC Build & Test:**: "test Windows_NT x64 Checked longgc"
+- **Windows_NT x64 Formatting:**: "test Windows_NT formatting"
- **Windows_NT x64 Checked CoreFX Baseline Build & Test:** "test Windows_NT corefx_baseline"
- **Windows_NT x64 Checked CoreFX MinOpts Build & Test:** "test Windows_NT corefx_minopts"
- **Windows_NT x64 Checked CoreFX JitStress=1 Build & Test:** "test Windows_NT corefx_jitstress1"
@@ -220,6 +221,7 @@ To trigger a job, post a comment on your PR with "@dotnet-bot {trigger-phrase}".
- **Ubuntu x64 Checked GCStress=0xc JitStress=2 Build & Test:** "test Ubuntu gcstress0xc_jitstress2"
- **Ubuntu x64 Checked GCStress=0xc MinOpts Heap Verify 1 Build & Test:** "test Ubuntu gcstress0xc_minopts_heapverify1"
- **Ubuntu x64 Checked Long-Running GC Build & Test:**: "test Ubuntu Checked longgc"
+- **Ubuntu x64 Formatting:**: "test Ubuntu formatting"
- **Ubuntu x64 Checked CoreFX Baseline Build & Test:** "test Ubuntu corefx_baseline"
- **Ubuntu x64 Checked CoreFX MinOpts Build & Test:** "test Ubuntu corefx_minopts"
- **Ubuntu x64 Checked CoreFX JitStress=1 Build & Test:** "test Ubuntu corefx_jitstress1"
diff --git a/netci.groovy b/netci.groovy
index b31749c7b1..071048dffa 100755
--- a/netci.groovy
+++ b/netci.groovy
@@ -76,7 +76,7 @@ class Constants {
'r2r_jitstressregs4', 'r2r_jitstressregs8', 'r2r_jitstressregsx10', 'r2r_jitstressregsx80',
'r2r_jitminopts', 'r2r_jitforcerelocs']
// This is the basic set of scenarios
- def static basicScenarios = ['default', 'pri1', 'ilrt', 'r2r', 'pri1r2r', 'gcstress15_pri1r2r', 'longgc', 'coverage', 'gcsimulator'] + r2rJitStressScenarios
+ def static basicScenarios = ['default', 'pri1', 'ilrt', 'r2r', 'pri1r2r', 'gcstress15_pri1r2r', 'longgc', 'coverage', 'formatting', 'gcsimulator'] + r2rJitStressScenarios
def static configurationList = ['Debug', 'Checked', 'Release']
// This is the set of architectures
def static architectureList = ['arm', 'arm64', 'x64', 'x86ryujit', 'x86lb']
@@ -249,6 +249,10 @@ def static getJobName(def configuration, def architecture, def os, def scenario,
// For now we leave x64 off of the name for compatibility with other jobs
baseName = configuration.toLowerCase() + '_' + os.toLowerCase()
}
+ else if (scenario == 'formatting') {
+ // we don't care about the configuration for the formatting job. It runs all configs
+ baseName = architecture.toLowerCase() + '_' + os.toLowerCase()
+ }
else {
baseName = architecture.toLowerCase() + '_' + configuration.toLowerCase() + '_' + os.toLowerCase()
}
@@ -454,6 +458,11 @@ def static addTriggers(def job, def branch, def isPR, def architecture, def os,
assert architecture == 'x64'
Utilities.addPeriodicTrigger(job, '@weekly')
break
+ case 'formatting':
+ assert (os == 'Windows_NT' || os == "Ubuntu")
+ assert architecture == 'x64'
+ Utilities.addGithubPushTrigger(job)
+ break
case 'jitstressregs1':
case 'jitstressregs2':
case 'jitstressregs3':
@@ -543,6 +552,15 @@ def static addTriggers(def job, def branch, def isPR, def architecture, def os,
}
break
}
+
+ if (scenario == 'formatting') {
+ assert configuration == 'Checked'
+ if (os == 'Windows_NT' || os == 'Ubuntu') {
+ Utilities.addGithubPRTriggerForBranch(job, branch, "${os} ${architecture} Formatting", "(?i).*test\\W+${os}\\W+formatting.*")
+ }
+ break
+ }
+
switch (os) {
// OpenSUSE, Debian & RedHat get trigger phrases for pri 0 build, and pri 1 build & test
case 'OpenSUSE13.2':
@@ -1641,6 +1659,21 @@ combinedScenarios.each { scenario ->
return
}
break
+ // We only run Windows and Ubuntu x64 Checked for formatting right now
+ case 'formatting':
+ if (os != 'Windows_NT' && os != 'Ubuntu') {
+ return
+ }
+ if (architecture != 'x64') {
+ return
+ }
+ if (configuration != 'Checked') {
+ return
+ }
+ if (isBuildOnly) {
+ return
+ }
+ break
case 'default':
// Nothing skipped
break
@@ -1706,6 +1739,10 @@ combinedScenarios.each { scenario ->
buildCommands += "build.cmd ${lowerConfiguration} ${arch} skiptests"
buildCommands += "set __TestIntermediateDir=int&&build-test.cmd ${lowerConfiguration} ${arch}"
}
+ else if (scenario == 'formatting') {
+ buildCommands += "python tests\\scripts\\format.py -c %WORKSPACE% -o Windows_NT -a ${arch}"
+ break
+ }
else {
println("Unknown scenario: ${scenario}")
assert false
@@ -1900,6 +1937,11 @@ combinedScenarios.each { scenario ->
if (architecture == 'x86ryujit' || architecture == 'x86lb') {
arch = 'x86'
}
+
+ if (scenario == 'formatting') {
+ buildCommands += "python tests/scripts/format.py -c \${WORKSPACE} -o Linux -a ${arch}"
+ break
+ }
if (!enableCorefxTesting) {
// We run pal tests on all OS but generate mscorlib (and thus, nuget packages)
@@ -2167,6 +2209,8 @@ combinedScenarios.each { scenario ->
if (configuration != 'Release') {
return
}
+ case 'formatting':
+ return
case 'default':
// Nothing skipped
break
diff --git a/tests/scripts/format.py b/tests/scripts/format.py
new file mode 100644
index 0000000000..e89aad7e1b
--- /dev/null
+++ b/tests/scripts/format.py
@@ -0,0 +1,149 @@
+#!/usr/bin/env python
+#
+## Licensed to the .NET Foundation under one or more agreements.
+## The .NET Foundation licenses this file to you under the MIT license.
+## See the LICENSE file in the project root for more information.
+#
+##
+# Title :format.py
+#
+################################################################################
+# Script to install and run jit-format over jit source for all configurations.
+################################################################################
+
+
+import urllib
+import argparse
+import os
+import sys
+import tarfile
+import zipfile
+import subprocess
+import urllib2
+import shutil
+
+def expandPath(path):
+ return os.path.abspath(os.path.expanduser(path))
+
+def main(argv):
+ parser = argparse.ArgumentParser()
+ required = parser.add_argument_group('required arguments')
+ required.add_argument('-a', '--arch', type=str,
+ default=None, help='architecture to run jit-format on')
+ required.add_argument('-o', '--os', type=str,
+ default=None, help='operating system')
+ required.add_argument('-c', '--coreclr', type=str,
+ default=None, help='full path to coreclr')
+
+ args, unknown = parser.parse_known_args(argv)
+
+ if unknown:
+ print('Ignorning argument(s): ', ','.join(unknown))
+
+ if args.coreclr is None:
+ print('Specify --coreclr')
+ return -1
+ if args.os is None:
+ print('Specifiy --os')
+ return -1
+ if args.arch is None:
+ print('Specify --arch')
+ return -1
+
+ if not os.path.isdir(expandPath(args.coreclr)):
+ print('Bad path to coreclr')
+ return -1
+
+ coreclr = args.coreclr
+ platform = args.os
+ arch = args.arch
+
+ # Download dotnetcli
+ dotnetcliUrl = ""
+ dotnetcliFilename = ""
+ dotnetcliPath = os.path.join(coreclr, 'Tools', 'dotnetcli-jitutils')
+
+ # Try to make the dotnetcli-jitutils directory if it doesn't exist
+ try:
+ os.makedirs(dotnetcliPath)
+ except OSError:
+ if not os.path.isdir(dotnetcliPath):
+ raise
+
+ if platform == 'Linux' or platform == 'OSX':
+ dotnetcliUrl = "https://go.microsoft.com/fwlink/?LinkID=809118"
+ dotnetcliFilename = os.path.join(dotnetcliPath, 'dotnetcli-jitutils.tar.gz')
+ elif platform == 'Windows_NT':
+ dotnetcliUrl = "https://go.microsoft.com/fwlink/?LinkID=809115"
+ dotnetcliFilename = os.path.join(dotnetcliPath, 'dotnetcli-jitutils.zip')
+ else:
+ print('Unknown os ', os)
+ return -1
+
+ response = urllib2.urlopen(dotnetcliUrl)
+ request_url = response.geturl()
+ print(request_url)
+ testfile = urllib.URLopener()
+ testfile.retrieve(request_url, dotnetcliFilename)
+
+ # Install dotnetcli
+
+ if platform == 'Linux' or platform == 'OSX':
+ tar = tarfile.open(dotnetcliFilename)
+ tar.extractall(dotnetcliPath)
+ tar.close()
+ elif platform == 'Windows_NT':
+ with zipfile.ZipFile(dotnetcliFilename, "r") as z:
+ z.extractall(dotnetcliPath)
+
+ # Download bootstrap
+ bootstrapFilename = ""
+
+ jitUtilsPath = os.path.join(coreclr, "jitutils")
+
+ if os.path.isdir(jitUtilsPath):
+ shutil.rmtree(dest, ignore_errors=True)
+
+ if platform == 'Linux' or platform == 'OSX':
+ bootstrapFilename = "bootstrap.sh"
+ elif platform == 'Windows_NT':
+ bootstrapFilename = "bootstrap.cmd"
+
+ bootstrapUrl = "https://raw.githubusercontent.com/dotnet/jitutils/master/" + bootstrapFilename
+
+ testfile.retrieve(bootstrapUrl, bootstrapFilename)
+
+ # On Linux platforms, we need to make the bootstrap file executable
+ if platform == 'Linux' or platform == 'OSX':
+ os.chmod(bootstrapFilename, 0751)
+
+ # Run bootstrap
+ os.environ["PATH"] += os.pathsep + dotnetcliPath
+ proc = subprocess.Popen([os.path.join(coreclr, bootstrapFilename)], shell=True)
+
+ output,error = proc.communicate()
+ print(output)
+ print(error)
+
+ # Run jit-format
+ returncode = 0
+ os.environ["PATH"] += os.pathsep + os.path.join(coreclr, "jitutils", "bin")
+
+ for build in ["Checked", "Debug", "Release"]:
+ for project in ["dll", "standalone", "crossgen"]:
+ proc = subprocess.Popen(["jit-format", "-a", arch, "-b", build, "-o", platform,
+ "-c", coreclr, "--verbose", "--projects", project], shell=True)
+ output,error = proc.communicate()
+ errorcode = proc.returncode
+
+ print(output)
+ print(error)
+
+ if errorcode != 0:
+ returncode = errorcode
+
+ return returncode
+
+if __name__ == '__main__':
+ return_code = main(sys.argv[1:])
+ sys.exit(return_code)