source: Jenkins/TestRegen @ 906d8fa

Last change on this file since 906d8fa was 7d128cb, checked in by Peter A. Buhr <pabuhr@…>, 9 months ago

add ARM architecture to regression tests

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