From patchwork Wed Feb 25 22:04:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 45132 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2A2682142A for ; Wed, 25 Feb 2015 22:04:42 +0000 (UTC) Received: by lams18 with SMTP id s18sf4995095lam.1 for ; Wed, 25 Feb 2015 14:04:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:cc:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=oUKFQIQYmZaYsHLKilnvp7PT9JHUFE+CtqTytZWbFaI=; b=VRzqx9VGOK/HUC7fMOmfu52LYJLL2EW1Qv/xkRgAR6847AfHhZi23eyHLDgUSvDqOd 5rXj+VHhDa2Shy09H3BvEsIooFd09XcqxR+2kDF9HXKw+O6FxIMO2E6FiDsZampEQR+A dIhfl5BiblZBtjKy7Q/3DRlbWCIakijH0Vd3pDOfvYiXSpajmPauuLUD3KobbLoWd9aQ KqnNstTFwJlqHlYjZaFR8x1QjZ8AmDYqqrD7+FbkDgyyPwhb8gx/ARigr93whlAFZiJN Z/qlzcuvgMPaIVNG4ggbKyQyqLJajObSTNE/npBMvf7Kmpoy7FVoUhuJcpmLI42nfned 71LA== X-Gm-Message-State: ALoCoQnmRDFtjioqhapQPlWu9VuqXT0wLFDOQuuRm6ASJIalQA+V/ZrFDjwEEUBVsAWixbLKbn3e X-Received: by 10.112.159.227 with SMTP id xf3mr832107lbb.11.1424901880973; Wed, 25 Feb 2015 14:04:40 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.48 with SMTP id t16ls793921lal.55.gmail; Wed, 25 Feb 2015 14:04:40 -0800 (PST) X-Received: by 10.112.169.39 with SMTP id ab7mr4626599lbc.85.1424901880818; Wed, 25 Feb 2015 14:04:40 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id yr12si22946000lab.135.2015.02.25.14.04.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Feb 2015 14:04:40 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by labgd6 with SMTP id gd6so7091281lab.7 for ; Wed, 25 Feb 2015 14:04:40 -0800 (PST) X-Received: by 10.152.87.3 with SMTP id t3mr4816264laz.19.1424901880654; Wed, 25 Feb 2015 14:04:40 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp2912656lbj; Wed, 25 Feb 2015 14:04:39 -0800 (PST) X-Received: by 10.140.129.65 with SMTP id 62mr11686977qhb.11.1424901879036; Wed, 25 Feb 2015 14:04:39 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id v8si24042497qaj.113.2015.02.25.14.04.37 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 25 Feb 2015 14:04:39 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YQk4J-0001ij-TZ; Wed, 25 Feb 2015 22:04:35 +0000 Received: from mail-qc0-f181.google.com ([209.85.216.181]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YQk4F-0001ie-9i for lng-odp@lists.linaro.org; Wed, 25 Feb 2015 22:04:31 +0000 Received: by qcxm20 with SMTP id m20so5495301qcx.0 for ; Wed, 25 Feb 2015 14:04:26 -0800 (PST) X-Received: by 10.140.148.216 with SMTP id 207mr11952833qhu.62.1424901865953; Wed, 25 Feb 2015 14:04:25 -0800 (PST) Received: from mike-desktop.?.holmesfamily.ws (c-98-221-136-245.hsd1.nj.comcast.net. [98.221.136.245]) by mx.google.com with ESMTPSA id w8sm3536821qge.25.2015.02.25.14.04.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Feb 2015 14:04:25 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Wed, 25 Feb 2015 17:04:17 -0500 Message-Id: <1424901857-27384-1-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: patch Cc: Simon Kagstrom Subject: [lng-odp] [PATCH v4] test: miscellaneous: Add CPP test X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mike.holmes@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Simon Kagstrom Add conditional test to link and run ODP from a cpp application. Signed-off-by: Simon Kagstrom Signed-off-by: Mike Holmes --- v4 Disable by default, use --enable-test-cpp to see C++ test and the warnings it generates. configure.ac | 20 ++++++++++++++++++++ test/Makefile.am | 2 +- test/Makefile.inc | 5 +++-- test/miscellaneous/.gitignore | 1 + test/miscellaneous/Makefile.am | 12 ++++++++++++ test/miscellaneous/gitignore | 1 + test/miscellaneous/odp_api_from_cpp.cpp | 12 ++++++++++++ 7 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 test/miscellaneous/.gitignore create mode 100644 test/miscellaneous/Makefile.am create mode 100644 test/miscellaneous/gitignore create mode 100644 test/miscellaneous/odp_api_from_cpp.cpp diff --git a/configure.ac b/configure.ac index e5c1c56..7d45ece 100644 --- a/configure.ac +++ b/configure.ac @@ -13,6 +13,8 @@ AM_SILENT_RULES([yes]) AC_PROG_CC AM_PROG_CC_C_O +AC_PROG_CXX + AC_PROG_INSTALL AC_PROG_MAKE_SET @@ -114,6 +116,20 @@ AC_ARG_ENABLE([test-perf], AM_CONDITIONAL([test_perf], [test x$test_perf = xyes ]) ########################################################################## +# Enable/disable test-cpp +########################################################################## +test_cpp=no +AC_ARG_ENABLE([test-cpp], + [ --enable-test-cpp run basic test aginast cpp], + [if test "x$enableval" = "xyes"; then + test_cpp=yes + else + test_cpp=no + fi]) + +AM_CONDITIONAL([test_cpp], [test x$test_cpp = xyes ]) + +########################################################################## # Set optional CUnit path ########################################################################## AC_ARG_WITH([cunit-path], @@ -228,6 +244,7 @@ ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings" # Default include setup ########################################################################## AM_CFLAGS="$AM_CFLAGS $ODP_CFLAGS" +AM_CXXFLAGS="-std=c++11" AC_CONFIG_FILES([Makefile doc/Makefile @@ -244,6 +261,7 @@ AC_CONFIG_FILES([Makefile test/api_test/Makefile test/performance/Makefile test/validation/Makefile + test/miscellaneous/Makefile ]) AC_SEARCH_LIBS([timer_create],[rt posix4]) @@ -276,6 +294,7 @@ AC_MSG_RESULT([ cc: ${CC} cppflags: ${CPPFLAGS} am_cppflags: ${AM_CPPFLAGS} + am_cxxflags: ${AM_CXXFLAGS} cflags: ${CFLAGS} am_cflags: ${AM_CFLAGS} ldflags: ${LDFLAGS} @@ -284,4 +303,5 @@ AC_MSG_RESULT([ cunit: ${cunit_support} test_vald: ${test_vald} test_perf: ${test_perf} + test_cpp: ${test_cpp} ]) diff --git a/test/Makefile.am b/test/Makefile.am index ec2b248..2ba8008 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = api_test performance +SUBDIRS = api_test performance miscellaneous if cunit_support SUBDIRS += validation diff --git a/test/Makefile.inc b/test/Makefile.inc index ebee80a..93ead25 100644 --- a/test/Makefile.inc +++ b/test/Makefile.inc @@ -2,12 +2,13 @@ include $(top_srcdir)/Makefile.inc include $(top_srcdir)/platform/@with_platform@/Makefile.inc LIB = $(top_builddir)/lib LDADD = $(LIB)/libodp.la -AM_CFLAGS += \ - -I$(srcdir) \ +INCFLAGS = -I$(srcdir) \ -I$(top_srcdir)/test \ -I$(top_srcdir)/platform/@with_platform@/include \ -I$(top_srcdir)/platform/linux-generic/include \ -I$(top_srcdir)/include \ -I$(top_srcdir)/helper/include +AM_CFLAGS += $(INCFLAGS) +AM_CXXFLAGS = $(INCFLAGS) AM_LDFLAGS += -L$(LIB) diff --git a/test/miscellaneous/.gitignore b/test/miscellaneous/.gitignore new file mode 100644 index 0000000..134df38 --- /dev/null +++ b/test/miscellaneous/.gitignore @@ -0,0 +1 @@ +odp_api_from_cpp diff --git a/test/miscellaneous/Makefile.am b/test/miscellaneous/Makefile.am new file mode 100644 index 0000000..863643c --- /dev/null +++ b/test/miscellaneous/Makefile.am @@ -0,0 +1,12 @@ +include $(top_srcdir)/test/Makefile.inc + +if test_cpp +bin_PROGRAMS = odp_api_from_cpp +TESTS = odp_api_from_cpp +endif + +odp_api_from_cpp_CXXFLAGS = $(AM_CXXFLAGS) + +odp_api_from_cpp_LDFLAGS = $(AM_LDFLAGS) -static + +dist_odp_api_from_cpp_SOURCES = odp_api_from_cpp.cpp diff --git a/test/miscellaneous/gitignore b/test/miscellaneous/gitignore new file mode 100644 index 0000000..134df38 --- /dev/null +++ b/test/miscellaneous/gitignore @@ -0,0 +1 @@ +odp_api_from_cpp diff --git a/test/miscellaneous/odp_api_from_cpp.cpp b/test/miscellaneous/odp_api_from_cpp.cpp new file mode 100644 index 0000000..e62ef8d --- /dev/null +++ b/test/miscellaneous/odp_api_from_cpp.cpp @@ -0,0 +1,12 @@ +#include +#include +#include + +int main(int argc, const char *argv[]) +{ + + printf("\tODP API version: %s\n", odp_version_api_str()); + printf("\tODP implementation version: %s\n", odp_version_impl_str()); + + return 0; +}