On 10/19/2015 09:43 PM, Jakub Hrozek wrote:
I'm working on pam_sss.so tests and I ran into a problem that
know how to solve best.
tl;dr, I would like to set different environment variables for different
tests in order to set up cwrap libraries differently per-test.
I can't use setenv() in the test itself, because that's too late, I need
the variables to be set when __attribute__(constructor) is run, so normally
at program startup, when the libraries are loaded.
With cmake it's easy, use set(TEST_ENVIRONMENT). But with autotools, I
only found two ways:
- TESTS_ENVIRONMENT - this is fine, but it's per Makefile.am. So I
would have to split the tests more, into pam_wrapper tests that also
require uid_wrapper, tests that only require pam_wrapper, ...
- LOG_COMPILER - this allows to run a wrapper script before a test
that receives the test name as argv. So this is pretty much what I
want except this is a feature new to automake 1.12, which would
rule out both RHEL-6 and Ubuntu Trusty (which is used by Travis)
So I'm really leaning towards creating a src/tests/cwrap/pwrap/Makefile.am
and src/tests/cwrap/pwrap_root/Makefile.am. The downside of multiple
Makefile.am files is that there is some code duplication and the build
takes longer. But I still think there is enough interest (from us and from
our users) to support git master on old platforms. I can file a ticket to
remove this and use LOG_COMPILER when we drop support for RHEL-6 and old
If you disagree, please reply, otherwise I'm going to send a patch with
Ah, so these are unit tests, not integration tests?
I'm not sure I understood everything right, sorry, but perhaps you can find
something useful in contrib/ci/run, contrib/ci/make-check-wrap and
contrib/ci/valgrind-condense where CI matches and handles particular tests
differently regardless of whether LOG_COMPILER is supported or not. Ping me
if you need help figuring out what's going on there.
Granted this is from outside the build, but maybe you can concoct something
from inside as well.