Browse Source

TT#14008 move build tests to a wrapper script

Since dh_auto_test doesn't execute the test suites through make
directly, but instead runs `make -s -n` and then executes the output,
the integrated build tests fail since the sub-make doesn't return an
error as it should when attempting to build with the wrong .h
alternative, resulting in always the first .h alternative being used.
Fix this by using a wrapper script instead.

Also adjust some other related minor build details.

closes #1202

Change-Id: I4b6436295c6b39117bd06df53aa5afc7118ad6a1
pull/1219/head
Richard Fuchs 5 years ago
parent
commit
52d9768418
4 changed files with 31 additions and 22 deletions
  1. +0
    -5
      daemon/Makefile
  2. +8
    -15
      lib/common.Makefile
  3. +4
    -2
      t/Makefile
  4. +19
    -0
      utils/build_test_wrapper

+ 0
- 5
daemon/Makefile View File

@ -90,8 +90,3 @@ PODS= rtpengine.pod
MANS= $(PODS:.pod=.8)
include ../lib/common.Makefile
ifeq ($(with_transcoding),yes)
codec.c: dtmf_rx_fillin.h
t38.c: spandsp_logging.h
endif

+ 8
- 15
lib/common.Makefile View File

@ -36,23 +36,16 @@ $(DAEMONSRCS) $(HASHSRCS): $(patsubst %,../daemon/%,$(DAEMONSRCS)) $(patsubst %,
resample.c: fix_frame_channel_layout.h
ifeq ($(with_transcoding),yes)
codec.c: dtmf_rx_fillin.h
endif
t38.c: spandsp_logging.h
%.strhash.c: %.c ../utils/const_str_hash
../utils/const_str_hash < $< > $@
../utils/const_str_hash < "$<" > "$@"
$(BUILD_TEST_ALTS): ../lib/$(@:.h=-*)
echo "Looking for usable alternative for $@"; \
rm -f $(@:.h=-test{.c,}); \
ln -s ../lib/$(@:.h=-test.c); \
for x in ../lib/$(@:.h=-*.h); do \
echo "Trying build with $$x"; \
rm -f "$@"; \
echo '/******** GENERATED FILE ********/' > "$@"; \
cat "$$x" >> "$@"; \
$(MAKE) $(@:.h=-test) && break; \
echo "Failed build with $$x"; \
rm -f "$@"; \
done; \
rm -f $(@:.h=-test{.c,}); \
test -f "$@"
../utils/build_test_wrapper "$@"
.PHONY: all debug clean install

+ 4
- 2
t/Makefile View File

@ -172,5 +172,7 @@ test-const_str_hash.strhash: test-const_str_hash.strhash.o $(COMMONOBJS)
tests-preload.so: tests-preload.c
$(CC) -g -D_GNU_SOURCE -std=c99 -o $@ -Wall -shared -fPIC $< -ldl
codec.c: dtmf_rx_fillin.h
t38.c: spandsp_logging.h
spandsp_send_fax_pcm.c: spandsp_logging.h
spandsp_send_fax_t38.c: spandsp_logging.h
spandsp_recv_fax_t38.c: spandsp_logging.h
spandsp_recv_fax_pcm.c: spandsp_logging.h

+ 19
- 0
utils/build_test_wrapper View File

@ -0,0 +1,19 @@
#!/bin/sh
TARGET=$1
ROOT=$(echo "$TARGET" | sed 's/\.h$//')
if test "x$MAKE" = x; then
MAKE=make
fi
echo "Looking for usable alternative for $TARGET"
rm -f "$ROOT"-test "$ROOT"-test.c
ln -s ../lib/"$ROOT"-test.c
for x in ../lib/"$ROOT"*.h; do
echo "Trying build with $x"
rm -f "$TARGET"
(echo '/******** GENERATED FILE ********/'; cat "$x") > "$TARGET"
$MAKE "$ROOT"-test && break
echo "Failed build with $x"
rm -f "$TARGET"
done
rm -f "$ROOT"-test "$ROOT"-test.c
test -f "$TARGET"

Loading…
Cancel
Save