heap: Change test_multi_heap_on_host multi-config to bash script not Makefile

Hopefully fix some CI building issues with parallel builds.
This commit is contained in:
Angus Gratton 2018-04-03 12:04:12 +10:00 committed by Angus Gratton
parent 712bd1d773
commit 0f5cae0218
4 changed files with 66 additions and 64 deletions

View file

@ -250,7 +250,7 @@ test_multi_heap_on_host:
- wl_host_test - wl_host_test
script: script:
- cd components/heap/test_multi_heap_host - cd components/heap/test_multi_heap_host
- make test - ./test_all_configs.sh
test_build_system: test_build_system:
stage: test stage: test

View file

@ -1,18 +1,49 @@
test: test_poisoning_disabled \ TEST_PROGRAM=test_multi_heap
test_poisoning_light \ all: $(TEST_PROGRAM)
test_poisoning_comprehensive
test_poisoning_disabled: SOURCE_FILES = $(abspath \
@echo ==== HEAP_POISONING_DISABLED ==== ../multi_heap.c \
CPPFLAGS= $(MAKE) -f Makefile.test clean test ../multi_heap_poisoning.c \
test_multi_heap.cpp \
main.cpp \
)
test_poisoning_light: INCLUDE_FLAGS = -I../include -I../../../tools/catch
@echo ==== HEAP_POISONING_LIGHT ====
CPPFLAGS=-DCONFIG_HEAP_POISONING_LIGHT $(MAKE) -f Makefile.test clean test
test_poisoning_comprehensive: GCOV ?= gcov
@echo ==== HEAP_POISONING_COMPREHENSIVE ====
CPPFLAGS=-DCONFIG_HEAP_POISONING_COMPREHENSIVE $(MAKE) -f Makefile.test clean test
%: CPPFLAGS += $(INCLUDE_FLAGS) -D CONFIG_LOG_DEFAULT_LEVEL -g -fstack-protector-all -m32
CPPFLAGS=-DCONFIG_HEAP_POISONING_COMPREHENSIVE $(MAKE) -f Makefile.test $@ CFLAGS += -Wall -Werror -fprofile-arcs -ftest-coverage
CXXFLAGS += -std=c++11 -Wall -Werror -fprofile-arcs -ftest-coverage
LDFLAGS += -lstdc++ -fprofile-arcs -ftest-coverage -m32
OBJ_FILES = $(filter %.o, $(SOURCE_FILES:.cpp=.o) $(SOURCE_FILES:.c=.o))
COVERAGE_FILES = $(OBJ_FILES:.o=.gc*)
$(TEST_PROGRAM): $(OBJ_FILES)
g++ $(LDFLAGS) -o $(TEST_PROGRAM) $(OBJ_FILES)
$(OUTPUT_DIR):
mkdir -p $(OUTPUT_DIR)
test: $(TEST_PROGRAM)
./$(TEST_PROGRAM)
$(COVERAGE_FILES): $(TEST_PROGRAM) test
coverage.info: $(COVERAGE_FILES)
find ../ -name "*.gcno" -exec $(GCOV) -r -pb {} +
lcov --capture --directory $(abspath ../) --no-external --output-file coverage.info --gcov-tool $(GCOV)
coverage_report: coverage.info
genhtml coverage.info --output-directory coverage_report
@echo "Coverage report is in coverage_report/index.html"
clean:
rm -f $(OBJ_FILES) $(TEST_PROGRAM)
rm -f $(COVERAGE_FILES) *.gcov
rm -rf coverage_report/
rm -f coverage.info
.PHONY: clean all test

View file

@ -1,49 +0,0 @@
TEST_PROGRAM=test_multi_heap
all: $(TEST_PROGRAM)
SOURCE_FILES = $(abspath \
../multi_heap.c \
../multi_heap_poisoning.c \
test_multi_heap.cpp \
main.cpp \
)
INCLUDE_FLAGS = -I../include -I../../../tools/catch
GCOV ?= gcov
CPPFLAGS += $(INCLUDE_FLAGS) -D CONFIG_LOG_DEFAULT_LEVEL -g -fstack-protector-all -m32
CFLAGS += -Wall -Werror -fprofile-arcs -ftest-coverage
CXXFLAGS += -std=c++11 -Wall -Werror -fprofile-arcs -ftest-coverage
LDFLAGS += -lstdc++ -fprofile-arcs -ftest-coverage -m32
OBJ_FILES = $(filter %.o, $(SOURCE_FILES:.cpp=.o) $(SOURCE_FILES:.c=.o))
COVERAGE_FILES = $(OBJ_FILES:.o=.gc*)
$(TEST_PROGRAM): $(OBJ_FILES)
g++ $(LDFLAGS) -o $(TEST_PROGRAM) $(OBJ_FILES)
$(OUTPUT_DIR):
mkdir -p $(OUTPUT_DIR)
test: $(TEST_PROGRAM)
./$(TEST_PROGRAM)
$(COVERAGE_FILES): $(TEST_PROGRAM) test
coverage.info: $(COVERAGE_FILES)
find ../ -name "*.gcno" -exec $(GCOV) -r -pb {} +
lcov --capture --directory $(abspath ../) --no-external --output-file coverage.info --gcov-tool $(GCOV)
coverage_report: coverage.info
genhtml coverage.info --output-directory coverage_report
@echo "Coverage report is in coverage_report/index.html"
clean:
rm -f $(OBJ_FILES) $(TEST_PROGRAM)
rm -f $(COVERAGE_FILES) *.gcov
rm -rf coverage_report/
rm -f coverage.info
.PHONY: clean all test

View file

@ -0,0 +1,20 @@
#!/bin/bash
#
# Run the test suite with all configurations enabled
#
FAIL=0
for FLAGS in "CONFIG_HEAP_POISONING_NONE" "CONFIG_HEAP_POISONING_LIGHT" "CONFIG_HEAP_POISONING_COMPREHENSIVE"; do
echo "==== Testing with config: ${FLAGS} ===="
CPPFLAGS="-D${FLAGS}" make clean test || FAIL=1
done
make clean
if [ $FAIL == 0 ]; then
echo "All configurations passed"
else
echo "Some configurations failed, see log."
exit 1
fi