[commit: ghc] wip/jenkins: Clean up treatment of tests (7fc463a)

git at git.haskell.org git at git.haskell.org
Sat Jun 17 13:49:54 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/jenkins
Link       : http://ghc.haskell.org/trac/ghc/changeset/7fc463a626998e6a9081ba52b6d633a966eefdc3/ghc

>---------------------------------------------------------------

commit 7fc463a626998e6a9081ba52b6d633a966eefdc3
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Tue May 30 01:10:56 2017 -0400

    Clean up treatment of tests


>---------------------------------------------------------------

7fc463a626998e6a9081ba52b6d633a966eefdc3
 Jenkinsfile | 80 +++++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 51 insertions(+), 29 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 9f93707..9420de6 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -6,41 +6,45 @@ properties(
       [
         booleanParam(name: 'build_docs', defaultValue: false, description: 'build and upload documentation'),
         booleanParam(name: 'nightly', defaultValue: false, description: 'are we building a nightly?'),
-        booleanParam(name: 'buildBindist', defaultValue: false, description: 'prepare and archive a binary distribution?'),
         booleanParam(name: 'runNofib', defaultValue: false, description: 'run nofib and archive results')
       ])
   ])
 
 parallel (
   "linux x86-64"       : {
-    node(label: 'linux && amd64') {buildGhc(runNoFib: params.runNofib)}
+    node(label: 'linux && amd64') {buildAndTestGhc(targetTriple: 'x86_64-linux-gnu')}
   },
   "linux x86-64 -> aarch64 unreg" : {
-    node(label: 'linux && amd64') {buildGhc(crossTarget: 'aarch64-linux-gnu', unreg: true)}
+    node(label: 'linux && amd64') {buildAndTestGhc(cross: true, targetTriple: 'aarch64-linux-gnu', unreg: true)}
   },
   "linux x86-64 -> aarch64" : {
-    node(label: 'linux && amd64') {buildGhc(runNoFib: params.runNofib, crossTarget: 'aarch64-linux-gnu')}
+    node(label: 'linux && amd64') {buildGhc(cross: true, targetTriple: 'aarch64-linux-gnu')}
+    node(label: 'linux && aarch64') {testGhc(targetTriple: 'aarch64-linux-gnu')}
   },
   "aarch64"            : {
-    node(label: 'linux && aarch64') {buildGhc(runNoFib: false)}
+    node(label: 'linux && aarch64') {buildGhc(targetTriple: 'aarch64-linux-gnu')}
   },
   "freebsd"            : {
     node(label: 'freebsd && amd64') {
-      buildGhc(runNoFib: false, makeCmd: 'gmake', disableLargeAddrSpace: true)
+      buildGhc(targetTriple: 'x86_64-portbld-freebsd11.0', makeCmd: 'gmake', disableLargeAddrSpace: true)
     }
   },
   // Requires cygpath plugin?
   "windows 64"         : {
     node(label: 'windows && amd64') {
-      withMingw('MINGW64') { buildGhc(runNoFib: false) }
+      withMingw('MINGW64') { buildAndTestGhc(targetTriple: 'x86_64-w64-mingw32') }
     }
   },
   "windows 32"         : {
     node(label: 'windows && amd64') {
-      withMingw('MINGW64') { buildGhc(runNoFib: false) }
+      withMingw('MINGW32') { buildAndTestGhc(targetTriple: 'x86_64-pc-msys') }
     }
   },
-  //"osx"                : {node(label: 'darwin') {buildGhc(runNoFib: params.runNoFib)}}
+  /*
+  "osx"                : {
+    node(label: 'darwin') {buildGhc(targetTriple: 'x86_64-apple-darwin16.0.0')}
+  }
+  */
 )
 
 def withMingw(String msystem, Closure f) {
@@ -73,9 +77,14 @@ def installPackages(String[] pkgs) {
   sh "cabal install -j${env.THREADS} --with-compiler=`pwd`/inplace/bin/ghc-stage2 --package-db=`pwd`/inplace/lib/package.conf.d ${pkgs.join(' ')}"
 }
 
+def buildAndTestGhc(params) {
+  buildGhc(params)
+  testGhc(params)
+}
+
 def buildGhc(params) {
-  boolean runNoFib = params?.runNofib ?: false
-  String crossTarget = params?.crossTarget
+  String targetTriple = params?.targetTriple
+  boolean cross = params?.crossTarget ?: false
   boolean unreg = params?.unreg ?: false
   boolean disableLargeAddrSpace = params?.disableLargeAddrSpace ?: false
   String makeCmd = params?.makeCmd ?: 'make'
@@ -97,7 +106,7 @@ def buildGhc(params) {
                ValidateHpc=NO
                BUILD_DPH=NO
                """
-    if (crossTarget) {
+    if (cross) {
       build_mk += """
                   # Cross compiling
                   HADDOCK_DOCS=NO
@@ -110,8 +119,8 @@ def buildGhc(params) {
     writeFile(file: 'mk/build.mk', text: build_mk)
 
     def configure_opts = ['--enable-tarballs-autodownload']
-    if (crossTarget) {
-      configure_opts += '--target=${crossTarget}'
+    if (cross) {
+      configure_opts += '--target=${targetTriple}'
     }
     if (disableLargeAddrSpace) {
       configure_opts += '--disable-large-address-space'
@@ -128,13 +137,35 @@ def buildGhc(params) {
   stage('Build') {
     sh "${makeCmd} -j${env.THREADS}"
   }
+
+  stage('Prepare binary distribution') {
+    sh "${makeCmd} binary-dist"
+    def tarName = sh(script: "${makeCmd} -s echo VALUE=BIN_DIST_PREP_TAR_COMP",
+                     returnStdout: true)
+    def ghcVersion = sh(script: "${makeCmd} -s echo VALUE=ProjectVersion")
+    writeFile "ghc-version" ghcVersion
+    archiveArtifacts "../${tarName}"
+    // Write a file so we can easily file the tarball and bindist directory later
+    stash(name: "bindist-${targetTriple}", includes: "ghc-version,../${tarName}")
+  }
 }
 
 def testGhc(params) {
+  String targetTriple = params?.targetTriple
   String makeCmd = params?.makeCmd ?: 'make'
+  boolean runNofib = params?.runNofib
+
+  stage('Extract binary distribution') {
+    sh "mkdir tmp"
+    dir "tmp"
+    unstash "bindist-${targetTriple}"
+    def ghcVersion = readFile "ghc-version"
+    sh "tar -xf ${ghcVersion}-${targetTriple}.tar.xz"
+    dir ghcVersion
+  }
 
   stage('Install testsuite dependencies') {
-    if (params.nightly && !crossTarget) {
+    if (params.nightly) {
       def pkgs = ['mtl', 'parallel', 'parsec', 'primitive', 'QuickCheck',
                   'random', 'regex-compat', 'syb', 'stm', 'utf8-string',
                   'vector']
@@ -143,17 +174,15 @@ def testGhc(params) {
   }
 
   stage('Run testsuite') {
-    if (!crossTarget) {
-      def target = 'test'
-      if (params.nightly) {
-        target = 'slowtest'
-      }
-      sh "${makeCmd} THREADS=${env.THREADS} ${target}"
+    def target = 'test'
+    if (params.nightly) {
+      target = 'slowtest'
     }
+    sh "${makeCmd} THREADS=${env.THREADS} ${target}"
   }
 
   stage('Run nofib') {
-    if (runNofib && !crossTarget) {
+    if (runNofib) {
       installPkgs(['regex-compat'])
       sh """
          cd nofib
@@ -164,11 +193,4 @@ def testGhc(params) {
       archiveArtifacts 'nofib.log'
     }
   }
-
-  stage('Prepare bindist') {
-    if (params.buildBindist) {
-      sh "${makeCmd} binary-dist"
-      archiveArtifacts 'ghc-*.tar.xz'
-    }
-  }
 }



More information about the ghc-commits mailing list