diff mbox series

[v1,1/1] test: time: do not fail under gcov

Message ID 1496260809-4141-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [v1,1/1] test: time: do not fail under gcov | expand

Commit Message

Github ODP bot May 31, 2017, 8 p.m. UTC
From: Maxim Uvarov <maxim.uvarov@linaro.org>


code coverage gcov make test very slow and it does not pass
accepted boundaries. Test if env TEST=coverage variable is set
and do no generate fail result if some boundaries are missing.
https://bugs.linaro.org/show_bug.cgi?id=3017

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
/** Email created from pull request 44 (muvarov:master_time_gcov)
 ** https://github.com/Linaro/odp/pull/44
 ** Patch: https://github.com/Linaro/odp/pull/44.patch
 ** Base sha: 87bba414b4444d8247adf3411e8bbefd35899f1b
 ** Merge commit sha: 08e54cf0e57c0aacd7635dade8e9946f9481a261
 **/
 test/common_plat/validation/api/time/Makefile.am | 10 +++++-
 test/common_plat/validation/api/time/time.sh     | 42 ++++++++++++++++++++++++
 test/linux-generic/Makefile.am                   |  2 +-
 3 files changed, 52 insertions(+), 2 deletions(-)
 create mode 100755 test/common_plat/validation/api/time/time.sh
diff mbox series

Patch

diff --git a/test/common_plat/validation/api/time/Makefile.am b/test/common_plat/validation/api/time/Makefile.am
index bf2d0268..72e6b7b2 100644
--- a/test/common_plat/validation/api/time/Makefile.am
+++ b/test/common_plat/validation/api/time/Makefile.am
@@ -1,5 +1,12 @@ 
 include ../Makefile.inc
 
+TESTS_ENVIRONMENT += TEST_DIR=${builddir}
+
+TESTSCRIPTS = time.sh
+TEST_EXTENSIONS = .sh
+
+TESTS = $(TESTSCRIPTS)
+
 noinst_LTLIBRARIES = libtesttime.la
 libtesttime_la_SOURCES = time.c
 
@@ -7,4 +14,5 @@  test_PROGRAMS = time_main$(EXEEXT)
 dist_time_main_SOURCES = time_main.c
 time_main_LDADD = libtesttime.la $(LIBCUNIT_COMMON) $(LIBODP)
 
-EXTRA_DIST = time.h
+EXTRA_DIST = time.h $(TESTSCRIPTS)
+dist_check_SCRIPTS = $(TESTSCRIPTS)
diff --git a/test/common_plat/validation/api/time/time.sh b/test/common_plat/validation/api/time/time.sh
new file mode 100755
index 00000000..02bf75a7
--- /dev/null
+++ b/test/common_plat/validation/api/time/time.sh
@@ -0,0 +1,42 @@ 
+#!/bin/sh
+#
+# Copyright (c) 2017, Linaro Limited
+# All rights reserved.
+#
+# SPDX-License-Identifier:	BSD-3-Clause
+#
+
+# directories where time_main binary can be found:
+# -in the validation dir when running make check (intree or out of tree)
+# -in the script directory, when running after 'make install', or
+# -in the validation when running standalone (./time) intree.
+# -in the current directory.
+# running stand alone out of tree requires setting PATH
+PATH=${TEST_DIR}/api/time:$PATH
+PATH=$(dirname $0)/../../../../common_plat/validation/api/time:$PATH
+PATH=$(dirname $0):$PATH
+PATH=`pwd`:$PATH
+
+time_main_path=$(which time_main${EXEEXT})
+if [ -x "$time_main_path" ] ; then
+	echo "running with time_main: $time_run_path"
+else
+	echo "cannot find time_main: please set you PATH for it."
+	exit 1
+fi
+
+# exit codes expected by automake for skipped tests
+TEST_SKIPPED=77
+
+time_main${EXEEXT}
+ret=$?
+
+SIGSEGV=139
+
+if [ "${TRAVIS}" = "true" ] && [ $ret -ne 0 ] &&
+   [ ${TEST} = "coverage" ] && [ $ret -ne ${SIGSEGV} ]; then
+	echo "SKIP: skip due significant slowdown under code coverage"
+	exit ${TEST_SKIPPED}
+fi
+
+exit $ret
diff --git a/test/linux-generic/Makefile.am b/test/linux-generic/Makefile.am
index 38516a43..f92083d7 100644
--- a/test/linux-generic/Makefile.am
+++ b/test/linux-generic/Makefile.am
@@ -28,7 +28,7 @@  TESTS = validation/api/pktio/pktio_run.sh \
 	$(ALL_API_VALIDATION_DIR)/scheduler/scheduler_main$(EXEEXT) \
 	$(ALL_API_VALIDATION_DIR)/std_clib/std_clib_main$(EXEEXT) \
 	$(ALL_API_VALIDATION_DIR)/thread/thread_main$(EXEEXT) \
-	$(ALL_API_VALIDATION_DIR)/time/time_main$(EXEEXT) \
+	$(ALL_API_VALIDATION_DIR)/time/time.sh \
 	$(ALL_API_VALIDATION_DIR)/timer/timer_main$(EXEEXT) \
 	$(ALL_API_VALIDATION_DIR)/traffic_mngr/traffic_mngr.sh \
 	$(ALL_API_VALIDATION_DIR)/shmem/shmem_main$(EXEEXT) \