aboutsummaryrefslogtreecommitdiff
path: root/jtreg-build.yaml
blob: 693df87906499ae34ad2540bca2ff2d1a8ff9d18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
- scm:
   name: jtreg
   scm:
    - hg:
        url: http://hg.openjdk.java.net/code-tools/jtreg/
        clean: true
        browser: hgweb
        browser-url: http://hg.openjdk.java.net/code-tools/jtreg/
        subdir: jtreg
- scm:
   name: asmtools
   scm:
    - hg:
        url: http://hg.openjdk.java.net/code-tools/asmtools/
        clean: true
        browser: hgweb
        browser-url: http://hg.openjdk.java.net/code-tools/asmtools/
        subdir: asmtools
        revision-type: tag
        revision: "6.0"
- scm:
    name: jcov
    scm:
     - hg:
        url: http://hg.openjdk.java.net/code-tools/jcov
        clean: true
        browser: hgweb
        browser-url: http://hg.openjdk.java.net/code-tools/jcov
        subdir: jcov
- job:
    name: jtreg-build
    project-type: freestyle
    defaults: global
    description: |
        * Build JDK Regression Test Harness (jtreg).
    properties:
        - authorization:
            anonymous:
                - job-read
                - job-extended-read
            openjdk-members:
                - job-build
                - job-cancel
                - job-workspace
        - build-discarder:
            days-to-keep: 30
            num-to-keep:  10
            artifact-num-to-keep: 5
    disabled: false
    node: aarch64-06
    display-name: 'OpenJDK - Build JDK Regression Test Harness (jtreg)'
    scm:
        - asmtools
        - jtreg
        - jcov
    triggers:
        - pollscm:
            cron: 'H/5 * * * *'
    wrappers:
        - timestamps
    builders:
        - shell: |
            #!/bin/bash

            set -eu

            # Build asmtools for jtreg.
            cd asmtools

            ant -f build/build.xml

            cd ../jtreg

            unzip -o ../asmtools-6.0-build/dist/asmtools-6.0.zip

            if [ ! -d jtharness ]; then
              wget https://adopt-openjdk.ci.cloudbees.com/job/jtharness/lastSuccessfulBuild/artifact/jtharness-5.0.tar.gz
              tar xzf jtharness-5.0.tar.gz jtharness/lib
            fi

            if [ ! -d junit ]; then
              mkdir junit
              wget http://repo1.maven.org/maven2/junit/junit/4.8.2/junit-4.8.2.jar -O junit/junit.jar
            fi

            if [ ! -d testng ]; then
              mkdir testng
              wget http://repo1.maven.org/maven2/org/testng/testng/6.9.5/testng-6.9.5.jar -O testng/testng.jar
            fi

            if [ ! -d jcommander ]; then
              mkdir jcommander
              wget http://repo1.maven.org/maven2/com/beust/jcommander/1.72/jcommander-1.72.jar -O jcommander/jcommander.jar
            fi

            if [ ! -d asm-6.0 ]; then
              wget http://download.forge.ow2.org/asm/asm-6.0-bin.zip
              unzip asm-6.0-bin.zip
            fi

            # Build jcov
            cd ../jcov
            ant -f build/build.xml -Dasm.jar=$PWD/../jtreg/asm-6.0/lib/asm-6.0.jar \
                -Dasm.tree.jar=$PWD/../jtreg/asm-6.0/lib/asm-tree-6.0.jar \
                -Dasm.util.jar=$PWD/../jtreg/asm-6.0/lib/asm-util-6.0.jar \
                -Djavatestjar=$PWD/../jtreg/jtharness/lib/javatest.jar

            cd ../jtreg

            ls -lash

            rm -fr build
            rm -fr dist

            which java
            java -version

            # Pick out version automatically from Mercurial tags.
            JTREG_TAG=$(hg log -r "." --template "{latesttag}\n")
            BUILD_VERSION=$(echo $JTREG_TAG | sed 's,jtreg\([0-9]*\.[0-9]*\)-b.*,\1,')
            BUILD_NUMBER=$(echo $JTREG_TAG | sed 's,jtreg[0-9]*\.[0-9]*-\(b[0-9]*\),\1,')

            MAJOR=$(echo $BUILD_VERSION | sed 's,\([0-9]*\)\.[0-9]*,\1,')
            MINOR=$(echo $BUILD_VERSION | sed 's,[0-9]*\.\([0-9]*\),\1,')


            # BUILD_VERSION=4.2
            # BUILD_NUMBER=b03
            echo jtreg$BUILD_VERSION-$BUILD_NUMBER

            # syntax of the -target and -source command have changed with jdk9
            sed -i 's|1.8|8|g' make/build.xml

            # Parameters for makefile build, which includes asmtools.jar in
            # classpath in manifest.
            # java and ant's home directories are found from the commands.
            export JDKHOME=$(dirname $(java -XshowSettings:properties |& \
                 grep java.home |  sed 's,^.*java.home = \(.*\),\1,'))
            export JAVATEST_HOME=$PWD/jtharness
            export JAVATEST_JAR=$PWD/jtharness/lib/javatest.jar
            export JAVAHARNESS_HOME=$PWD/jtharness
            export ASMTOOLS_HOME=$PWD/asmtools-6.0
            export TESTNG_HOME=$PWD/testng
            export TESTNG_JAR=$PWD/testng/testng.jar
            export JUNIT_JAR=$PWD/junit/junit.jar
            export ANTHOME=$(ant -diagnostics | grep ant.home | \
                sed 's,^.*: \(.*\),\1,' | uniq)
            export JCOMMANDER_JAR=$PWD/jcommander/jcommander.jar
            export JCOV_JAR=$PWD/../jcov/JCOV_BUILD/jcov_3.0/jcov.jar
            export JCOV_NETWORK_SAVER_JAR=$PWD/../jcov/JCOV_BUILD/jcov_3.0/jcov_network_saver.jar

            echo JDKHOME=\"$JDKHOME\"

            # Makefile expects files that are not supplied from the packages we
            # are downloading. Create dummy versions to keep it happy.
            touch $JAVAHARNESS_HOME/COPYRIGHT-javatest.html
            mkdir -p $JAVAHARNESS_HOME/doc/javatest/
            touch $JAVAHARNESS_HOME/doc/javatest/javatestGUI.pdf
            touch $TESTNG_HOME/LICENSE.txt

            make -C make

            rm -f *.zip
            rm -f *.tar.gz

            chmod u+x ./build/images/jtreg/bin/*

            ls -lash

            : ${MAJOR:=4}
            : ${MINOR:=2}
            : ${MICRO:=0}
            : ${VERSION_SUFFIX:=SNAPSHOT}
            : ${JOB_NAME:=jtreg}
            : ${ZIP_TYPE:=xz}

            artifact=${JOB_NAME}-${MAJOR}.${MINOR}.${MICRO}-${VERSION_SUFFIX}

            cd ./build/images
            tar afcv $artifact.tar.${ZIP_TYPE} jtreg
            mv $artifact.tar.${ZIP_TYPE} ../../..
            cd ..
    publishers:
        - archive:
            artifacts: 'jtreg-build-*-SNAPSHOT.tar.xz'
        - email:
            recipients: 'stuart.monteith@linaro.org fathi.boudra@linaro.org'