summaryrefslogtreecommitdiff
path: root/debian/tests/jtreg-autopkgtest
blob: c9eba40a4f889d8807e78549fa7da03bfecba50a (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
#!/bin/bash

set -o errexit
set -o errtrace
set -o pipefail
set -o nounset

testsuite=$1
shift 1

tmp_dir="${AUTOPKGTEST_TMP:-/tmp/autopkgtest/tmp}"
result_dir="${AUTOPKGTEST_ARTIFACTS:-/tmp/autopkgtest/artifact}"

testsuite_dir="${tmp_dir}/${testsuite}"

work_dir="${result_dir}/${testsuite}/JTwork"
report_dir="${result_dir}/${testsuite}/JTreport"

pids=""

mkdir -p "${tmp_dir}" "${work_dir}" "${report_dir}"

source <(dpkg-architecture -s)

tarball=${testsuite}.tar.xz
case ${testsuite} in
  hotspot)
    if [ ${DEB_BUILD_ARCH} == "arm64" ]; then
      tarball=hotspot-aarch64.tar.xz
    elif [ ${DEB_BUILD_ARCH} == "armhf" ]; then
      tarball=hotspot-aarch32.tar.xz
    fi
    ;;
  jdk)
    xvfb-run --auto-servernum --server-num=10 \
      --error-file=${AUTOPKGTEST_ARTIFACTS}/xvfb-run.log \
      -f ${AUTOPKGTEST_TMP}/Xauthority-xvfb \
      --server-args="-extension GLX -screen 0 1600x900x24" \
      xfwm4 &
    pids+=" $!"
    ;;
  langtools) ;;
  *) exit 1;;
esac

# unpack testsuite tarball
d="$(head -1 <(tar tf ${tarball}) | sed 's,/.*,,')"
tar -C "${tmp_dir}" -x -f ${tarball} "${d}/test/"
mv "${tmp_dir}/${d}" "${testsuite_dir}"

# from debian/rules
# these are best guesses depending on the architecture and the build machines
# some tests require 4min to run, so set the minimum timeout to 3 x 2min.
jt_timeout="3"
if [[ "alpha armel armhf ia64 m68k mips mipsel mips64 mips64el powerpc powerpcspe x32" == *"${DEB_HOST_ARCH}"* ]]; then
  jt_timeout="5"
fi

# grab additional options from command line args
jt_options="$@"
if [[ "armel" == *"${DEB_HOST_ARCH}"* ]]; then
  jt_options+=" -Xmx256M"
fi

# jtreg will use default-java if JT_JAVA is not set
export JT_JAVA=/usr/lib/jvm/java-8-openjdk-${DEB_HOST_ARCH}

jtreg ${jt_options} \
  -verbose:1 \
  -automatic \
  -ignore:quiet \
  -agentvm \
  -conc:auto \
  -timeout:${jt_timeout} \
  -jdk:${JT_JAVA} \
  -exclude:debian/excludelist.${testsuite}.jtx \
  -w:${work_dir} \
  -r:${report_dir} \
  ${testsuite_dir}/test \
  | tee ${result_dir}/check-${testsuite}-stdout.log \ 
    2> ${result_dir}/check-${testsuite}-stderr.log

if [ -n "${pids}" ]; then
  kill ${pids} 2>&1 || true
  sleep 5
  kill -9 ${pids} || true
fi