This repo was created in response to https://stackoverflow.com/questions/68136230
Last active
May 27, 2022 04:25
-
-
Save latk/102b125dff160484f93d8997204fc201 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
void fun1(){ | |
printf("fun1\n"); | |
} | |
void fun2(){ | |
printf("fun2\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: help question answer answer-gcovr clean | |
help: | |
@echo "Available targets:" | |
@echo " make question" | |
@echo " make answer" | |
@echo " make answer-gcovr" | |
clean: | |
rm -rf ut1 ut2 *.gcda *.gcno *.o *.json coverage.* | |
question: clean | |
gcc -Wall -fprofile-arcs -ftest-coverage ut1.c common.c -o ut1 | |
gcc -Wall -fprofile-arcs -ftest-coverage ut2.c common.c -o ut2 | |
./ut1 | |
./ut2 | |
gcov common.c | |
cat common.c.gcov | |
answer: clean | |
gcc -Wall --coverage -c common.c -o common.o | |
gcc -Wall --coverage ut1.c common.o -o ut1 | |
gcc -Wall --coverage ut2.c common.o -o ut2 | |
./ut1 | |
./ut2 | |
gcov common.c | |
cat common.c.gcov | |
answer-gcovr: clean | |
gcc -Wall --coverage ut1.c common.c -o ut1 | |
./ut1 | |
gcovr --json ut1.json | |
rm *.gcda *.gcno | |
gcc -Wall --coverage ut2.c common.c -o ut2 | |
./ut2 | |
gcovr --json ut2.json | |
gcovr -a ut1.json -a ut2.json --html-details coverage.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
void fun1(); | |
int main(){ | |
fun1(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
void fun2(); | |
int main(){ | |
fun2(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment