Skip to content

Latest commit

 

History

History
executable file
·
88 lines (81 loc) · 2.54 KB

gtests.sh

File metadata and controls

executable file
·
88 lines (81 loc) · 2.54 KB
 
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
#! /bin/bash
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
########################################################################
#
# similar to all.sh this file runs drives gtests.
#
# needs to work on all Unix and Windows platforms
#
# special strings
# ---------------
# FIXME ... known problems, search for this string
# NOTE .... unexpected behavior
#
########################################################################
############################## gtest_init ##############################
# local shell function to initialize this script
########################################################################
gtest_init()
{
cd "$(dirname "$1")"
if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
cd common
. ./init.sh
fi
SCRIPTNAME=gtests.sh
if [ -z "${CLEANUP}" ] ; then # if nobody else is responsible for
CLEANUP="${SCRIPTNAME}" # cleaning this script will do it
fi
}
########################## gtest_start #############################
# Local function to actually start the test
####################################################################
gtest_start()
{
echo "gtests: ${GTESTS}"
for i in ${GTESTS}; do
Oct 3, 2016
Oct 3, 2016
45
46
47
48
if [ ! -f ${BINDIR}/$i ]; then
html_unknown "Skipping $i (not built)"
continue
fi
49
50
51
52
53
54
55
GTESTDIR="${HOSTDIR}/$i"
html_head "$i"
if [ ! -d "$GTESTDIR" ]; then
mkdir -p "$GTESTDIR"
fi
cd "$GTESTDIR"
GTESTREPORT="$GTESTDIR/report.xml"
Aug 4, 2016
Aug 4, 2016
56
57
PARSED_REPORT="$GTESTDIR/report.parsed"
echo "executing $i"
Oct 26, 2016
Oct 26, 2016
58
59
${BINDIR}/$i -d "$GTESTDIR" --gtest_output=xml:"${GTESTREPORT}" \
--gtest_filter="${GTESTFILTER-*}"
60
html_msg $? 0 "$i run successfully"
Oct 2, 2016
Oct 2, 2016
61
echo "test output dir: ${GTESTREPORT}"
Aug 4, 2016
Aug 4, 2016
62
63
64
65
echo "executing sed to parse the xml report"
sed -f ${COMMON}/parsegtestreport.sed "${GTESTREPORT}" > "${PARSED_REPORT}"
echo "processing the parsed report"
cat "${PARSED_REPORT}" | while read result name; do
66
67
68
if [ "$result" = "notrun" ]; then
echo "$name" SKIPPED
elif [ "$result" = "run" ]; then
Aug 4, 2016
Aug 4, 2016
69
html_passed_ignore_core "$name"
70
else
Aug 4, 2016
Aug 4, 2016
71
html_failed_ignore_core "$name"
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
fi
done
done
}
gtest_cleanup()
{
html "</TABLE><BR>"
cd ${QADIR}
. common/cleanup.sh
}
################## main #################################################
GTESTS="der_gtest pk11_gtest util_gtest"
gtest_init $0
gtest_start
gtest_cleanup