diff options
author | Vic Yang <victoryang@chromium.org> | 2013-05-02 00:37:07 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-05-07 09:09:50 -0700 |
commit | 0a45fa17086d4556b7cb4ea0a9f53894197bc897 (patch) | |
tree | f2363f2a2320000404125bb36225e1420929d45d /Makefile.rules | |
parent | b02c7b461740c457c6904a5d9d9f445afaa849cb (diff) | |
download | chrome-ec-0a45fa17086d4556b7cb4ea0a9f53894197bc897.tar.gz |
Pthread-based emulator for unit testingstabilize-4100.38.B
This is the first version of pthread-based RTOS emulator. With this, we
will be able to test high-level modules entirely on the host machine.
BUG=chrome-os-partner:19325
TEST='make runtests' and see tests passing.
BRANCH=None
Change-Id: I1f5fcd76aa84bdb46c7d35c5e60ae5d92fd3a319
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49954
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'Makefile.rules')
-rw-r--r-- | Makefile.rules | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/Makefile.rules b/Makefile.rules index e9b0a1802c..4def77851c 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -34,12 +34,14 @@ cmd_flat_to_obj = $(CC) -T $(out)/firmware_image.lds -nostdlib $(CPPFLAGS) \ cmd_elf_to_flat = $(OBJCOPY) -O binary $^ $@ cmd_elf_to_dis = $(OBJDUMP) -D $< > $@ cmd_elf = $(LD) $(LDFLAGS) $(objs) -o $@ -T $< -Map $(out)/$*.map +cmd_exe = $(CC) $(HOST_TEST_LDFLAGS) $(objs) -o $@ cmd_c_to_o = $(CC) $(CFLAGS) -MMD -MF $@.d -c $< -o $@ cmd_c_to_build = $(BUILDCC) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) \ -MMD -MF $@.d $< -o $@ cmd_c_to_host = $(HOSTCC) $(HOST_CFLAGS) -MMD -MF $@.d $(filter %.c, $^) -o $@ cmd_qemu = ./util/run_qemu_test --image=build/$(BOARD)/$*/$*.bin test/$*.py \ $(silent) +cmd_host_test = ./util/run_host_test $* $(silent) cmd_version = ./util/getversion.sh > $@ cmd_mv_from_tmp = mv $(out)/$*.bin.tmp $(out)/$*.bin cmd_extractrw-y = cd $(out) && \ @@ -47,7 +49,7 @@ cmd_extractrw-y = cd $(out) && \ mv RW_SECTION_A $(PROJECT).RW.bin cmd_copyrw-y = cd $(out) && cp $(PROJECT).RW.flat $(PROJECT).RW.bin -.PHONY: all tests utils +.PHONY: all tests utils hosttests all: $(out)/$(PROJECT).bin utils dis-y = $(out)/$(PROJECT).RO.dis $(out)/$(PROJECT).RW.dis @@ -55,9 +57,10 @@ dis: $(dis-y) utils: $(build-utils) $(host-utils) +# On board test binaries test-targets=$(foreach t,$(test-list-y),test-$(t)) qemu-test-targets=$(foreach t,$(test-list-y),qemu-$(t)) -.PHONY: $(qemu-test-target) $(test-targets) +.PHONY: $(qemu-test-targets) $(test-targets) $(test-targets): test-%: @set -e ; \ @@ -72,6 +75,24 @@ $(qemu-test-targets): qemu-%: test-% tests: $(test-targets) qemu-tests: $(qemu-test-targets) +# Emulator test executables +host-test-targets=$(foreach t,$(test-list-host),host-$(t)) +run-test-targets=$(foreach t,$(test-list-host),run-$(t)) +.PHONY: $(host-test-targets) $(run-test-targets) + +$(host-test-targets): host-%: + @set -e ; \ + echo " BUILD host - build/host/$*" ; \ + $(MAKE) --no-print-directory BOARD=host PROJECT=$* \ + V=$(V) out=build/host/$* TEST_BUILD=y EMU_BUILD=y \ + CROSS_COMPILE= build/host/$*/$*.exe + +$(run-test-targets): run-%: host-% + $(call quiet,host_test,TEST ) + +hosttests: $(host-test-targets) +runtests: $(run-test-targets) + $(out)/firmware_image.lds: common/firmware_image.lds.S $(call quiet,lds,LDS ) $(out)/%.lds: core/$(CORE)/ec.lds.S @@ -98,6 +119,9 @@ $(out)/%.flat: $(out)/%.elf $(out)/%.elf: $(out)/%.lds $(objs) $(call quiet,elf,LD ) +$(out)/$(PROJECT).exe: $(objs) + $(call quiet,exe,EXE ) + $(out)/%.o:%.c $(call quiet,c_to_o,CC ) |