summaryrefslogtreecommitdiff
path: root/make-yaml-files.sh
blob: a7857aacb43889f32d17dcd63c5ee6f6d0bba51b (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
#!/bin/bash

# Copyright (C) 2013, Linaro Limited.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
# Author: Andrew McDermott <andrew.mcdermott@linaro.org>
#

progname=$(basename $0)

function test_setup_content() {
    IFS='' read -r -d '' t1 <<EOF
# Copyright (C) $(date +%Y), Linaro Limited.
#
# PLEASE DO NOT HAND EDIT THIS FILE.
#
# This file has been auto-generated from:
#
#    $progname
#
# which can be found in the following repo:
#
#    git://git.linaro.org/leg/openjdk/jtreg-lava-scripts
#
# PLEASE DO NOT HAND EDIT THIS FILE.
#
metadata:
  name: jtreg-setup
  format: "Lava-Test-Shell Test Definition 1.0"
  description: "Regression tests for the OpenJDK platform"
  version: 1.0
EOF

    IFS='' read -r -d '' t2 <<-'EOF'
install:
  git-repos:
    - git://frobware.com/scratch/jtreg-bin
    - git://frobware.com/scratch/openjdk8-aarch64-test-archive
    - git://frobware.com/scratch/oe/test-definitions
run:
  steps:
    - 'cp -r /lava/tests/$TESTRUN_ID $HOME'
    - 'echo "export JTREG_TESTRUN_ID=$HOME/$TESTRUN_ID" > $HOME/jtreg-setup.env'
    - 'source $HOME/jtreg-setup.env'
    - 'TEST_DIR=$JTREG_TESTRUN_ID/openjdk8-aarch64-test-archive'
    - 'CLASSES_DIR=$TEST_DIR/openjdk8-aarch64-port-snapshot/JTwork/classes'
    - 'JT_HOME=$JTREG_TESTRUN_ID/jtreg-bin/jtreg'
    - 'for i in $TEST_DIR/openjdk8-aarch64-port-snapshot/jdk/*; do find $i -print | xargs touch -d now; done'
    - 'for i in $TEST_DIR/openjdk8-aarch64-port-snapshot/hotspot/*; do find $i -print | xargs touch -d now; done'
    - 'for i in $CLASSES_DIR/*; do find $i -print | xargs touch -d tomorrow; done'
    - 'echo "PATH=$JTREG_TESTRUN_ID/jtreg-bin/jtreg/linux/bin:$PATH" >> $HOME/jtreg-setup.env'
    - 'echo "TEST_DIR=$JTREG_TESTRUN_ID/openjdk8-aarch64-test-archive" >> $HOME/jtreg-setup.env'
    - 'echo "CLASSES_DIR=$TEST_DIR/openjdk8-aarch64-port-snapshot/JTwork/classes" >> $HOME/jtreg-setup.env'
    - 'echo "export JT_HOME=$JTREG_TESTRUN_ID/jtreg-bin/jtreg" >> $HOME/jtreg-setup.env'
    - 'echo "export JT_JAVA=/usr/lib/jvm/java-8-openjdk/bin/java" >> $HOME/jtreg-setup.env'
    - 'echo "export PRODUCT_HOME=/usr/lib/jvm/java-8-openjdk" >> $HOME/jtreg-setup.env'
    - 'echo "export JDK_TEST_DIR=$TEST_DIR/openjdk8-aarch64-port-snapshot/jdk/test" >> $HOME/jtreg-setup.env'
    - 'echo "export HOTSPOT_TEST_DIR=$TEST_DIR/openjdk8-aarch64-port-snapshot/hotspot/test" >> $HOME/jtreg-setup.env'
    - 'echo "export JTREG=$JT_HOME/linux/bin/jtreg-lava" >> $HOME/jtreg-setup.env'
    - 'echo "export JTREG_LAVA_PREBUILT_CLASSES_DIR=$CLASSES_DIR" >> $HOME/jtreg-setup.env'
    - 'echo "env" >> $HOME/jtreg-setup.env'
    - 'cat $HOME/jtreg-setup.env'
    - 'lava-test-case jtreg-setup --result pass'
EOF

    IFS=$oldifs
    echo "${t1}${t2}"
}

function yaml_content() {
    local testname=$1

    oldifs=$IFS

    IFS='' read -r -d '' t1 <<EOF
# Copyright (C) $(date +%Y), Linaro Limited.
#
# PLEASE DO NOT HAND EDIT THIS FILE.
#
# This file has been auto-generated from:
#
#    $progname
#
# which can be found in the following repo:
#
#    git://git.linaro.org/leg/openjdk/jtreg-lava-scripts
#
# PLEASE DO NOT HAND EDIT THIS FILE.
#
metadata:
  name: ${testname}
  format: "Lava-Test-Shell Test Definition 1.0"
  description: "Regression tests for the OpenJDK platform"
  version: 1.0
EOF

    IFS='' read -r -d '' t2 <<-'EOF'
run:
  steps:
    - 'source $HOME/jtreg-setup.env'
    - 'cd $JTREG_TESTRUN_ID/test-definitions/openembedded/scripts'
EOF

    IFS=$oldifs
    echo "${t1}${t2}"
}

yaml_txt=$(test_setup_content)
echo "$yaml_txt" > "jtreg-setup.yaml"

for i in jdk_beans1 jdk_io jdk_lang jdk_math jdk_net jdk_other jdk_security1 jdk_text jdk_time jdk_util; do
    yaml_txt=$(yaml_content $i)
    test_txt="    - './jtreg-test \$JDK_TEST_DIR $i'"
    echo "$yaml_txt" > "jtreg-${i}.yaml"
    echo "$test_txt" >> "jtreg-${i}.yaml"
done

testtype="hotspot"

for i in sanity compiler gc runtime serviceability testlibrary; do
    yaml_txt=$(yaml_content "${testtype}-${i}")
    test_txt="    - 'TESTDIRS=$i ./jtreg-test \$HOTSPOT_TEST_DIR $i'"
    echo "$yaml_txt" > "jtreg-${testtype}-${i}.yaml"
    echo "$test_txt" >> "jtreg-${testtype}-${i}.yaml"
done