source: Jenkins/TestRegen@ d8e14e39

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 d8e14e39 was d8e14e39, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

Added some better description to the test regen email (Which now works) and updated the sched-int-wait test

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