From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Kent Gibson <warthog618@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-gpio@vger.kernel.org, Bartosz Golaszewski <brgl@bgdev.pl>
Subject: [libgpiod v2][PATCH 3/4] build: add a configure option for enabling gcov profiling
Date: Thu, 10 Feb 2022 15:07:44 +0100 [thread overview]
Message-ID: <20220210140745.1059087-4-brgl@bgdev.pl> (raw)
In-Reply-To: <20220210140745.1059087-1-brgl@bgdev.pl>
Add a configure switch that adds the relevant gcov options to the
compiler flags for the core library and tests.
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
.gitignore | 4 ++++
configure.ac | 10 ++++++++++
lib/Makefile.am | 1 +
tests/Makefile.am | 1 +
4 files changed, 16 insertions(+)
diff --git a/.gitignore b/.gitignore
index 2d7cc7f..58e1c5f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,7 @@ libtool
*-libtool
m4/
stamp-h1
+
+# profiling
+*.gcda
+*.gcno
diff --git a/configure.ac b/configure.ac
index 8e74104..dc09d70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -122,6 +122,16 @@ AC_ARG_ENABLE([tests],
[with_tests=false])
AM_CONDITIONAL([WITH_TESTS], [test "x$with_tests" = xtrue])
+AC_ARG_ENABLE([profiling],
+ [AS_HELP_STRING([--enable-profiling],
+ [enable gcov profiling on the core library and tests [default=no]])],
+ [if test "x$enableval" = xyes; then with_profiling=true; fi],
+ [with_profiling=false])
+if test "x$with_profiling" = xtrue
+then
+ AC_SUBST(PROFILING_FLAGS, ["-fprofile-arcs -ftest-coverage"])
+fi
+
AC_DEFUN([FUNC_NOT_FOUND_TESTS],
[ERR_NOT_FOUND([$1()], [tests])])
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 5423f72..5219855 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -17,6 +17,7 @@ libgpiod_la_SOURCES = chip.c \
libgpiod_la_CFLAGS = -Wall -Wextra -g -std=gnu89
libgpiod_la_CFLAGS += -fvisibility=hidden -I$(top_srcdir)/include/
libgpiod_la_CFLAGS += -include $(top_builddir)/config.h
+libgpiod_la_CFLAGS += $(PROFILING_FLAGS)
libgpiod_la_LDFLAGS = -version-info $(subst .,:,$(ABI_VERSION))
pkgconfigdir = $(libdir)/pkgconfig
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7bf5e3f..8ec51e9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -7,6 +7,7 @@ AM_CFLAGS = -I$(top_srcdir)/include/ -I$(top_srcdir)/tests/gpiosim/
AM_CFLAGS += -include $(top_builddir)/config.h
AM_CFLAGS += -Wall -Wextra -g -std=gnu89 $(GLIB_CFLAGS)
AM_CFLAGS += -DG_LOG_DOMAIN=\"gpiod-test\"
+AM_CFLAGS += $(PROFILING_FLAGS)
AM_LDFLAGS = -pthread
LDADD = $(top_builddir)/lib/libgpiod.la
LDADD += $(top_builddir)/tests/gpiosim/libgpiosim.la
--
2.30.1
next prev parent reply other threads:[~2022-02-10 14:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-10 14:07 [libgpiod v2][PATCH 0/4] libgpiod v2: rewrite tests for the C library Bartosz Golaszewski
2022-02-10 14:07 ` [libgpiod v2][PATCH 1/4] line-request: don't accept NULL line config Bartosz Golaszewski
2022-02-17 3:02 ` Kent Gibson
2022-02-10 14:07 ` [libgpiod v2][PATCH 2/4] line-config: expose the override logic to users Bartosz Golaszewski
2022-02-17 4:32 ` Kent Gibson
2022-02-10 14:07 ` Bartosz Golaszewski [this message]
2022-02-10 14:07 ` [libgpiod v2][PATCH 4/4] tests: rewrite core C tests using libgpiosim Bartosz Golaszewski
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=20220210140745.1059087-4-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=warthog618@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).