Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ci
Path: blob/main/scripts/java/run-jtreg.sh
1130 views
1
#!/bin/sh
2
# Copyright (c) 2014, Brian Gardner <[email protected]>
3
# All rights reserved.
4
#
5
# Redistribution and use in source and binary forms, with or without
6
# modification, are permitted provided that the following conditions
7
# are met:
8
# 1. Redistributions of source code must retain the above copyright
9
# notice unmodified, this list of conditions, and the following
10
# disclaimer.
11
# 2. Redistributions in binary form must reproduce the above copyright
12
# notice, this list of conditions and the following disclaimer in the
13
# documentation and/or other materials provided with the distribution.
14
#
15
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26
set -e
27
28
while getopts "v:a:p:t:nk" opt; do
29
case $opt in
30
v ) VERSION="$OPTARG" ;;
31
a ) ARCH="$OPTARG" ;;
32
p ) PORTS_TREE="$OPTARG" ;;
33
n ) NO_CLEANUP="yes" ;;
34
k ) CLEANUP_FIRST="yes" ;;
35
t ) TESTS="$OPTARG" ;;
36
?) ;;
37
esac
38
done
39
40
usage()
41
{
42
echo "Usage: $0 -v <version> -a <arch> -p <ports_tree> [-n] [-t <tests>]"
43
echo " -v <version> : the version should be in the form of svn branches: "
44
echo " stable/9 or head for current"
45
echo " -a <arch> : the arch should be i386 or amd64"
46
echo " -p <ports_tree> : the poudriere ports tree to use, useful for testing openjdk8 patches"
47
echo " -n : do not cleanup poudriere jails when finished, also useful for testing openjdk8 patches"
48
echo " -k : cleanup and unmount poudriere jail if it is currently mounted, useful alongside the"
49
echo " -n switch, to keep jails mounted for debugging between runs while still starting"
50
echo " with a fresh start."
51
echo " -t <tests> : run a subset of test projects. Argument is a comma seperated list of test projects."
52
echo " available projects are nashorn, langtools, hotspot, and jdk"
53
echo " defaults to running all test projects"
54
echo "Example: $0 -v releng/10.1 -a amd64 -p openjdk8"
55
exit 1;
56
}
57
58
59
if [ -z "${VERSION}" -o -z "${ARCH}" -o -z "${PORTS_TREE}" ]; then
60
usage
61
fi
62
63
if [ -z "${TESTS}" ]; then
64
TESTS="nashorn,langtools,hotspot,jdk"
65
fi
66
67
REQUIRED_PROG="poudriere sudo svn"
68
for prog in ${REQUIRED_PROG}; do
69
if ! type $prog; then
70
exit 1
71
fi
72
done
73
74
JAIL_NAME=`echo ${VERSION}_${ARCH} | tr "[a-z]/." "[A-Z]__"`
75
JAIL_PORT=${JAIL_NAME}-${PORTS_TREE}
76
TMP_DIR=`pwd`
77
JAVA_CI_DIR=`dirname $0`
78
79
80
if [ "${CLEANUP_FIRST}" == "yes" ]; then
81
echo "Cleaning up ${JAIL_PORT}"
82
sudo poudriere jail -k -j ${JAIL_NAME} -p ${PORTS_TREE}
83
fi
84
85
86
if [ -d /usr/local/poudriere/ports/${PORTS_TREE} ]; then
87
echo "Updating ports tree ${PORTS_TREE}"
88
sudo poudriere ports -u -p ${PORTS_TREE}
89
else
90
echo "Fetching ports tree ${PORTS_TREE}"
91
sudo poudriere ports -c -p ${PORTS_TREE} -m svn+http
92
fi
93
94
if [ -d /usr/local/poudriere/jails/${JAIL_NAME} ]; then
95
INCOMING=`svn diff /usr/local/poudriere/jails/RELENG_10_1_AMD64/usr/src -r BASE:HEAD`
96
if [ -z "$INCOMING" ]; then
97
echo "Skipping update to jail ${JAIL_NAME}, already up-to-date"
98
else
99
echo "Updating jail ${JAIL_NAME}"
100
sudo poudriere jails -u -j ${JAIL_NAME} -p ${PORTS_TREE}
101
fi
102
else
103
echo "Creating jail ${JAIL_NAME}"
104
sudo poudriere jails -c -j ${JAIL_NAME} -p ${PORTS_TREE} -m svn -v ${VERSION}
105
fi
106
107
108
109
mkdir -p "${TMP_DIR}"
110
cd "${TMP_DIR}"
111
112
113
114
echo "Building openjdk8 and dependencies in ${JAIL_PORT}"
115
sudo poudriere testport -I -j ${JAIL_NAME} -p ${PORTS_TREE} -o java/openjdk8
116
117
118
echo "Preparing ${JAIL_PORT} to run jtreg"
119
fetch https://adopt-openjdk.ci.cloudbees.com/job/jtreg/lastStableBuild/artifact/jtreg4.1-b10.tar.gz
120
sudo mv jtreg4.1-b10.tar.gz /usr/local/poudriere/data/build/${JAIL_PORT}/ref/root/
121
sudo cp ${JAVA_CI_DIR}/files/jail-run-jtreg.sh ${JAVA_CI_DIR}/files/jail-merge-jtreg.sh /usr/local/poudriere/data/build/${JAIL_PORT}/ref/root/
122
123
echo "Running jtreg in ${JAIL_PORT} for $TESTS"
124
sudo jexec ${JAIL_PORT} env -i TERM=${TERM} /root/jail-run-jtreg.sh -t $TESTS
125
126
echo "Copying jtreg results to ${TMP_DIR}"
127
sudo cp -Rp /usr/local/poudriere/data/build/${JAIL_PORT}/ref/wrkdirs/usr/ports/java/openjdk8/work/jtreg-work /usr/local/poudriere/data/build/${JAIL_PORT}/ref/wrkdirs/usr/ports/java/openjdk8/work/reports "${TMP_DIR}"/
128
129
#echo "Merging jtreg results"
130
#sudo jexec ${JAIL_PORT} env -i TERM=${TERM} /root/jail-merge-jtreg.sh -t $TESTS
131
132
133
if [ "${NO_CLEANUP}" != "yes" ]; then
134
echo "Cleaning up ${JAIL_PORT}"
135
sudo poudriere jail -k -j ${JAIL_NAME} -p ${PORTS_TREE}
136
fi
137
138