Skip to content

Commit

Permalink
Merge pull request #14 from pan-apple/fix-coverage-reporting
Browse files Browse the repository at this point in the history
Fix code coverage reporting during build process

Thanks! Merging based on 3 approvals.
  • Loading branch information
woody-apple authored Mar 8, 2020
2 parents d2d3e69 + 876bed9 commit d2864b8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .yams/cpp_rules.min
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,34 @@ $(Test_Dir)/%_q: $(Test_Dir)/%.c
ifdef CLANG_FORMAT
@$(CLANG_FORMAT) $<
endif
@$(CC) $< -o $@ $(Module_Test_C_Flags) -L/usr/local/lib $($(*F)_FLAGS) -fprofile-arcs -ftest-coverage -fprofile-dir="$(Test_Dir)"
@$(CC) $< -o $@ $(Module_Test_C_Flags) -L/usr/local/lib $($(*F)_FLAGS) -fprofile-arcs -ftest-coverage
ifdef CPPCHECK
@$(CPPCHECK) $(Module_Test_Includes) $($(*F)_Inc_FLAGS) $<
endif
@mv $(*F).gc* $(Test_Dir)
@echo "Building tests <= $<"

$(Test_Dir)/%_q: $(Test_Dir)/%.cpp
ifdef CLANG_FORMAT
@$(CLANG_FORMAT) $<
endif
@$(CXX) $< -o $@ $(Module_Test_C_Flags) -L/usr/local/lib $($(*F)_FLAGS) -fprofile-arcs -ftest-coverage -fprofile-dir="$(Test_Dir)"
@$(CXX) $< -o $@ $(Module_Test_C_Flags) -L/usr/local/lib $($(*F)_FLAGS) -fprofile-arcs -ftest-coverage
ifdef CPPCHECK
@$(CPPCHECK) $(Module_Test_Includes) $($(*F)_Inc_FLAGS) $<
endif
@mv $(*F).gc* $(Test_Dir)
@echo "Building tests <= $<"

run_tests: $(Tests_C_Exe) $(Tests_CPP_Exe)
@echo "Running tests <= $<"
@$(foreach f,$^,$(VALGRIND) ./$(f);)
ifneq ($(and $(GCOV),$(Tests_C_Files)),)
@$(GCOV) $(Tests_C_Files)
@$(GCOV) $(notdir $(Tests_C_Files))
endif
ifneq ($(and $(GCOV),$(Tests_CPP_Files)),)
@$(GCOV) $(Tests_CPP_Files)
@$(GCOV) $(notdir $(Tests_CPP_Files))
endif

my_clean:
@rm -f $(C_Objects) $(CPP_Objects)
@rm -f *.gcda *.gcno *.gcov
@rm -f $(Tests_C_Exe) $(Tests_CPP_Exe) $(Test_Dir)/*.gcda $(Test_Dir)/*.gcno $(Test_Dir)/*.gcov
@rm -rf $(Test_Dir)/*.dSYM

0 comments on commit d2864b8

Please sign in to comment.