source: Jenkins/TestRegen@ c429ec2

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

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