Skip to content

Commit

Permalink
test: Build test object when it's really changed
Browse files Browse the repository at this point in the history
It takes quite some time to build all test object but mostly we don't
need build them all.  I wanted to just 100% sure it tests correct code
by build them everytime but I realized it's annoying so change it.

Also change it to be built in the $(objdir) directory.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
  • Loading branch information
namhyung committed Dec 9, 2018
1 parent ca5929d commit 7316f0c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/Makefile
Expand Up @@ -6,9 +6,13 @@ UNIT_TEST_SRC += $(wildcard $(srcdir)/cmds/*.c)
UNIT_TEST_SRC += $(wildcard $(srcdir)/utils/*.c)
UNIT_TEST_SRC += $(wildcard $(srcdir)/arch/$(ARCH)/*.c)
UNIT_TEST_SRC += $(wildcard $(srcdir)/libmcount/*.c)
UNIT_TEST_OBJ := $(patsubst %.c,%.ot,$(UNIT_TEST_SRC))
UNIT_TEST_OBJ := $(patsubst $(srcdir)/%.c,$(objdir)/%.ot,$(UNIT_TEST_SRC))
UNIT_TEST_OBJ := $(filter-out %-nop.ot,$(UNIT_TEST_OBJ))

UNIT_TEST_OBJ_VERSION := $(objdir)/cmds/script.ot $(objdir)/cmds/tui.ot
UNIT_TEST_OBJ_VERSION += $(objdir)/cmds/dump.ot $(objdir)/cmds/info.ot
UNIT_TEST_OBJ_VERSION += $(objdir)/libmcount/mcount.ot

FULL_WORKER := -j $(shell getconf _NPROCESSORS_ONLN || echo 1)

# these needs to be recursively expanded
Expand All @@ -32,7 +36,9 @@ test_unit: unittest
unittest: unittest.c unittest.h $(UNIT_TEST_OBJ)
$(QUIET_LINK)$(CC) -o $@ $(TEST_CFLAGS) $< $(UNIT_TEST_OBJ) $(TEST_LDFLAGS)

$(UNIT_TEST_OBJ): %.ot: %.c $(srcdir)/version.h
$(UNIT_TEST_OBJ_VERSION): $(srcdir)/version.h

$(UNIT_TEST_OBJ): $(objdir)/%.ot: $(srcdir)/%.c
$(QUIET_CC)$(CC) -o $@ -c $(TEST_CFLAGS) $<

clean:
Expand Down

0 comments on commit 7316f0c

Please sign in to comment.