diff options
author | bloodstalker <thabogre@gmail.com> | 2018-08-06 22:33:24 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-08-06 22:33:24 +0000 |
commit | c2f25957235be95ff66100b2b6b735d58a46575c (patch) | |
tree | a02ff00f95caf79fe926c4151c0cce5e96b5a2b9 /test | |
parent | update (diff) | |
download | faultreiber-c2f25957235be95ff66100b2b6b735d58a46575c.tar.gz faultreiber-c2f25957235be95ff66100b2b6b735d58a46575c.zip |
update
Diffstat (limited to '')
-rw-r--r-- | test/autowasm.c | 2 | ||||
-rw-r--r-- | test/makefile | 49 |
2 files changed, 39 insertions, 12 deletions
diff --git a/test/autowasm.c b/test/autowasm.c index be2800d..0ea860a 100644 --- a/test/autowasm.c +++ b/test/autowasm.c @@ -17,11 +17,13 @@ int main (int argc, char** argv) { magic_number* mn = ft_ret_magic_number(); version* v = ft_ret_version(); W_Type_Section* ts = ft_ret_W_Type_Section(); +#if 0 printf("magic_number:%x\n", mn->magic_number); printf("version:%d\n", v->version); printf("type section id:%d\n", ts->id); printf("type section payloadlength:%d\n", ts->payloadlength); printf("type_section entry count:%d\n", ts->count); +#endif for (int i=0; i < 7; ++i) { //printf("param_count:%d\n",ts->entries[i]->param_count); //printf("param_count:%d\n",ts->entries[i]); diff --git a/test/makefile b/test/makefile index 944bfe1..86f0a6b 100644 --- a/test/makefile +++ b/test/makefile @@ -1,3 +1,5 @@ +SHELL=bash +SHELL?=bash TARGET=autowasm CC=clang CC?=clang @@ -12,8 +14,12 @@ MEM_SANITIZERS_CC= -g -fsanitize=memory -fno-omit-frame-pointer MEM_SANITIZERS_LD= -g -fsanitize=memory UB_SANITIZERS_CC= -g -fsanitize=undefined -fno-omit-frame-pointer UB_SANITIZERS_LD= -g -fsanitize=undefined +COV_CC= -fprofile-instr-generate -fcoverage-mapping +COV_LD= -fprofile-instr-generate # BUILD_MODES are=RELEASE(default), DEBUG,ADDSAN,MEMSAN,UBSAN BUILD_MODE?=RELEASE +OBJ_LIST:=$(patsubst %.c, %.o, $(wildcard *.c)) +ASM_LIST:=$(patsubst %.c, %.dis, $(wildcard *.c)) ifeq ($(BUILD_MODE), ADDSAN) ifeq ($(CC), gcc) @@ -49,13 +55,15 @@ LD_FLAGS+=$(EXTRA_LD_FLAGS) all:$(TARGET) -everything:$(TARGET) A ASM SO $(TARGET)-static $(TARGET)-dbg TAGS +everything:$(TARGET) A ASM SO $(TARGET)-static $(TARGET)-dbg TAGS $(TARGET)-cov depend:.depend .depend:$(SRCS) rm -rf .depend $(CC) -MM $(CC_FLAGS) $^ > ./.depend + echo $(patsubst %.o:, %.odbg:, $(shell $(CC) -MM $(CC_FLAGS) $^)) | sed -r 's/[a-z0-9\-\_]+\.odbg/\n&/g' >> ./.depend + echo $(patsubst %.o:, %.ocov:, $(shell $(CC) -MM $(CC_FLAGS) $^)) | sed -r 's/[a-z0-9\-\_]+\.ocov/\n&/g' >> ./.depend -include ./.depend @@ -65,16 +73,30 @@ depend:.depend %.odbg:%.c $(CC) $(CC_FLAGS) -g -c $< -o $@ -$(TARGET): $(TARGET).o read.o structs.o aggregate.o +%.ocov:%.c + $(CC) $(CC_FLAGS) $(COV_CC) -c $< -o $@ + +$(TARGET): $(TARGET).o read.o aggregate.o structs.o $(CC) $^ $(LD_FLAGS) -o $@ -$(TARGET)-static: $(TARGET).o read.o structs.o aggregate.o +$(TARGET)-static: $(TARGET).o read.o aggregate.o structs.o $(CC) $^ $(LD_FLAGS) -static -o $@ -$(TARGET)-dbg: $(TARGET).odbg read.odbg structs.odbg aggregate.odbg +$(TARGET)-dbg: $(TARGET).odbg read.o aggregate.o structs.o $(CC) $^ $(LD_FLAGS) -g -o $@ -ASM:$(TARGET).asm +$(TARGET)-cov: $(TARGET).ocov read.o aggregate.o structs.o + $(CC) $^ $(LD_FLAGS) $(COV_LD) -o $@ + +cov: + @llvm-profdata merge -sparse ./default.profraw -o ./default.profdata + @llvm-cov show $(TARGET)-cov -instr-profile=default.profdata + +covrep: + @llvm-profdata merge -sparse ./default.profraw -o ./default.profdata + @llvm-cov report $(TARGET)-cov -instr-profile=default.profdata + +ASM:$(ASM_LIST) SO:$(TARGET).so @@ -87,20 +109,20 @@ tags:$(SRCS) sed -e 's/[\\ ]/\n/g'|sed -e '/^$$/d' -e '/\.o:[ \t]*$$/d'|\ ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q) -$(TARGET).asm: $(TARGET).o read.o structs.o aggregate.o - objdump -r -d -M intel -S $(TARGET).o > $(TARGET).asm +%.dis: %.o + objdump -r -d -M intel -S $< > $@ -$(TARGET).so: $(TARGET).o read.o structs.o aggregate.o +$(TARGET).so: $(TARGET).o read.o aggregate.o structs.o $(CC) $^ $(LD_FLAGS) -shared -o $@ -$(TARGET).a: $(TARGET).o read.o structs.o aggregate.o +$(TARGET).a: $(TARGET).o read.o aggregate.o structs.o ar rcs $(TARGET).a $(TARGET).o clean: - rm -f *.o *.odbg *~ $(TARGET) $(TARGET).so $(TARGET).asm $(TARGET)-static $(TARGET)-dbg $(TARGET).a + rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov deepclean: - rm -f *.o *.odbg *~ $(TARGET) $(TARGET).so $(TARGET).asm tags $(TARGET)-static $(TARGET)-dbg $(TARGET).a + rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so tags $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov rm .depend help: @@ -112,7 +134,10 @@ help: @echo "--$(TARGET) builds the dynamically-linked executable" @echo "--$(TARGET)-dbg will generate the debug build. BUILD_MODE should be set to DEBUG to work" @echo "--$(TARGET)-static will statically link the executable to the libraries" + @echo "--$(TARGET)-cov is the coverage build" + @echo "--cov will print the coverage report" + @echo "--covrep will print the coverage report" @echo "--A will build the static library" @echo "--TAGS will build the tags file" @echo "--clean" - @echo "--deepclean will clean almost everything" + @echo "--deepclean$(newline) will clean almost everything" |