Skip to content

Commit 8602675

Browse files
committed
bricks/simhub: Run tests with coverage.
1 parent a310c8d commit 8602675

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ SCRIPT_DIR=$(readlink -f "$(dirname "$0")")
1515
BRICK_DIR="$SCRIPT_DIR/bricks/simhub"
1616
MP_TEST_DIR="$SCRIPT_DIR/micropython/tests"
1717
PB_TEST_DIR=$"$SCRIPT_DIR/tests"
18-
BUILD_DIR="$BRICK_DIR/build${COVERAGE:+-coverage}"
18+
BUILD_DIR_NAME="build${COVERAGE:+-coverage}"
19+
BUILD_DIR="$BRICK_DIR/$BUILD_DIR_NAME"
1920
PBIO_DIR="$SCRIPT_DIR/lib/pbio"
2021

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

2324
export MICROPY_MICROPYTHON="$BUILD_DIR/firmware.elf"
2425

0 commit comments

Comments
 (0)