From patchwork Tue Feb 24 21:13:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Holmes X-Patchwork-Id: 44995 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 7AD1F20502 for ; Tue, 24 Feb 2015 21:14:06 +0000 (UTC) Received: by labgm9 with SMTP id gm9sf19067639lab.2 for ; Tue, 24 Feb 2015 13:14:05 -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: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=iGGLP7bSuj7pWJUaMKcC58BHa+PAiuyO8svFYBdfKdA=; b=W2YcxsJTAAS7zsEtdBevVM0ZUVtxvurVzqFjPI9tLTTGwfHmkHpjup34KwENlDuOqP CVWFWpHdZtucKIa18Cygmo53cUUivssdc3sS6vhv7SI/04pP51NXUs3gFYzsPm8r7Mu/ 6DRvCza/v8ldJfqAkNl0eFzt93eNQJ4Sz9CoK9gu5SM6rrXOT82UMI0cCQxitbdkc/ig Pe6gmAIyWJqL9Rd3/B1uSfWTU5nSRK9k0/mQ4vWih2ZdFUCLpJUTjxtSejdxsCEB4nPq hJmj+TgeUgYwbIiqVIWq2gATHubS42a3rKN68jqExcDmn7CUiIBdm77YTpYII8r4rGfr i6Bg== X-Gm-Message-State: ALoCoQk305N2bzR2vNXv/V502Pm6SwqEG/t6EogO720C7seenCRg2Vmk6IM4svi6VZWOVaZaSz56 X-Received: by 10.112.35.135 with SMTP id h7mr2431645lbj.23.1424812445431; Tue, 24 Feb 2015 13:14:05 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.134 with SMTP id ky6ls497399lac.76.gmail; Tue, 24 Feb 2015 13:14:05 -0800 (PST) X-Received: by 10.152.6.66 with SMTP id y2mr16040977lay.25.1424812445199; Tue, 24 Feb 2015 13:14:05 -0800 (PST) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id uh4si10548055lbb.109.2015.02.24.13.14.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Feb 2015 13:14:05 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by lbiz12 with SMTP id z12so27597349lbi.11 for ; Tue, 24 Feb 2015 13:14:05 -0800 (PST) X-Received: by 10.112.14.196 with SMTP id r4mr16169683lbc.86.1424812445052; Tue, 24 Feb 2015 13:14:05 -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 h5csp2180923lbj; Tue, 24 Feb 2015 13:14:04 -0800 (PST) X-Received: by 10.229.80.72 with SMTP id s8mr41251028qck.24.1424812443321; Tue, 24 Feb 2015 13:14:03 -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 206si24201264qhr.86.2015.02.24.13.14.01 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 24 Feb 2015 13:14:03 -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 1YQMnn-00062i-Bj; Tue, 24 Feb 2015 21:13:59 +0000 Received: from mail-qa0-f49.google.com ([209.85.216.49]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YQMnh-00062L-VQ for lng-odp@lists.linaro.org; Tue, 24 Feb 2015 21:13:53 +0000 Received: by mail-qa0-f49.google.com with SMTP id w8so29006710qac.8 for ; Tue, 24 Feb 2015 13:13:48 -0800 (PST) X-Received: by 10.140.88.17 with SMTP id s17mr38474629qgd.79.1424812428743; Tue, 24 Feb 2015 13:13:48 -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 f9sm20089904qhc.10.2015.02.24.13.13.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Feb 2015 13:13:47 -0800 (PST) From: Mike Holmes To: lng-odp@lists.linaro.org Date: Tue, 24 Feb 2015 16:13:40 -0500 Message-Id: <1424812420-29956-1-git-send-email-mike.holmes@linaro.org> X-Mailer: git-send-email 2.1.0 X-Topics: patch Subject: [lng-odp] [PATCH v3] 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.217.172 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 --- v3 added dissable to configure added stc=c++11 NOTE checkpatch gets confused with the cc - looks like it thinks it is an email cc. configure.ac | 25 ++++++++++++++++++++++++- 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, 54 insertions(+), 4 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..2fe9d49 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,24 @@ AC_ARG_ENABLE([test-perf], AM_CONDITIONAL([test_perf], [test x$test_perf = xyes ]) ########################################################################## +# Enable/disable test-cpp +########################################################################## +if test "$GXX" = "yes"; then +test_cpp=yes +else +test_cpp=no +fi +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], @@ -223,11 +243,11 @@ ODP_CFLAGS="$ODP_CFLAGS -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototype ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations -Wold-style-definition -Wpointer-arith" ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral" 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 +264,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 +297,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 +306,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; +}