[SSSD] [PATCH] test_ipa_subdomains_server: Fix build with --coverage

Lukas Slebodnik lslebodn at redhat.com
Wed Jun 17 13:32:10 UTC 2015


ehlo,

I was able to reproduce failed build in covergae phase on local machine.

It seems that gcc did some optimization and
used execve instead of execle when the code was
instrumented for coverage analysis.

So the exec* function was not wrapped and it tried to call
real binary ipa-getkeytab. Obviously it failed.

LS
-------------- next part --------------
>From 727d2dae8b65697269bd2e43adeb06500d65ac11 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 17 Jun 2015 14:29:09 +0200
Subject: [PATCH] test_ipa_subdomains_server: Fix build with --coverage

It seems that gcc did some optimization and
used execve instead of execle when the code was
instrumented for coverage analysis.

So the exec* function was not wrapped and it tried to call
real binary ipa-getkeytab
---
 Makefile.am                                   | 1 +
 src/tests/cmocka/test_ipa_subdomains_server.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index c21c1f3e93d0d25b47ea9cb3ed2e8919c641dd32..146587ec18e8745480b78fb28d4f30f8524f29f5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2470,6 +2470,7 @@ test_ipa_subdom_server_CFLAGS = \
 test_ipa_subdom_server_LDFLAGS = \
     -Wl,-wrap,krb5_kt_default \
     -Wl,-wrap,execle \
+    -Wl,-wrap,execve \
     $(NULL)
 test_ipa_subdom_server_LDADD = \
     $(PAM_LIBS) \
diff --git a/src/tests/cmocka/test_ipa_subdomains_server.c b/src/tests/cmocka/test_ipa_subdomains_server.c
index 84b52534d2c90104d44162f3816a82c88d24769a..dbe070c3eb947b68ff34101b27b51a3e8f7be1da 100644
--- a/src/tests/cmocka/test_ipa_subdomains_server.c
+++ b/src/tests/cmocka/test_ipa_subdomains_server.c
@@ -89,6 +89,12 @@ int __wrap_execle(const char *path, const char *arg, ...)
     _exit(0);
 }
 
+int __wrap_execve(const char *path, const char *arg, ...)
+{
+    create_dummy_keytab();
+    _exit(0);
+}
+
 struct trust_test_ctx {
     struct sss_test_ctx *tctx;
     struct be_ctx *be_ctx;
-- 
2.4.3



More information about the sssd-devel mailing list