Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FlightOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Armin Luntzer
FlightOS
Commits
c9de6bf5
Commit
c9de6bf5
authored
Dec 6, 2016
by
Armin Luntzer
Browse files
Options
Downloads
Patches
Plain Diff
unit tests: add coverage targets
parent
87b8669a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/testing/unittest/Makefile
+16
-6
16 additions, 6 deletions
tools/testing/unittest/Makefile
tools/testing/unittest/lib.mk
+16
-5
16 additions, 5 deletions
tools/testing/unittest/lib.mk
with
32 additions
and
11 deletions
tools/testing/unittest/Makefile
+
16
−
6
View file @
c9de6bf5
...
@@ -6,14 +6,13 @@ TARGETS += sysctl
...
@@ -6,14 +6,13 @@ TARGETS += sysctl
# Makefile to avoid test build failures when test
# Makefile to avoid test build failures when test
# Makefile doesn't have explicit build rules.
# Makefile doesn't have explicit build rules.
CFLAGS
+=
-fprofile-arcs
-ftest-coverage
export
CFLAGS
=
-fprofile-arcs
-ftest-coverage
export
LDFLAGS
=
-lgcov
--coverage
ifeq
(1,$(MAKELEVEL))
ifeq
(1,$(MAKELEVEL))
override
LDFLAGS
=
override
MAKEFLAGS
=
override
MAKEFLAGS
=
else
else
export
CFLAGS
export
LDFLAGS
=
-lgcov
--coverage
endif
endif
...
@@ -26,9 +25,20 @@ run_tests: all
...
@@ -26,9 +25,20 @@ run_tests: all
for
TARGET
in
$(
TARGETS
);
do
\
for
TARGET
in
$(
TARGETS
);
do
\
make
-C
$$
TARGET run_tests
;
\
make
-C
$$
TARGET run_tests
;
\
done
;
done
;
clean
:
coverage_tests
:
all
for
TARGET
in
$(
TARGETS
);
do
\
make
-C
$$
TARGET coverage_tests
;
\
done
;
clean_coverage
:
for
TARGET
in
$(
TARGETS
);
do
\
make
-C
$$
TARGET clean_coverage
;
\
done
;
clean
:
clean_coverage
for
TARGET
in
$(
TARGETS
);
do
\
for
TARGET
in
$(
TARGETS
);
do
\
make
-C
$$
TARGET clean
;
\
make
-C
$$
TARGET clean
;
\
done
;
done
;
.PHONY
:
install
.PHONY
:
This diff is collapsed.
Click to expand it.
tools/testing/unittest/lib.mk
+
16
−
5
View file @
c9de6bf5
...
@@ -16,13 +16,24 @@ endef
...
@@ -16,13 +16,24 @@ endef
run_tests
:
all
run_tests
:
all
$(
RUN_TESTS
)
$(
RUN_TESTS
)
define
EMIT
_TESTS
define
COVERAGE
_TESTS
@for
TEST
in
$(TEST_PROGS);
do
\
@for
TEST
in
$(TEST_PROGS);
do
\
echo "(./$$TEST && echo \"selftests
:
$$TEST [PASS]
\"
) || echo
\"
selftests: $$TEST [FAIL]
\"
";
\
lcov
--rc
lcov_branch_coverage
=
1
--capture
--directory
./
--output-file
coverage.info
;
\
genhtml
--branch-coverage
coverage.info
--output-directory
out
;
\
done
;
done
;
endef
endef
emit_tests
:
coverage_tests
:
run_tests
$(
EMIT
_TESTS
)
$(
COVERAGE
_TESTS
)
.PHONY
:
run_tests all clean emit_tests
define
CLEAN_COVERAGE
@for
TEST
in
$(TEST_PROGS);
do
\
$(RM)
-r
$$TEST
$$TEST.gcno
$$TEST.gcda
coverage.info
out/;
\
done;
endef
clean_coverage
:
$(
CLEAN_COVERAGE
)
.PHONY
:
run_tests all clean coverage_tests clean_coverage
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment