Skip to content

Commit

Permalink
Fixed coverage instrumentation (fixes #283) (#327)
Browse files Browse the repository at this point in the history
* use C90 comments

* updated CHANGELOG.md

* bug fix: allow coverage instrumentation for C programs

* release v2.1.16
  • Loading branch information
ChrisTimperley authored Mar 14, 2019
1 parent f5074b8 commit c1c03fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
## 2.1.26 (XXXX-XX-XX)
## 2.1.26 (2019-03-14)

### Bug Fixes

* Fixed a hardcoded log directory in BugZoo CLI.
* Updated coverage instrumentation to use C90-compatible comments.
* Update coverage instrumentation to support C.


## 2.1.25 (2019-02-09)
Expand Down
12 changes: 8 additions & 4 deletions bugzoo/mgr/coverage/gcov.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@
logger.setLevel(logging.DEBUG)

INSTRUMENTATION = (
"// BUGZOO :: INSTRUMENTATION :: START\n"
"/* BUGZOO :: INSTRUMENTATION :: START */\n"
"#include <stdio.h>\n"
"#include <stdlib.h>\n"
"#include <signal.h>\n"
"extern \"C\" void __gcov_flush(void);\n"
"#ifdef __cplusplus\n"
" extern \"C\" void __gcov_flush(void);\n"
"#else\n"
" void __gcov_flush(void);\n"
"#endif\n"
"void bugzoo_sighandler(int sig){\n"
" __gcov_flush();\n"
" if(sig != SIGUSR1 && sig != SIGUSR2)\n"
Expand All @@ -40,11 +44,11 @@
" sigaction(SIGBUS, &new_action, NULL);\n"
" sigaction(SIGILL, &new_action, NULL);\n"
" sigaction(SIGABRT, &new_action, NULL);\n"
" // Use signal for SIGUSR to remove handlers\n"
" /* Use signal for SIGUSR to remove handlers */\n"
" signal(SIGUSR1, bugzoo_sighandler);\n"
" signal(SIGUSR2, bugzoo_sighandler);\n"
"}\n"
"// BUGZOO :: INSTRUMENTATION :: END\n"
"/* BUGZOO :: INSTRUMENTATION :: END */\n"
)


Expand Down

0 comments on commit c1c03fd

Please sign in to comment.