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