Skip to content
Browse files

Merge pull request #36 from thequux/codecoverage

Added coverage support
  • Loading branch information...
2 parents 59c8944 + 04ba15d commit 2f7f7d6fc4c1f231e2577e4348d909c68ee4e220 @abiggerhammer abiggerhammer committed
Showing with 19 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +6 −1 .travis.yml
  3. +12 −0 SConstruct
View
1 .gitignore
@@ -17,3 +17,4 @@ TAGS
docs/milestone2.dot.pdf
*.dot.pdf
Session.vim
+*.gcov
View
7 .travis.yml
@@ -2,6 +2,11 @@ language: c
compiler:
- gcc
- clang
-script: scons
+before_install:
+ - sudo pip install cpp-coveralls --use-mirrors
+script:
+ - scons --coverage
+after_success:
+ - coveralls
notifications:
irc: "irc.upstandinghackers.com#hammer"
View
12 SConstruct
@@ -12,6 +12,12 @@ AddOption("--variant",
action="store",
help="Build variant (debug or opt)")
+AddOption("--coverage",
+ dest="coverage",
+ default=False,
+ action="store_true",
+ help="Build with coverage instrumentation")
+
env['BUILDDIR'] = 'build/$VARIANT'
dbg = env.Clone(VARIANT='debug')
@@ -25,6 +31,12 @@ if GetOption("variant") == 'debug':
else:
env = opt
+if GetOption("coverage"):
+ env.Append(CFLAGS=["-fprofile-arcs", "-ftest-coverage"],
+ CXXFLAGS=["-fprofile-arcs", "-ftest-coverage"],
+ LDFLAGS=["-fprofile-arcs", "-ftest-coverage"],
+ LIBS=['gcov'])
+
if os.getenv("CC") == "clang":
env.Replace(CC="clang",
CXX="clang++")

0 comments on commit 2f7f7d6

Please sign in to comment.
Something went wrong with that request. Please try again.