From c1c03fdc573b56f10ca6acda5f9231f9a55c7e06 Mon Sep 17 00:00:00 2001 From: Chris Timperley Date: Thu, 14 Mar 2019 11:52:10 -0400 Subject: [PATCH] Fixed coverage instrumentation (fixes #283) (#327) * use C90 comments * updated CHANGELOG.md * bug fix: allow coverage instrumentation for C programs * release v2.1.16 --- CHANGELOG.md | 4 +++- bugzoo/mgr/coverage/gcov.py | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ef0012f5..5fcc3d45b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/bugzoo/mgr/coverage/gcov.py b/bugzoo/mgr/coverage/gcov.py index f7296743f..7d0ca1bbe 100644 --- a/bugzoo/mgr/coverage/gcov.py +++ b/bugzoo/mgr/coverage/gcov.py @@ -16,11 +16,15 @@ logger.setLevel(logging.DEBUG) INSTRUMENTATION = ( - "// BUGZOO :: INSTRUMENTATION :: START\n" + "/* BUGZOO :: INSTRUMENTATION :: START */\n" "#include \n" "#include \n" "#include \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" @@ -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" )