All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ossama Othman <ossama.othman@intel.com>
To: ell@lists.01.org
Subject: [PATCH 2/2] unit: Added a minimal C++ build test.
Date: Wed, 23 Jan 2019 11:06:10 -0800	[thread overview]
Message-ID: <20190123190610.3787-3-ossama.othman@intel.com> (raw)
In-Reply-To: <20190123190610.3787-1-ossama.othman@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2817 bytes --]

---
 .gitignore              |  1 +
 Makefile.am             |  6 ++++++
 configure.ac            |  3 +++
 unit/test-cxx-build.cpp | 42 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 52 insertions(+)
 create mode 100644 unit/test-cxx-build.cpp

diff --git a/.gitignore b/.gitignore
index 75ab7b2..f10c973 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,6 +58,7 @@ unit/test-dhcp
 unit/test-dir-watch
 unit/test-ecc
 unit/test-ecdh
+unit/test-cxx-build
 unit/cert-*.pem
 unit/cert-*.csr
 unit/cert-*.srl
diff --git a/Makefile.am b/Makefile.am
index 3eecbe0..e7da974 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -292,6 +292,12 @@ unit_test_ecc_LDADD = ell/libell-private.la
 unit_test_ecdh_LDADD = ell/libell-private.la
 unit_test_ecdh_LDFLAGS = -Wl,-wrap,l_getrandom
 
+if HAVE_CXX
+unit_tests += unit/test-cxx-build
+unit_test_cxx_build_SOURCES = unit/test-cxx-build.cpp
+unit_test_cxx_build_LDADD = ell/libell-private.la
+endif
+
 if MAINTAINER_MODE
 noinst_LTLIBRARIES += unit/example-plugin.la
 endif
diff --git a/configure.ac b/configure.ac
index 1eeebec..f2d1c4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,6 +125,9 @@ fi
 AM_CONDITIONAL(GLIB, test "${enable_glib}" = "yes")
 
 if (test "$USE_MAINTAINER_MODE" = "yes"); then
+	AC_PROG_CXX
+	AM_CONDITIONAL([HAVE_CXX], [test -n "$CXX"])
+
 	AC_CHECK_PROG(have_openssl, [openssl], [yes], [no])
 	AC_CHECK_PROG(have_xxd, [xxd], [yes], [no])
 fi
diff --git a/unit/test-cxx-build.cpp b/unit/test-cxx-build.cpp
new file mode 100644
index 0000000..2233815
--- /dev/null
+++ b/unit/test-cxx-build.cpp
@@ -0,0 +1,42 @@
+/*
+ *
+ *  Embedded Linux library
+ *
+ *  Copyright (C) 2019  Intel Corporation. All rights reserved.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <ell/ell.h>
+
+int main()
+{
+	if (!l_main_init())
+		return -1;
+
+	l_log_set_stderr();
+	l_debug_enable("*");
+
+	l_debug("hello");
+
+	l_main_exit();
+
+	return 0;
+}
-- 
2.17.1


      parent reply	other threads:[~2019-01-23 19:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23 19:06 [PATCH 0/2] Correct ELL header errors included C++ code Ossama Othman
2019-01-23 19:06 ` [PATCH 1/2] key: Avoid using C++ keywords as param names Ossama Othman
2019-01-23 19:10   ` Denis Kenzior
2019-01-23 19:06 ` Ossama Othman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190123190610.3787-3-ossama.othman@intel.com \
    --to=ossama.othman@intel.com \
    --cc=ell@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.