2018-01-19 03:59:58 +08:00
|
|
|
#! /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")"
|
2019-04-06 10:14:46 +08:00
|
|
|
SOURCE_DIR="$PWD"/../..
|
2018-01-19 03:59:58 +08:00
|
|
|
if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
|
2018-02-06 11:46:26 +01:00
|
|
|
cd ../common
|
2018-01-19 03:59:58 +08:00
|
|
|
. ./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
|
2019-04-06 10:14:46 +08:00
|
|
|
|
2018-01-19 03:59:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
########################## gtest_start #############################
|
|
|
|
|
# Local function to actually start the test
|
|
|
|
|
####################################################################
|
|
|
|
|
gtest_start()
|
|
|
|
|
{
|
|
|
|
|
echo "gtests: ${GTESTS}"
|
|
|
|
|
for i in ${GTESTS}; do
|
2019-04-06 10:14:46 +08:00
|
|
|
if [ ! -f "${BINDIR}/$i" ]; then
|
2018-01-19 03:59:58 +08:00
|
|
|
html_unknown "Skipping $i (not built)"
|
|
|
|
|
continue
|
|
|
|
|
fi
|
2019-04-25 12:03:02 +08:00
|
|
|
GTESTDIR="${HOSTDIR}/$i"
|
2018-01-19 03:59:58 +08:00
|
|
|
html_head "$i"
|
2019-04-25 12:03:02 +08:00
|
|
|
if [ ! -d "$GTESTDIR" ]; then
|
|
|
|
|
mkdir -p "$GTESTDIR"
|
|
|
|
|
echo "${BINDIR}/certutil" -N -d "$GTESTDIR" --empty-password 2>&1
|
|
|
|
|
"${BINDIR}/certutil" -N -d "$GTESTDIR" --empty-password 2>&1
|
2018-01-19 03:59:58 +08:00
|
|
|
fi
|
2019-04-25 12:03:02 +08:00
|
|
|
cd "$GTESTDIR"
|
|
|
|
|
GTESTREPORT="$GTESTDIR/report.xml"
|
|
|
|
|
PARSED_REPORT="$GTESTDIR/report.parsed"
|
2018-01-19 03:59:58 +08:00
|
|
|
echo "executing $i"
|
2019-04-06 10:14:46 +08:00
|
|
|
"${BINDIR}/$i" "${SOURCE_DIR}/gtests/freebl_gtest/kat/Hash_DRBG.rsp" \
|
2019-04-25 12:03:02 +08:00
|
|
|
-d "$GTESTDIR" -w --gtest_output=xml:"${GTESTREPORT}" \
|
|
|
|
|
--gtest_filter="${GTESTFILTER:-*}"
|
2018-01-19 03:59:58 +08:00
|
|
|
html_msg $? 0 "$i run successfully"
|
|
|
|
|
echo "test output dir: ${GTESTREPORT}"
|
|
|
|
|
echo "executing sed to parse the xml report"
|
2019-04-06 10:14:46 +08:00
|
|
|
sed -f "${COMMON}/parsegtestreport.sed" "$GTESTREPORT" > "$PARSED_REPORT"
|
2018-01-19 03:59:58 +08:00
|
|
|
echo "processing the parsed report"
|
2019-04-06 10:14:46 +08:00
|
|
|
cat "$PARSED_REPORT" | while read result name; do
|
2018-01-19 03:59:58 +08:00
|
|
|
if [ "$result" = "notrun" ]; then
|
|
|
|
|
echo "$name" SKIPPED
|
|
|
|
|
elif [ "$result" = "run" ]; then
|
|
|
|
|
html_passed_ignore_core "$name"
|
|
|
|
|
else
|
|
|
|
|
html_failed_ignore_core "$name"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gtest_cleanup()
|
|
|
|
|
{
|
|
|
|
|
html "</TABLE><BR>"
|
2019-04-25 12:03:02 +08:00
|
|
|
cd "${QADIR}"
|
|
|
|
|
. common/cleanup.sh
|
2018-01-19 03:59:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
################## main #################################################
|
2019-04-06 10:14:46 +08:00
|
|
|
GTESTS="${GTESTS:-prng_gtest certhigh_gtest certdb_gtest der_gtest pk11_gtest util_gtest freebl_gtest softoken_gtest sysinit_gtest blake2b_gtest smime_gtest}"
|
|
|
|
|
gtest_init "$0"
|
2018-01-19 03:59:58 +08:00
|
|
|
gtest_start
|
|
|
|
|
gtest_cleanup
|