source: Jenkins/TestRegen@ eb220ca

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since eb220ca was eb220ca, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

Fixed host config in test regen

  • Property mode set to 100644
File size: 2.6 KB
Line 
1#!groovy
2
3node ('master') {
4
5 user_email = ''
6 test_list = ''
7
8 prepare_build()
9
10 try {
11
12 stage('Checkout') {
13 checkout scm
14 }
15
16 stage('Building x86') {
17 regen_tests('i386')
18 }
19
20 stage('Building x64') {
21 regen_tests('x86_64')
22 }
23
24 stage('Patching') {
25 make_patch()
26 }
27
28 stage('Email') {
29 email()
30 }
31 }
32 catch (Exception caughtError) {
33 email_error()
34
35 throw caughtError
36 }
37}
38
39def prepare_build() {
40 properties ([ \
41 [$class: 'ParametersDefinitionProperty', \
42 parameterDefinitions: [ \
43 [$class: 'StringParameterDefinition', \
44 description: 'Who required the test', \
45 name: 'pEmail', \
46 ], \
47 [$class: 'StringParameterDefinition', \
48 description: 'Space separated list of tests to run', \
49 name: 'pTests', \
50 ], \
51 ],
52 ]])
53
54 user_email = pEmail;
55 test_list = pTests;
56}
57
58def regen_tests( String arch ) {
59
60 def install_dir = pwd tmp: true
61
62 //Configure the conpilation (Output is not relevant)
63 //Use the current directory as the installation target so nothing
64 //escapes the sandbox
65 //Also specify the compiler by hand
66 sh "./configure CXX=clang++ --host=${arch} --with-backend-compiler=gcc-6 --prefix=${install_dir} --enable-silent-rules --quiet"
67
68 //Compile the project
69 sh 'make -j 8 --no-print-directory install'
70
71 //Regenerate the desired tests
72 sh "src/tests/test.py --regenerate-expected ${test_list}"
73
74 //Clean everything from the last build
75 sh 'make maintainer-clean > /dev/null'
76}
77
78def make_patch() {
79
80 def target_dir = pwd tmp: true
81
82 //Add every file so new files appear in the diff
83 sh 'git add .'
84
85 //Create a patch file
86 sh "git diff --cached --binary > ${target_dir}/result.patch"
87}
88
89def email() {
90
91 def target_dir = pwd tmp: true
92
93 def email_subject = "[cforall dashboard][TEST REGEN# ${env.BUILD_NUMBER}] - Result"
94 def email_body = """This is an automated email from the Jenkins build machine. It was
95generated http://plg2:8082/dashboard."""
96
97 //send email notification
98 emailext body: email_body, subject: email_subject, to: user_email, attachmentsPattern: '${target_dir}/result.patch'
99}
100
101def email_error() {
102
103 def target_dir = pwd tmp: true
104
105 def email_subject = "[cforall dashboard][TEST REGEN# ${env.BUILD_NUMBER}] - FAILURE"
106 def email_body = """This is an automated email from the Jenkins build machine. It was
107generated http://plg2:8082/dashboard.
108
109Test generation encoutered an error please see attached logs
110
111-----------------------------------------------------------------------"""
112
113 //send email notification
114 emailext body: email_body, subject: email_subject, to: user_email, attachLog: true
115}
Note: See TracBrowser for help on using the repository browser.