Skip to content

Commit 1800141

Browse files
committed
bricks/simhub: Run tests with coverage.
1 parent 44eea10 commit 1800141

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

bricks/_common/common.mk

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,11 @@ CFLAGS += -fsingle-precision-constant -Wdouble-promotion
213213
endif # end embedded, begin common
214214

215215
# Tune for Debugging or Optimization
216-
ifeq ($(DEBUG), 1)
217-
CFLAGS += -Og -ggdb
216+
ifeq ($(COVERAGE), 1)
217+
CFLAGS += --coverage -fprofile-arcs -ftest-coverage
218+
LDFLAGS += --coverage
219+
else ifeq ($(DEBUG), 1)
220+
CFLAGS += -O0 -ggdb
218221
else ifeq ($(DEBUG), 2)
219222
CFLAGS += -Os -DNDEBUG -flto=auto
220223
else

lib/pbio/platform/sim_hub/pbdrvconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define PBDRV_CONFIG_BUTTON_TEST (1)
1616

1717
#define PBDRV_CONFIG_CLOCK (1)
18-
#ifdef PBDRV_CONFIG_CLOCK_CI
18+
#ifdef PBDRV_CONFIG_RUN_ON_CI
1919
#define PBDRV_CONFIG_CLOCK_TEST (1)
2020
#else
2121
#define PBDRV_CONFIG_CLOCK_LINUX (1)

test-virtualhub.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ if [[ $CI != "true" ]]; then
1111
NOT_CI="true"
1212
fi
1313

14+
: ${COVERAGE:=1}
1415
SCRIPT_DIR=$(readlink -f "$(dirname "$0")")
1516
BRICK_DIR="$SCRIPT_DIR/bricks/simhub"
1617
MP_TEST_DIR="$SCRIPT_DIR/micropython/tests"
1718
PB_TEST_DIR=$"$SCRIPT_DIR/tests"
18-
BUILD_DIR="$BRICK_DIR/build${COVERAGE:+-coverage}"
19+
BUILD_DIR_NAME="build${COVERAGE:+-coverage}"
20+
BUILD_DIR="$BRICK_DIR/$BUILD_DIR_NAME"
1921
PBIO_DIR="$SCRIPT_DIR/lib/pbio"
2022

21-
make -s -j $(nproc --all) -C "$BRICK_DIR" COPT=-DPBDRV_CONFIG_RUN_ON_CI
23+
make -s -j $(nproc --all) -C "$BRICK_DIR" BUILD="$BUILD_DIR_NAME" COPT=-DPBDRV_CONFIG_RUN_ON_CI
2224

2325
export MICROPY_MICROPYTHON="$BUILD_DIR/firmware.elf"
2426

0 commit comments

Comments
 (0)