avoid file descriptor leak in replication
[iwhd.git] / t / Makefile.am
blob263ec73787999cae9aae95d72560e34186f6ae1c
1 ## Process this file with automake to create Makefile.in
2 # Copyright 2010-2011 Red Hat, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 TESTS =                                         \
18   parser-test                                   \
19   basic                                         \
20   provider                                      \
21   replication                                   \
22   auto
24 EXTRA_DIST =                                    \
25   $(TESTS)                                      \
26   init.cfg                                      \
27   init.sh
29 check_PROGRAMS = parser
31 BUILT_SOURCES =
32 BUILT_SOURCES += parser.c
33 MAINTAINERCLEANFILES = $(BUILT_SOURCES)
34 parser_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/lib
35 parser_LDADD = -L../lib -liwhd -lgc -lpthread
37 parser.c: Makefile.am
38         rm -f $@-t $@
39         printf '#define PARSER_UNIT_TEST 1\n' > $@-t
40         printf '#include "iwhd-qparser.c"\n' >> $@-t
41         chmod a=r $@-t
42         mv $@-t $@
44 TESTS_ENVIRONMENT =                             \
45   tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.; \
46   TMPDIR=$$tmp__; export TMPDIR;                \
47   exec 9>&2;                                    \
48   shell_or_perl_() {                            \
49     if grep '^\#!/usr/bin/perl' "$$1" > /dev/null; then                 \
50       if $(PERL) -e 'use warnings' > /dev/null 2>&1; then               \
51         grep '^\#!/usr/bin/perl -T' "$$1" > /dev/null && T_=T || T_=;   \
52         $(PERL) -w$$T_ -I$(srcdir) -MCoreutils                          \
53               -M"CuTmpdir qw($$f)" -- "$$1";    \
54       else                                      \
55         echo 1>&2 "$$tst: configure did not find a usable version of Perl," \
56           "so skipping this test";              \
57         (exit 77);                              \
58       fi;                                       \
59     else                                        \
60       $(SHELL) "$$1";                           \
61     fi;                                         \
62   };                                            \
63   export                                        \
64   LC_ALL=C                                      \
65   VERSION=$(VERSION)                            \
66   abs_top_builddir='$(abs_top_builddir)'        \
67   abs_top_srcdir='$(abs_top_srcdir)'            \
68   abs_srcdir='$(abs_srcdir)'                    \
69   built_programs='$(built_programs)'            \
70   srcdir='$(srcdir)'                            \
71   top_srcdir='$(top_srcdir)'                    \
72   CC='$(CC)'                                    \
73   IWHD_TEST_NAME=`echo $$tst|sed 's,^\./,,;s,/,-,g'` \
74   MALLOC_PERTURB_=$(MALLOC_PERTURB_); export MALLOC_PERTURB_ \
75   PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)'      \
76   PACKAGE_VERSION=$(PACKAGE_VERSION)            \
77   PERL='$(PERL)'                                \
78   SHELL='$(SHELL)'                              \
79   PATH='$(abs_top_builddir)$(PATH_SEPARATOR)'"$$PATH" \
80   ; shell_or_perl_