summaryrefslogtreecommitdiff
path: root/openembedded/scripts/mauve-test-pkg
blob: 8d7f6a43f646b826b990f96f8ce0d15c2b721715 (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
#!/bin/bash

# Lava Mauve test harness.
#
# 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>
#

function generate_exclude_list() {
    local file="$1"
    local excludes=

    while read -r line; do
	[[ "$line" =~ ^#.*$ ]] && continue
	[[ "$line" =~ ^$    ]] && continue
	excludes="${excludes} -exclude ${line}"
    done < "$file"

    echo "${excludes}"
}

script=$(readlink -f $0)
scriptpath=$(dirname $script)
test_case=$1; shift
test_case_normalized=${test_case//\//.}
mauve_home=$1; shift
blacklist_file="${scriptpath}/../mauve/blacklist.d/${test_case_normalized}"
javavm=$(which java)

if [[ -z "$javavm" ]]; then
    echo "No Java virtual machine found"
    exit 1
fi

excludes=

if [[ -f ${blacklist_file} ]]; then
    excludes=$(generate_exclude_list $blacklist_file)
else
    blacklist_file=/dev/null
fi

output_dir="/tmp/${test_case_normalized}.$$"
mkdir -p $output_dir
pushd $output_dir
output_file="${test_case_normalized}.txt"

echo $javavm HarnessLinaro $excludes $test_case "$@"
export CLASSPATH=$mauve_home
$javavm -client HarnessLinaro $excludes $test_case "$@" 2>&1 | tee $output_file

if [[ -f ${blacklist_file} ]]; then
    cp ${blacklist_file} ${test_case_normalized}-excluded-tests.txt
    lava-test-run-attach ${test_case_normalized}-excluded-tests.txt
fi

sed -n '/TEST RESULTS:/,$p' $output_file > ${test_case_normalized}-summary.txt
lava-test-run-attach ${test_case_normalized}-summary.txt

grep '^FAIL:' $output_file > ${test_case_normalized}-failed.txt
lava-test-run-attach ${test_case_normalized}-failed.txt

grep '^PASS:' $output_file > ${test_case_normalized}-success.txt
lava-test-run-attach ${test_case_normalized}-success.txt

rm -rf $output_dir