| [a63ad80] | 1 | #!groovy
|
|---|
| 2 |
|
|---|
| [7a230fd] | 3 | import groovy.transform.Field
|
|---|
| 4 |
|
|---|
| [29f4fe62] | 5 | //===========================================================================================================
|
|---|
| [9beae23] | 6 | // Main loop of the compilation
|
|---|
| [29f4fe62] | 7 | //===========================================================================================================
|
|---|
| [56a9ce6] | 8 |
|
|---|
| [85142648] | 9 | node('master') {
|
|---|
| 10 | // Globals
|
|---|
| 11 | BuildDir = pwd tmp: true
|
|---|
| 12 | SrcDir = pwd tmp: false
|
|---|
| 13 | Settings = null
|
|---|
| [1483a16] | 14 | Tools = null
|
|---|
| [4f9e706] | 15 |
|
|---|
| [85142648] | 16 | // Local variables
|
|---|
| 17 | def err = null
|
|---|
| 18 | def log_needed = false
|
|---|
| [5b8413b4] | 19 |
|
|---|
| [85142648] | 20 | currentBuild.result = "SUCCESS"
|
|---|
| [4f9e706] | 21 |
|
|---|
| [85142648] | 22 | try {
|
|---|
| 23 | //Wrap build to add timestamp to command line
|
|---|
| 24 | wrap([$class: 'TimestamperBuildWrapper']) {
|
|---|
| [0ef06b6] | 25 |
|
|---|
| [85142648] | 26 | Settings = prepare_build()
|
|---|
| [952ee7a] | 27 |
|
|---|
| [85142648] | 28 | node(Settings.Architecture.node) {
|
|---|
| [18e4cd0] | 29 | try {
|
|---|
| 30 | BuildDir = pwd tmp: true
|
|---|
| 31 | SrcDir = pwd tmp: false
|
|---|
| [23a14d86] | 32 |
|
|---|
| [18e4cd0] | 33 | Tools.Clean()
|
|---|
| [7aebc62] | 34 |
|
|---|
| [18e4cd0] | 35 | Tools.Checkout()
|
|---|
| [fde808df] | 36 |
|
|---|
| [18e4cd0] | 37 | build()
|
|---|
| [95fdb0a] | 38 |
|
|---|
| [18e4cd0] | 39 | test()
|
|---|
| [95fdb0a] | 40 |
|
|---|
| [18e4cd0] | 41 | benchmark()
|
|---|
| [95fdb0a] | 42 |
|
|---|
| [18e4cd0] | 43 | build_doc()
|
|---|
| [7359098] | 44 |
|
|---|
| [18e4cd0] | 45 | publish()
|
|---|
| 46 | }
|
|---|
| 47 | catch (Exception e) {
|
|---|
| 48 | //Store the result of the build log
|
|---|
| 49 | currentBuild.result = "${Tools.StageName} FAILURE".trim()
|
|---|
| 50 | throw e
|
|---|
| 51 | }
|
|---|
| [85142648] | 52 | }
|
|---|
| [9beae23] | 53 |
|
|---|
| [85142648] | 54 | // Update the build directories when exiting the node
|
|---|
| 55 | BuildDir = pwd tmp: true
|
|---|
| 56 | SrcDir = pwd tmp: false
|
|---|
| [9beae23] | 57 | }
|
|---|
| [738cf8f] | 58 | }
|
|---|
| 59 |
|
|---|
| [85142648] | 60 | //If an exception is caught we need to change the status and remember to
|
|---|
| 61 | //attach the build log to the email
|
|---|
| 62 | catch (Exception caughtError) {
|
|---|
| 63 | //An error has occured, the build log is relevent
|
|---|
| 64 | log_needed = true
|
|---|
| [9beae23] | 65 |
|
|---|
| [852ae0ea] | 66 | //rethrow error later
|
|---|
| 67 | err = caughtError
|
|---|
| 68 |
|
|---|
| 69 | echo "Error caught, status: ${currentBuild.result}"
|
|---|
| 70 | echo err.toString()
|
|---|
| [85142648] | 71 | }
|
|---|
| [738cf8f] | 72 |
|
|---|
| [85142648] | 73 | finally {
|
|---|
| 74 | //Send email with final results if this is not a full build
|
|---|
| 75 | email(log_needed)
|
|---|
| [9beae23] | 76 |
|
|---|
| [85142648] | 77 | echo 'Build Completed'
|
|---|
| [734891d] | 78 |
|
|---|
| [85142648] | 79 | /* Must re-throw exception to propagate error */
|
|---|
| 80 | if (err) {
|
|---|
| 81 | throw err
|
|---|
| 82 | }
|
|---|
| [738cf8f] | 83 | }
|
|---|
| 84 | }
|
|---|
| [29f4fe62] | 85 | //===========================================================================================================
|
|---|
| [9beae23] | 86 | // Main compilation routines
|
|---|
| [29f4fe62] | 87 | //===========================================================================================================
|
|---|
| [95fdb0a] | 88 | def build() {
|
|---|
| [e507c11] | 89 | debug = true
|
|---|
| 90 | release = Settings.RunAllTests || Settings.RunBenchmark
|
|---|
| [91aa5ab] | 91 | Tools.BuildStage('Build : configure', true) {
|
|---|
| [dcf1979] | 92 | // Configure must be run inside the tree
|
|---|
| 93 | dir (SrcDir) {
|
|---|
| 94 | // Generate the necessary build files
|
|---|
| 95 | sh './autogen.sh'
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| [50f2cfc] | 98 | // Build outside of the src tree to ease cleaning
|
|---|
| [5b8413b4] | 99 | dir (BuildDir) {
|
|---|
| [8e58264] | 100 | //Configure the compilation (Output is not relevant)
|
|---|
| [50f2cfc] | 101 | //Use the current directory as the installation target so nothing escapes the sandbox
|
|---|
| 102 | //Also specify the compiler by hand
|
|---|
| [3fc5f010] | 103 | targets=""
|
|---|
| [d4510ea] | 104 | if( Settings.RunAllTests || Settings.RunBenchmark ) {
|
|---|
| [6bde81d] | 105 | targets="--with-target-hosts='host:debug,host:nodebug'"
|
|---|
| [3fc5f010] | 106 | } else {
|
|---|
| [6bde81d] | 107 | targets="--with-target-hosts='host:debug'"
|
|---|
| [3fc5f010] | 108 | }
|
|---|
| 109 |
|
|---|
| [d21dd3cb] | 110 | ast = Settings.NewAST ? "--enable-new-ast" : "--disable-new-ast"
|
|---|
| 111 |
|
|---|
| 112 | sh "${SrcDir}/configure CXX=${Settings.Compiler.CXX} CC=${Settings.Compiler.CC} ${Settings.Architecture.flags} AR=gcc-ar RANLIB=gcc-ranlib ${targets} ${ast} --quiet --prefix=${BuildDir}"
|
|---|
| [f253e4a] | 113 |
|
|---|
| 114 | // Configure libcfa
|
|---|
| [e70e54e] | 115 | sh 'make -j 8 --no-print-directory configure-libcfa'
|
|---|
| [e507c11] | 116 | }
|
|---|
| 117 | }
|
|---|
| 118 |
|
|---|
| [91aa5ab] | 119 | Tools.BuildStage('Build : cfa-cpp', true) {
|
|---|
| [e507c11] | 120 | // Build outside of the src tree to ease cleaning
|
|---|
| 121 | dir (BuildDir) {
|
|---|
| 122 | // Build driver
|
|---|
| 123 | sh 'make -j 8 --no-print-directory -C driver'
|
|---|
| 124 |
|
|---|
| 125 | // Build translator
|
|---|
| 126 | sh 'make -j 8 --no-print-directory -C src'
|
|---|
| 127 | }
|
|---|
| 128 | }
|
|---|
| [1752d0e] | 129 |
|
|---|
| [91aa5ab] | 130 | Tools.BuildStage('Build : libcfa(debug)', debug) {
|
|---|
| [e507c11] | 131 | // Build outside of the src tree to ease cleaning
|
|---|
| 132 | dir (BuildDir) {
|
|---|
| 133 | sh "make -j 8 --no-print-directory -C libcfa/${Settings.Architecture.name}-debug"
|
|---|
| 134 | }
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| [91aa5ab] | 137 | Tools.BuildStage('Build : libcfa(nodebug)', release) {
|
|---|
| [e507c11] | 138 | // Build outside of the src tree to ease cleaning
|
|---|
| 139 | dir (BuildDir) {
|
|---|
| 140 | sh "make -j 8 --no-print-directory -C libcfa/${Settings.Architecture.name}-nodebug"
|
|---|
| [50f2cfc] | 141 | }
|
|---|
| [620dd2b] | 142 | }
|
|---|
| [aa96fba] | 143 |
|
|---|
| [91aa5ab] | 144 | Tools.BuildStage('Build : install', true) {
|
|---|
| [aa96fba] | 145 | // Build outside of the src tree to ease cleaning
|
|---|
| 146 | dir (BuildDir) {
|
|---|
| 147 | sh "make -j 8 --no-print-directory install"
|
|---|
| 148 | }
|
|---|
| 149 | }
|
|---|
| [95fdb0a] | 150 | }
|
|---|
| [24eecab] | 151 |
|
|---|
| [95fdb0a] | 152 | def test() {
|
|---|
| [4c1b9ea8] | 153 | try {
|
|---|
| [91aa5ab] | 154 | Tools.BuildStage('Test: short', !Settings.RunAllTests) {
|
|---|
| [4c1b9ea8] | 155 | dir (BuildDir) {
|
|---|
| [3e93c00] | 156 | //Run the tests from the tests directory
|
|---|
| [4c51aca] | 157 | sh "make --no-print-directory -C tests archiveerrors=${BuildDir}/tests/crashes/short"
|
|---|
| [3e93c00] | 158 | }
|
|---|
| [4c1b9ea8] | 159 | }
|
|---|
| 160 |
|
|---|
| [91aa5ab] | 161 | Tools.BuildStage('Test: full', Settings.RunAllTests) {
|
|---|
| [4c1b9ea8] | 162 | dir (BuildDir) {
|
|---|
| 163 | //Run the tests from the tests directory
|
|---|
| [4c51aca] | 164 | sh """make --no-print-directory -C tests timeouts="--timeout=600 --global-timeout=14400" all-tests debug=yes archiveerrors=${BuildDir}/tests/crashes/full-debug"""
|
|---|
| 165 | sh """make --no-print-directory -C tests timeouts="--timeout=600 --global-timeout=14400" all-tests debug=no archiveerrors=${BuildDir}/tests/crashes/full-nodebug"""
|
|---|
| [143e6f3] | 166 | }
|
|---|
| [9beae23] | 167 | }
|
|---|
| [620dd2b] | 168 | }
|
|---|
| [4c1b9ea8] | 169 | catch (Exception err) {
|
|---|
| 170 | echo "Archiving core dumps"
|
|---|
| [c95fdc9] | 171 | dir (BuildDir) {
|
|---|
| [62f96ae] | 172 | archiveArtifacts artifacts: "tests/crashes/**/*,lib/**/lib*.so*", fingerprint: true
|
|---|
| [c95fdc9] | 173 | }
|
|---|
| [4c1b9ea8] | 174 | throw err
|
|---|
| 175 | }
|
|---|
| [95fdb0a] | 176 | }
|
|---|
| 177 |
|
|---|
| 178 | def benchmark() {
|
|---|
| [91aa5ab] | 179 | Tools.BuildStage('Benchmark', Settings.RunBenchmark) {
|
|---|
| [5b8413b4] | 180 | dir (BuildDir) {
|
|---|
| [0dc3ac3] | 181 | //Append bench results
|
|---|
| [c6f1f3e] | 182 | sh "make --no-print-directory -C benchmark jenkins arch=${Settings.Architecture.name}"
|
|---|
| [0dc3ac3] | 183 | }
|
|---|
| [620dd2b] | 184 | }
|
|---|
| [9beae23] | 185 | }
|
|---|
| [efd60d67] | 186 |
|
|---|
| [95fdb0a] | 187 | def build_doc() {
|
|---|
| [91aa5ab] | 188 | Tools.BuildStage('Documentation', Settings.BuildDocumentation) {
|
|---|
| [9beae23] | 189 | dir ('doc/user') {
|
|---|
| 190 | make_doc()
|
|---|
| 191 | }
|
|---|
| 192 |
|
|---|
| 193 | dir ('doc/refrat') {
|
|---|
| 194 | make_doc()
|
|---|
| 195 | }
|
|---|
| [620dd2b] | 196 | }
|
|---|
| [9beae23] | 197 | }
|
|---|
| 198 |
|
|---|
| [95fdb0a] | 199 | def publish() {
|
|---|
| [91aa5ab] | 200 | Tools.BuildStage('Publish', true) {
|
|---|
| [95fdb0a] | 201 |
|
|---|
| [1b3eef8] | 202 | if( Settings.Publish && !Settings.RunBenchmark ) { echo 'No results to publish!!!' }
|
|---|
| [95fdb0a] | 203 |
|
|---|
| [3221a2b] | 204 | def groupCompile = new PlotGroup('Compilation', 'duration (s) - lower is better', true)
|
|---|
| 205 | def groupConcurrency = new PlotGroup('Concurrency', 'duration (n) - lower is better', false)
|
|---|
| [a2a0065] | 206 |
|
|---|
| [3898392] | 207 | //Then publish the results
|
|---|
| [13d2dac] | 208 | do_plot(Settings.RunBenchmark && Settings.Publish, 'compile' , groupCompile , false, 'Compilation')
|
|---|
| 209 | do_plot(Settings.RunBenchmark && Settings.Publish, 'compile.diff' , groupCompile , true , 'Compilation (relative)')
|
|---|
| 210 | do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch' , groupConcurrency, false, 'Context Switching')
|
|---|
| 211 | do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch.diff' , groupConcurrency, true , 'Context Switching (relative)')
|
|---|
| 212 | do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex' , groupConcurrency, false, 'Mutual Exclusion')
|
|---|
| 213 | do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex.diff' , groupConcurrency, true , 'Mutual Exclusion (relative)')
|
|---|
| 214 | do_plot(Settings.RunBenchmark && Settings.Publish, 'scheduling' , groupConcurrency, false, 'Internal and External Scheduling')
|
|---|
| 215 | do_plot(Settings.RunBenchmark && Settings.Publish, 'scheduling.diff', groupConcurrency, true , 'Internal and External Scheduling (relative)')
|
|---|
| [620dd2b] | 216 | }
|
|---|
| [95fdb0a] | 217 | }
|
|---|
| 218 |
|
|---|
| [29f4fe62] | 219 | //===========================================================================================================
|
|---|
| 220 | //Routine responsible of sending the email notification once the build is completed
|
|---|
| 221 | //===========================================================================================================
|
|---|
| [a336d46] | 222 | //Standard build email notification
|
|---|
| [13c98a4] | 223 | def email(boolean log) {
|
|---|
| [a336d46] | 224 | //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
|
|---|
| 225 | //Configurations for email format
|
|---|
| 226 | echo 'Notifying users of result'
|
|---|
| 227 |
|
|---|
| 228 | def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase()
|
|---|
| 229 | def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}] - branch ${env.BRANCH_NAME}"
|
|---|
| [13c98a4] | 230 | def email_body = """<p>This is an automated email from the Jenkins build machine. It was
|
|---|
| [a336d46] | 231 | generated because of a git hooks/post-receive script following
|
|---|
| [986e260] | 232 | a ref change which was pushed to the C\u2200 repository.</p>
|
|---|
| [6a531ab] | 233 | """ + Tools.GitLogMessage()
|
|---|
| [e8a22a7] | 234 |
|
|---|
| [13c98a4] | 235 | def email_to = !Settings.IsSandbox ? "cforall@lists.uwaterloo.ca" : "tdelisle@uwaterloo.ca"
|
|---|
| [e8a22a7] | 236 |
|
|---|
| [13c98a4] | 237 | if( Settings && !Settings.Silent ) {
|
|---|
| [094a42c] | 238 | //send email notification
|
|---|
| 239 | emailext body: email_body, subject: email_subject, to: email_to, attachLog: log
|
|---|
| 240 | } else {
|
|---|
| 241 | echo "Would send email to: ${email_to}"
|
|---|
| 242 | echo "With title: ${email_subject}"
|
|---|
| 243 | echo "Content: \n${email_body}"
|
|---|
| 244 | }
|
|---|
| [e8a22a7] | 245 | }
|
|---|
| [5b8413b4] | 246 |
|
|---|
| 247 | //===========================================================================================================
|
|---|
| 248 | // Helper classes/variables/routines
|
|---|
| 249 | //===========================================================================================================
|
|---|
| 250 | //Description of a compiler (Must be serializable since pipelines are persistent)
|
|---|
| 251 | class CC_Desc implements Serializable {
|
|---|
| [93fe3154] | 252 | public String name
|
|---|
| 253 | public String CXX
|
|---|
| [6ebc13f] | 254 | public String CC
|
|---|
| [bf22bc6] | 255 | public String lto
|
|---|
| [93fe3154] | 256 |
|
|---|
| [bf22bc6] | 257 | CC_Desc(String name, String CXX, String CC, String lto) {
|
|---|
| [93fe3154] | 258 | this.name = name
|
|---|
| 259 | this.CXX = CXX
|
|---|
| [bf22bc6] | 260 | this.CC = CC
|
|---|
| 261 | this.lto = lto
|
|---|
| [5b8413b4] | 262 | }
|
|---|
| 263 | }
|
|---|
| 264 |
|
|---|
| 265 | //Description of an architecture (Must be serializable since pipelines are persistent)
|
|---|
| 266 | class Arch_Desc implements Serializable {
|
|---|
| 267 | public String name
|
|---|
| 268 | public String flags
|
|---|
| [5307c33] | 269 | public String node
|
|---|
| [5b8413b4] | 270 |
|
|---|
| [5307c33] | 271 | Arch_Desc(String name, String flags, String node) {
|
|---|
| [5b8413b4] | 272 | this.name = name
|
|---|
| 273 | this.flags = flags
|
|---|
| [5307c33] | 274 | this.node = node
|
|---|
| [5b8413b4] | 275 | }
|
|---|
| 276 | }
|
|---|
| 277 |
|
|---|
| 278 | class BuildSettings implements Serializable {
|
|---|
| 279 | public final CC_Desc Compiler
|
|---|
| 280 | public final Arch_Desc Architecture
|
|---|
| [d21dd3cb] | 281 | public final Boolean NewAST
|
|---|
| [5b8413b4] | 282 | public final Boolean RunAllTests
|
|---|
| 283 | public final Boolean RunBenchmark
|
|---|
| 284 | public final Boolean BuildDocumentation
|
|---|
| 285 | public final Boolean Publish
|
|---|
| 286 | public final Boolean Silent
|
|---|
| 287 | public final Boolean IsSandbox
|
|---|
| 288 | public final String DescLong
|
|---|
| 289 | public final String DescShort
|
|---|
| 290 |
|
|---|
| [a336d46] | 291 | public String GitNewRef
|
|---|
| 292 | public String GitOldRef
|
|---|
| 293 |
|
|---|
| [490cb3c] | 294 | BuildSettings(java.util.Collections$UnmodifiableMap param, String branch) {
|
|---|
| [5b8413b4] | 295 | switch( param.Compiler ) {
|
|---|
| [099f5bd] | 296 | case 'gcc-9':
|
|---|
| [bf22bc6] | 297 | this.Compiler = new CC_Desc('gcc-9', 'g++-9', 'gcc-9', '-flto=auto')
|
|---|
| [099f5bd] | 298 | break
|
|---|
| 299 | case 'gcc-8':
|
|---|
| [bf22bc6] | 300 | this.Compiler = new CC_Desc('gcc-8', 'g++-8', 'gcc-8', '-flto=auto')
|
|---|
| [099f5bd] | 301 | break
|
|---|
| 302 | case 'gcc-7':
|
|---|
| [bf22bc6] | 303 | this.Compiler = new CC_Desc('gcc-7', 'g++-7', 'gcc-7', '-flto=auto')
|
|---|
| [099f5bd] | 304 | break
|
|---|
| [5b8413b4] | 305 | case 'gcc-6':
|
|---|
| [bf22bc6] | 306 | this.Compiler = new CC_Desc('gcc-6', 'g++-6', 'gcc-6', '-flto=auto')
|
|---|
| [5b8413b4] | 307 | break
|
|---|
| 308 | case 'gcc-5':
|
|---|
| [bf22bc6] | 309 | this.Compiler = new CC_Desc('gcc-5', 'g++-5', 'gcc-5', '-flto=auto')
|
|---|
| [5b8413b4] | 310 | break
|
|---|
| 311 | case 'gcc-4.9':
|
|---|
| [bf22bc6] | 312 | this.Compiler = new CC_Desc('gcc-4.9', 'g++-4.9', 'gcc-4.9', '-flto=auto')
|
|---|
| [5b8413b4] | 313 | break
|
|---|
| 314 | case 'clang':
|
|---|
| [391c065] | 315 | this.Compiler = new CC_Desc('clang', 'clang++-10', 'gcc-9', '-flto=thin -flto-jobs=0')
|
|---|
| [5b8413b4] | 316 | break
|
|---|
| 317 | default :
|
|---|
| 318 | error "Unhandled compiler : ${cc}"
|
|---|
| 319 | }
|
|---|
| 320 |
|
|---|
| 321 | switch( param.Architecture ) {
|
|---|
| 322 | case 'x64':
|
|---|
| [a3e8281] | 323 | this.Architecture = new Arch_Desc('x64', '--host=x86_64', 'x64')
|
|---|
| [5b8413b4] | 324 | break
|
|---|
| 325 | case 'x86':
|
|---|
| [a3e8281] | 326 | this.Architecture = new Arch_Desc('x86', '--host=i386', 'x86')
|
|---|
| [5b8413b4] | 327 | break
|
|---|
| 328 | default :
|
|---|
| 329 | error "Unhandled architecture : ${arch}"
|
|---|
| 330 | }
|
|---|
| 331 |
|
|---|
| [f95e8f0] | 332 | this.IsSandbox = (branch == "jenkins-sandbox")
|
|---|
| [d21dd3cb] | 333 | this.NewAST = param.NewAST
|
|---|
| [5b8413b4] | 334 | this.RunAllTests = param.RunAllTests
|
|---|
| [7a230fd] | 335 | this.RunBenchmark = param.RunBenchmark
|
|---|
| [5b8413b4] | 336 | this.BuildDocumentation = param.BuildDocumentation
|
|---|
| [7a230fd] | 337 | this.Publish = param.Publish
|
|---|
| [5b8413b4] | 338 | this.Silent = param.Silent
|
|---|
| 339 |
|
|---|
| 340 | def full = param.RunAllTests ? " (Full)" : ""
|
|---|
| [490cb3c] | 341 | this.DescShort = "${ this.Compiler.name }:${ this.Architecture.name }${full}"
|
|---|
| [5b8413b4] | 342 |
|
|---|
| [fe3d9ab] | 343 | final ast = this.NewAST ? "New AST" : "Old AST"
|
|---|
| [93fe3154] | 344 | this.DescLong = """Compiler : ${ this.Compiler.name } (${ this.Compiler.CXX }/${ this.Compiler.CC })
|
|---|
| [85799aa] | 345 | AST Version : ${ ast.toString() }
|
|---|
| [5b8413b4] | 346 | Architecture : ${ this.Architecture.name }
|
|---|
| 347 | Arc Flags : ${ this.Architecture.flags }
|
|---|
| 348 | Run All Tests : ${ this.RunAllTests.toString() }
|
|---|
| 349 | Run Benchmark : ${ this.RunBenchmark.toString() }
|
|---|
| 350 | Build Documentation : ${ this.BuildDocumentation.toString() }
|
|---|
| 351 | Publish : ${ this.Publish.toString() }
|
|---|
| 352 | Silent : ${ this.Silent.toString() }
|
|---|
| 353 | """
|
|---|
| [a336d46] | 354 |
|
|---|
| 355 | this.GitNewRef = ''
|
|---|
| 356 | this.GitOldRef = ''
|
|---|
| [5b8413b4] | 357 | }
|
|---|
| 358 | }
|
|---|
| 359 |
|
|---|
| [490cb3c] | 360 | class PlotGroup implements Serializable {
|
|---|
| 361 | public String name
|
|---|
| 362 | public String unit
|
|---|
| 363 | public boolean log
|
|---|
| 364 |
|
|---|
| 365 | PlotGroup(String name, String unit, boolean log) {
|
|---|
| 366 | this.name = name
|
|---|
| 367 | this.unit = unit
|
|---|
| 368 | this.log = log
|
|---|
| 369 | }
|
|---|
| 370 | }
|
|---|
| 371 |
|
|---|
| [5b8413b4] | 372 | def prepare_build() {
|
|---|
| 373 | // prepare the properties
|
|---|
| 374 | properties ([ \
|
|---|
| [62f96ae] | 375 | buildDiscarder(logRotator( \
|
|---|
| 376 | artifactDaysToKeepStr: '', \
|
|---|
| 377 | artifactNumToKeepStr: '', \
|
|---|
| 378 | daysToKeepStr: '730', \
|
|---|
| 379 | numToKeepStr: '1000' \
|
|---|
| 380 | )), \
|
|---|
| [5b8413b4] | 381 | [$class: 'ParametersDefinitionProperty', \
|
|---|
| 382 | parameterDefinitions: [ \
|
|---|
| 383 | [$class: 'ChoiceParameterDefinition', \
|
|---|
| 384 | description: 'Which compiler to use', \
|
|---|
| 385 | name: 'Compiler', \
|
|---|
| [c09ae73] | 386 | choices: 'gcc-9\ngcc-8\ngcc-7\ngcc-6\ngcc-5\ngcc-4.9\nclang', \
|
|---|
| [fe27d99] | 387 | defaultValue: 'gcc-8', \
|
|---|
| [5b8413b4] | 388 | ], \
|
|---|
| 389 | [$class: 'ChoiceParameterDefinition', \
|
|---|
| 390 | description: 'The target architecture', \
|
|---|
| 391 | name: 'Architecture', \
|
|---|
| 392 | choices: 'x64\nx86', \
|
|---|
| 393 | defaultValue: 'x64', \
|
|---|
| 394 | ], \
|
|---|
| [d21dd3cb] | 395 | [$class: 'BooleanParameterDefinition', \
|
|---|
| 396 | description: 'If true, build compiler using new AST', \
|
|---|
| 397 | name: 'NewAST', \
|
|---|
| [6a531ab] | 398 | defaultValue: true, \
|
|---|
| [d21dd3cb] | 399 | ], \
|
|---|
| [5b8413b4] | 400 | [$class: 'BooleanParameterDefinition', \
|
|---|
| 401 | description: 'If false, only the quick test suite is ran', \
|
|---|
| 402 | name: 'RunAllTests', \
|
|---|
| 403 | defaultValue: false, \
|
|---|
| [fe3d9ab] | 404 | ], \
|
|---|
| [5b8413b4] | 405 | [$class: 'BooleanParameterDefinition', \
|
|---|
| 406 | description: 'If true, jenkins also runs benchmarks', \
|
|---|
| 407 | name: 'RunBenchmark', \
|
|---|
| 408 | defaultValue: false, \
|
|---|
| 409 | ], \
|
|---|
| 410 | [$class: 'BooleanParameterDefinition', \
|
|---|
| 411 | description: 'If true, jenkins also builds documentation', \
|
|---|
| 412 | name: 'BuildDocumentation', \
|
|---|
| 413 | defaultValue: true, \
|
|---|
| 414 | ], \
|
|---|
| 415 | [$class: 'BooleanParameterDefinition', \
|
|---|
| 416 | description: 'If true, jenkins also publishes results', \
|
|---|
| 417 | name: 'Publish', \
|
|---|
| 418 | defaultValue: false, \
|
|---|
| 419 | ], \
|
|---|
| 420 | [$class: 'BooleanParameterDefinition', \
|
|---|
| 421 | description: 'If true, jenkins will not send emails', \
|
|---|
| 422 | name: 'Silent', \
|
|---|
| 423 | defaultValue: false, \
|
|---|
| 424 | ], \
|
|---|
| 425 | ],
|
|---|
| 426 | ]])
|
|---|
| 427 |
|
|---|
| [bd8dca2] | 428 | // It's unfortunate but it looks like we need to checkout the entire repo just to get
|
|---|
| 429 | // - the pretty git printer
|
|---|
| 430 | // - Jenkins.tools
|
|---|
| [4c55047] | 431 | checkout scm
|
|---|
| [2407853] | 432 |
|
|---|
| [1483a16] | 433 | Tools = load "Jenkins/tools.groovy"
|
|---|
| [bd8dca2] | 434 |
|
|---|
| [490cb3c] | 435 | final settings = new BuildSettings(params, env.BRANCH_NAME)
|
|---|
| [5b8413b4] | 436 |
|
|---|
| 437 | currentBuild.description = settings.DescShort
|
|---|
| 438 | echo settings.DescLong
|
|---|
| 439 |
|
|---|
| 440 | return settings
|
|---|
| 441 | }
|
|---|
| 442 |
|
|---|
| 443 | def make_doc() {
|
|---|
| 444 | def err = null
|
|---|
| 445 | try {
|
|---|
| 446 | sh 'make clean > /dev/null'
|
|---|
| 447 | sh 'make > /dev/null 2>&1'
|
|---|
| 448 | }
|
|---|
| 449 | catch (Exception caughtError) {
|
|---|
| 450 | err = caughtError //rethrow error later
|
|---|
| [65f4a51] | 451 | sh 'cat build/*.log'
|
|---|
| [5b8413b4] | 452 | }
|
|---|
| 453 | finally {
|
|---|
| 454 | if (err) throw err // Must re-throw exception to propagate error
|
|---|
| 455 | }
|
|---|
| [a2a0065] | 456 | }
|
|---|
| 457 |
|
|---|
| [3221a2b] | 458 | def do_plot(boolean new_data, String file, PlotGroup group, boolean relative, String title) {
|
|---|
| [8d63649] | 459 |
|
|---|
| [1b3eef8] | 460 | if(new_data) {
|
|---|
| 461 | echo "Publishing new data"
|
|---|
| 462 | }
|
|---|
| 463 |
|
|---|
| [cdcd53dc] | 464 | def series = new_data ? [[
|
|---|
| [df57a84] | 465 | file: "${file}.csv",
|
|---|
| [3c40dc2a] | 466 | exclusionValues: '',
|
|---|
| 467 | displayTableFlag: false,
|
|---|
| 468 | inclusionFlag: 'OFF',
|
|---|
| 469 | url: ''
|
|---|
| [cdcd53dc] | 470 | ]] : [];
|
|---|
| [8d63649] | 471 |
|
|---|
| 472 | echo "file is ${BuildDir}/benchmark/${file}.csv, group ${group}, title ${title}"
|
|---|
| 473 | dir("${BuildDir}/benchmark/") {
|
|---|
| 474 | plot csvFileName: "cforall-${env.BRANCH_NAME}-${file}.csv",
|
|---|
| 475 | csvSeries: series,
|
|---|
| [490cb3c] | 476 | group: "${group.name}",
|
|---|
| [3c40dc2a] | 477 | title: "${title}",
|
|---|
| 478 | style: 'lineSimple',
|
|---|
| 479 | exclZero: false,
|
|---|
| 480 | keepRecords: false,
|
|---|
| [3221a2b] | 481 | logarithmic: !relative && group.log,
|
|---|
| [3c40dc2a] | 482 | numBuilds: '120',
|
|---|
| 483 | useDescr: true,
|
|---|
| [490cb3c] | 484 | yaxis: group.unit,
|
|---|
| [3c40dc2a] | 485 | yaxisMaximum: '',
|
|---|
| 486 | yaxisMinimum: ''
|
|---|
| [df57a84] | 487 | }
|
|---|
| 488 | }
|
|---|