source: Jenkins/TestRegen @ 64bc131

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 64bc131 was 64bc131, checked in by Thierry Delisle <tdelisle@…>, 7 years ago

added new Jenkins script to regenerate tests

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