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

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/...
#
# 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/...
#
# 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