From 867b9c653302efae1ed38035e5b55c55404c1b1b Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Tue, 12 Jun 2018 15:38:09 -0600 Subject: [PATCH 01/16] fixed cmake flags --- scripts/CodeCoverage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index bff5b8d..403a71c 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -76,7 +76,7 @@ def get_cmake(): return 'cmake' def get_make_arguments(): - default_args = '-DCMAKE_CXX_COMPILER_ARG1:STRING=\'-std=c++14 -Wall -Werror -g -gdwarf-2 -fno-elide-constructors -fprofile-arcs -ftest-coverage -O0 -fPIC -m64 -fno-inline -fno-inline-small-functions -fno-default-inline -I /usr/local/probe/include' + default_args = '-DCMAKE_CXX_COMPILER_ARG1:STRING=\'-std=c++14 -Wall -Werror -g -gdwarf-2 -O0 -fPIC -m64 -isystem/usr/local/gcc/include -isystem/usr/local/probe/include -fprofile-arcs -ftest-coverage' if PROBE_BUILD: default_args += ' -Wl,-rpath -Wl,. -Wl,-rpath -Wl,/usr/local/gcc/lib -Wl,-rpath -Wl,/usr/local/gcc/lib64 ' default_args += '\'' From 6a0dd7a466d4676c6901ffbe0f379c6f08dc50af Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Tue, 19 Jun 2018 09:44:34 -0600 Subject: [PATCH 02/16] fixed script --- scripts/CodeCoverage.py | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index 403a71c..de5ca95 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -115,6 +115,7 @@ def compile_project(): def run_UnitTestRunner(launch_dir): CP_RUNNER_SCRIPT = 'cp ' + launch_dir + '/scripts/unitTestRunner.sh ' + launch_dir + '/build' CP_RUNNER_SCRIPT_CMD = [CP_RUNNER_SCRIPT] + print(CP_RUNNER_SCRIPT_CMD) ret_code = subprocess.check_call(CP_RUNNER_SCRIPT_CMD, stderr=subprocess.STDOUT, shell=True) print "Copy script return code: " + str(ret_code) RUNNER_SCRIPT_CMD = ['sh unitTestRunner.sh'] @@ -156,8 +157,17 @@ def run_gcovr(project_name, whitelist_filter, blacklist_filter): print "ERROR: Gcovr process failed! : \n" + GCOVR_CMD_STR sys.exit(1) -def copy_coverage_files_into_cov_dir(object_dir, launch_dir): - CP_COV_FILES_STR = 'cp ' + launch_dir + '/build/CMakeFiles/' + object_dir + '/src/* ' + launch_dir +'/coverage' +def copy_coverage_files_into_cov_dir(object_dir, launch_dir, rpmbuild_dir): + cov_files = '' + for root, dirs, files in os.walk(rpmbuild_dir): + if 'UnitTestRunner.dir' in root: + continue + for f in files: + if f.endswith('.gcda') or f.endswith('.gcno'): + cov_files += (os.path.join(root, f) + ' ') + + CP_COV_FILES_STR = 'cp -n ' + cov_files + launch_dir + '/coverage' + try: ret_code = subprocess.check_call([CP_COV_FILES_STR], stderr=subprocess.STDOUT, shell=True) print "Copy coverage files into coverage directory return code: " + str(ret_code) @@ -205,13 +215,14 @@ def main(argv): LAUNCH_DIR = os.getcwd() PROJECT = project_name + HOME_DIR = os.path.expanduser('~') + RPMBUILD_DIR = HOME_DIR + '/rpmbuild/BUILD/' + PROJECT OBJ_DIR = PROJECT + '.dir' USER_WHITELIST = None USER_BLACKLIST = None GTEST_ZIP_PATH = LAUNCH_DIR + '/3rdparty/gtest-1.7.0.zip' global PROBE_BUILD global DEFAULT_BLACKLIST - if os.path.exists("/usr/local/probe/bin/cmake"): PROBE_BUILD=True print "Using /usr/local/probe as the default path" @@ -232,19 +243,24 @@ def main(argv): unzip_file(full_file_path=GTEST_ZIP_PATH, directory_to_extract_to="3rdparty") clean_and_build_directory(dir_path="coverage") - clean_and_build_directory(dir_path="build") + #clean_and_build_directory(dir_path="build") - os.chdir(LAUNCH_DIR + '/build') - run_cmake_cmd() - compile_project() - run_UnitTestRunner(launch_dir=LAUNCH_DIR) + #os.chdir(LAUNCH_DIR + '/build') + #run_cmake_cmd() + #compile_project() + #run_UnitTestRunner(launch_dir=LAUNCH_DIR) os.chdir(LAUNCH_DIR + '/coverage') gcovr_whitelist = generate_gcovr_filter(formatted_user_list=format_user_list(user_list=USER_WHITELIST), default_list=DEFAULT_WHITELIST) gcovr_blacklist = generate_gcovr_filter(formatted_user_list=format_user_list(user_list=USER_BLACKLIST), default_list=DEFAULT_BLACKLIST) - copy_coverage_files_into_cov_dir(object_dir=OBJ_DIR, launch_dir=LAUNCH_DIR) + + # ProbeTransmogrifier builds both Probe_Transmogrifier and ProbeTransmogrifier. ProbeTransmogrifier has the code we want to cover, not Probe_Transmnogrifier + if PROJECT == 'Probe_Transmogrifier': + RPMBUILD_DIR = HOME_DIR + '/rpmbuild/BUILD/' + 'ProbeTransmogrifier' + + copy_coverage_files_into_cov_dir(object_dir=OBJ_DIR, launch_dir=LAUNCH_DIR, rpmbuild_dir=RPMBUILD_DIR) run_gcovr(project_name=PROJECT, whitelist_filter=gcovr_whitelist, blacklist_filter=gcovr_blacklist) From 716405f19789883233ce398061916c764f646b26 Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Tue, 26 Jun 2018 09:21:57 -0600 Subject: [PATCH 03/16] final additions to code cov script --- scripts/CodeCoverage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index de5ca95..989257b 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -166,7 +166,7 @@ def copy_coverage_files_into_cov_dir(object_dir, launch_dir, rpmbuild_dir): if f.endswith('.gcda') or f.endswith('.gcno'): cov_files += (os.path.join(root, f) + ' ') - CP_COV_FILES_STR = 'cp -n ' + cov_files + launch_dir + '/coverage' + CP_COV_FILES_STR = 'cp -n ' + cov_files + ' ' + launch_dir + '/coverage' try: ret_code = subprocess.check_call([CP_COV_FILES_STR], stderr=subprocess.STDOUT, shell=True) From 3048b3a450a3f7420d047b27062115be084745cd Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Wed, 27 Jun 2018 00:42:41 -0600 Subject: [PATCH 04/16] removed unnecessary code --- scripts/CodeCoverage.py | 52 ----------------------------------------- 1 file changed, 52 deletions(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index 989257b..df6362e 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -87,51 +87,6 @@ def get_compiler(): return '-DCMAKE_CXX_COMPILER=/usr/local/gcc/bin/g++' return 'g++' -def run_cmake_cmd(): - CMAKE = get_cmake() - DEBUG_FLAG = '-DUSE_LR_DEBUG=ON' - VERSION_FLAG = '-DVERSION=' + str(1) - ARG1_FLAGS = get_make_arguments() - COMPILER_EXE_FLAG = get_compiler() - CMAKELISTS_DIR = '..' - CMAKE_STR = CMAKE + ' ' + DEBUG_FLAG + ' ' + VERSION_FLAG + ' ' + ARG1_FLAGS + ' ' + COMPILER_EXE_FLAG + ' ' + CMAKELISTS_DIR - CMAKE_CMD = [CMAKE_STR] - try: - ret_code = subprocess.check_call(CMAKE_CMD, stderr=subprocess.STDOUT, shell=True) - print "CMake return code: " + str(ret_code) - except: - print "ERROR: CMake command failed!" - sys.exit(1) - -def compile_project(): - COMPILE_CMD = ['make -j8'] - try: - ret_code = subprocess.check_call(COMPILE_CMD, stderr=subprocess.STDOUT, shell=True) - print "Compile return code: " + str(ret_code) - except: - print "ERROR: Compile project failed!" - sys.exit(1) - -def run_UnitTestRunner(launch_dir): - CP_RUNNER_SCRIPT = 'cp ' + launch_dir + '/scripts/unitTestRunner.sh ' + launch_dir + '/build' - CP_RUNNER_SCRIPT_CMD = [CP_RUNNER_SCRIPT] - print(CP_RUNNER_SCRIPT_CMD) - ret_code = subprocess.check_call(CP_RUNNER_SCRIPT_CMD, stderr=subprocess.STDOUT, shell=True) - print "Copy script return code: " + str(ret_code) - RUNNER_SCRIPT_CMD = ['sh unitTestRunner.sh'] - try: - ret_code = subprocess.check_call(RUNNER_SCRIPT_CMD, stderr=subprocess.STDOUT, shell=True) - print "UnitTestRunner process return code: " + str(ret_code) - except: - # The script will not exit here, as some repos have tests that will - # inherently fail during code coverage (FileIO, ProbeTransmogrifier) - print "ERROR: UnitTestRunner process failed!" - -def get_gcovr(): - if PROBE_BUILD: - return '/usr/local/probe/bin/gcovr' - return 'gcovr' - def get_gcov(): if PROBE_BUILD: return '--gcov-executable /usr/local/gcc/bin/gcov' @@ -241,14 +196,7 @@ def main(argv): print "USER_BLACKLIST = " + USER_BLACKLIST unzip_file(full_file_path=GTEST_ZIP_PATH, directory_to_extract_to="3rdparty") - clean_and_build_directory(dir_path="coverage") - #clean_and_build_directory(dir_path="build") - - #os.chdir(LAUNCH_DIR + '/build') - #run_cmake_cmd() - #compile_project() - #run_UnitTestRunner(launch_dir=LAUNCH_DIR) os.chdir(LAUNCH_DIR + '/coverage') gcovr_whitelist = generate_gcovr_filter(formatted_user_list=format_user_list(user_list=USER_WHITELIST), From 063d098ac8840ec0cfecb31f13e9579f6417bebf Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Wed, 27 Jun 2018 10:28:11 -0600 Subject: [PATCH 05/16] added gcovr back --- scripts/CodeCoverage.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index df6362e..a3a7c39 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -92,6 +92,10 @@ def get_gcov(): return '--gcov-executable /usr/local/gcc/bin/gcov' return '--gcov-executable gcov' +def get_gcovr(): + if PROBE_BUILD: + return '/usr/local/probe/bin/gcovr' + return 'gcovr' def run_gcovr(project_name, whitelist_filter, blacklist_filter): GCOVR = get_gcovr() From 580eca13d00f6ebba376626f3224c626062655fb Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Wed, 27 Jun 2018 11:01:43 -0600 Subject: [PATCH 06/16] removed some code --- scripts/CodeCoverage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index a3a7c39..0a6e0f4 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -116,7 +116,7 @@ def run_gcovr(project_name, whitelist_filter, blacklist_filter): print "ERROR: Gcovr process failed! : \n" + GCOVR_CMD_STR sys.exit(1) -def copy_coverage_files_into_cov_dir(object_dir, launch_dir, rpmbuild_dir): +def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir): cov_files = '' for root, dirs, files in os.walk(rpmbuild_dir): if 'UnitTestRunner.dir' in root: @@ -212,7 +212,7 @@ def main(argv): if PROJECT == 'Probe_Transmogrifier': RPMBUILD_DIR = HOME_DIR + '/rpmbuild/BUILD/' + 'ProbeTransmogrifier' - copy_coverage_files_into_cov_dir(object_dir=OBJ_DIR, launch_dir=LAUNCH_DIR, rpmbuild_dir=RPMBUILD_DIR) + copy_coverage_files_into_cov_dir(launch_dir=LAUNCH_DIR, rpmbuild_dir=RPMBUILD_DIR) run_gcovr(project_name=PROJECT, whitelist_filter=gcovr_whitelist, blacklist_filter=gcovr_blacklist) From b968a02bbc243546f97a7c58987668fbb0701606 Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Wed, 27 Jun 2018 11:31:58 -0600 Subject: [PATCH 07/16] 3rd -> third --- scripts/CodeCoverage.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index 0a6e0f4..b1dc9df 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -125,6 +125,7 @@ def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir): if f.endswith('.gcda') or f.endswith('.gcno'): cov_files += (os.path.join(root, f) + ' ') + CP_COV_FILES_STR = 'cp -n ' + cov_files + ' ' + launch_dir + '/coverage' try: @@ -179,7 +180,7 @@ def main(argv): OBJ_DIR = PROJECT + '.dir' USER_WHITELIST = None USER_BLACKLIST = None - GTEST_ZIP_PATH = LAUNCH_DIR + '/3rdparty/gtest-1.7.0.zip' + GTEST_ZIP_PATH = LAUNCH_DIR + '/thirdparty/gtest-1.7.0.zip' global PROBE_BUILD global DEFAULT_BLACKLIST if os.path.exists("/usr/local/probe/bin/cmake"): @@ -199,7 +200,7 @@ def main(argv): USER_BLACKLIST = args.blacklist print "USER_BLACKLIST = " + USER_BLACKLIST - unzip_file(full_file_path=GTEST_ZIP_PATH, directory_to_extract_to="3rdparty") + unzip_file(full_file_path=GTEST_ZIP_PATH, directory_to_extract_to="thirdparty") clean_and_build_directory(dir_path="coverage") os.chdir(LAUNCH_DIR + '/coverage') From 86590edc8069568430d9daa6ff6f55131fe8e15b Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Mon, 2 Jul 2018 11:21:50 -0600 Subject: [PATCH 08/16] address Josh comments --- scripts/CodeCoverage.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index b1dc9df..f2e7a20 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -121,9 +121,9 @@ def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir): for root, dirs, files in os.walk(rpmbuild_dir): if 'UnitTestRunner.dir' in root: continue - for f in files: - if f.endswith('.gcda') or f.endswith('.gcno'): - cov_files += (os.path.join(root, f) + ' ') + for filename in files: + if filename.endswith('.gcda') or filename.endswith('.gcno'): + cov_files += (os.path.join(root, filename) + ' ') CP_COV_FILES_STR = 'cp -n ' + cov_files + ' ' + launch_dir + '/coverage' From c7b5ff5de26c2612b24506bec0195230c3268921 Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Mon, 2 Jul 2018 11:32:04 -0600 Subject: [PATCH 09/16] address Josh comments --- scripts/CodeCoverage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index f2e7a20..c15e0c8 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -209,7 +209,7 @@ def main(argv): gcovr_blacklist = generate_gcovr_filter(formatted_user_list=format_user_list(user_list=USER_BLACKLIST), default_list=DEFAULT_BLACKLIST) - # ProbeTransmogrifier builds both Probe_Transmogrifier and ProbeTransmogrifier. ProbeTransmogrifier has the code we want to cover, not Probe_Transmnogrifier + # ProbeTransmogrifier builds both Probe_Transmogrifier and ProbeTransmogrifier. ProbeTransmogrifier has the code we want to cover, not Probe_Transmogrifier if PROJECT == 'Probe_Transmogrifier': RPMBUILD_DIR = HOME_DIR + '/rpmbuild/BUILD/' + 'ProbeTransmogrifier' From 34e5459f9dad58a957b671477d818de14a6f34c7 Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Mon, 2 Jul 2018 13:08:38 -0600 Subject: [PATCH 10/16] removed some unnecessary functions --- scripts/CodeCoverage.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index c15e0c8..efee6f1 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -69,23 +69,6 @@ def unzip_file(full_file_path, directory_to_extract_to): to_unzip.close() -def get_cmake(): - if PROBE_BUILD: - print "using /usr/local/probe/bin/cmake" - return '/usr/local/probe/bin/cmake' - return 'cmake' - -def get_make_arguments(): - default_args = '-DCMAKE_CXX_COMPILER_ARG1:STRING=\'-std=c++14 -Wall -Werror -g -gdwarf-2 -O0 -fPIC -m64 -isystem/usr/local/gcc/include -isystem/usr/local/probe/include -fprofile-arcs -ftest-coverage' - if PROBE_BUILD: - default_args += ' -Wl,-rpath -Wl,. -Wl,-rpath -Wl,/usr/local/gcc/lib -Wl,-rpath -Wl,/usr/local/gcc/lib64 ' - default_args += '\'' - return default_args - -def get_compiler(): - if PROBE_BUILD: - return '-DCMAKE_CXX_COMPILER=/usr/local/gcc/bin/g++' - return 'g++' def get_gcov(): if PROBE_BUILD: From 9a765f6e93576d2f54927abe5dc74792c5567974 Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Fri, 6 Jul 2018 15:07:15 -0600 Subject: [PATCH 11/16] trying new collection of coverage files --- scripts/CodeCoverage.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index efee6f1..634aae7 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -99,7 +99,7 @@ def run_gcovr(project_name, whitelist_filter, blacklist_filter): print "ERROR: Gcovr process failed! : \n" + GCOVR_CMD_STR sys.exit(1) -def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir): +'''def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir): cov_files = '' for root, dirs, files in os.walk(rpmbuild_dir): if 'UnitTestRunner.dir' in root: @@ -117,6 +117,16 @@ def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir): except: print "ERROR: Copy coverage files into coverage directory failed!" sys.exit(1) +''' + +def copy_coverage_files_into_cov_dir(launch_dir, object_dir): + CP_COV_FILES_STR = 'cp ' + launch_dir + 'CMakeFiles/' + object_dir + '/src/* ' + launch_dir +'/coverage' + try: + ret_code = subprocess.check_call([CP_COV_FILES_STR], stderr=subprocess.STDOUT, shell=True) + print "Copy coverage files into coverage directory return code: " + str(ret_code) + except: + print "ERROR: Copy coverage files into coverage directory failed!" + sys.exit(1) def format_user_list(user_list): formatted_list = None @@ -194,9 +204,11 @@ def main(argv): # ProbeTransmogrifier builds both Probe_Transmogrifier and ProbeTransmogrifier. ProbeTransmogrifier has the code we want to cover, not Probe_Transmogrifier if PROJECT == 'Probe_Transmogrifier': - RPMBUILD_DIR = HOME_DIR + '/rpmbuild/BUILD/' + 'ProbeTransmogrifier' + #RPMBUILD_DIR = HOME_DIR + '/rpmbuild/BUILD/' + 'ProbeTransmogrifier' + OBJ_DIR = "ProbeTransmgrifier.dir" - copy_coverage_files_into_cov_dir(launch_dir=LAUNCH_DIR, rpmbuild_dir=RPMBUILD_DIR) + #copy_coverage_files_into_cov_dir(launch_dir=LAUNCH_DIR, rpmbuild_dir=RPMBUILD_DIR) + copy_coverage_files_into_cov_dir(launch_dir=LAUNCH_DIR, object_dir=OBJ_DIR) run_gcovr(project_name=PROJECT, whitelist_filter=gcovr_whitelist, blacklist_filter=gcovr_blacklist) From 5f5d6f0c1dd5b0fcb4d53fcce0e13bf1ae564e68 Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Mon, 9 Jul 2018 08:33:49 -0600 Subject: [PATCH 12/16] CC only on debug --- scripts/CodeCoverage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index 634aae7..33c4090 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -120,7 +120,7 @@ def run_gcovr(project_name, whitelist_filter, blacklist_filter): ''' def copy_coverage_files_into_cov_dir(launch_dir, object_dir): - CP_COV_FILES_STR = 'cp ' + launch_dir + 'CMakeFiles/' + object_dir + '/src/* ' + launch_dir +'/coverage' + CP_COV_FILES_STR = 'cp ' + launch_dir + '/CMakeFiles/' + object_dir + '/src/* ' + launch_dir +'/coverage' try: ret_code = subprocess.check_call([CP_COV_FILES_STR], stderr=subprocess.STDOUT, shell=True) print "Copy coverage files into coverage directory return code: " + str(ret_code) From 3bb1f6934b69e7ee565e3d5b1e27c74505174cf5 Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Sun, 15 Jul 2018 23:04:36 -0600 Subject: [PATCH 13/16] use my stuff --- scripts/CodeCoverage.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index 33c4090..a1a6ec0 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -99,10 +99,10 @@ def run_gcovr(project_name, whitelist_filter, blacklist_filter): print "ERROR: Gcovr process failed! : \n" + GCOVR_CMD_STR sys.exit(1) -'''def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir): +def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir): cov_files = '' for root, dirs, files in os.walk(rpmbuild_dir): - if 'UnitTestRunner.dir' in root: + if 'UnitTestRunner.dir' in root or 'gtest' in root: continue for filename in files: if filename.endswith('.gcda') or filename.endswith('.gcno'): @@ -127,7 +127,7 @@ def copy_coverage_files_into_cov_dir(launch_dir, object_dir): except: print "ERROR: Copy coverage files into coverage directory failed!" sys.exit(1) - +''' def format_user_list(user_list): formatted_list = None if user_list is not None: From db35eed6a046c990ba0111e19cbaa1e164a27917 Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Sun, 15 Jul 2018 23:43:07 -0600 Subject: [PATCH 14/16] use my stuff --- scripts/CodeCoverage.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index a1a6ec0..9f63dd8 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -119,8 +119,8 @@ def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir): sys.exit(1) ''' -def copy_coverage_files_into_cov_dir(launch_dir, object_dir): - CP_COV_FILES_STR = 'cp ' + launch_dir + '/CMakeFiles/' + object_dir + '/src/* ' + launch_dir +'/coverage' +def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir): + CP_COV_FILES_STR = 'cp ' + launch_dir + '/CMakeFiles/' + rpmbuild_dir + '/src/* ' + launch_dir +'/coverage' try: ret_code = subprocess.check_call([CP_COV_FILES_STR], stderr=subprocess.STDOUT, shell=True) print "Copy coverage files into coverage directory return code: " + str(ret_code) @@ -208,7 +208,7 @@ def main(argv): OBJ_DIR = "ProbeTransmgrifier.dir" #copy_coverage_files_into_cov_dir(launch_dir=LAUNCH_DIR, rpmbuild_dir=RPMBUILD_DIR) - copy_coverage_files_into_cov_dir(launch_dir=LAUNCH_DIR, object_dir=OBJ_DIR) + copy_coverage_files_into_cov_dir(launch_dir=LAUNCH_DIR, rpmbuild_dir=RPMBUILD_DIR) run_gcovr(project_name=PROJECT, whitelist_filter=gcovr_whitelist, blacklist_filter=gcovr_blacklist) From 89231f4de03bcaf6165621a126eaf2a2774598ba Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Mon, 16 Jul 2018 08:25:47 -0600 Subject: [PATCH 15/16] use my stuff --- scripts/CodeCoverage.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index 9f63dd8..d2f588e 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -170,7 +170,6 @@ def main(argv): PROJECT = project_name HOME_DIR = os.path.expanduser('~') RPMBUILD_DIR = HOME_DIR + '/rpmbuild/BUILD/' + PROJECT - OBJ_DIR = PROJECT + '.dir' USER_WHITELIST = None USER_BLACKLIST = None GTEST_ZIP_PATH = LAUNCH_DIR + '/thirdparty/gtest-1.7.0.zip' @@ -204,10 +203,8 @@ def main(argv): # ProbeTransmogrifier builds both Probe_Transmogrifier and ProbeTransmogrifier. ProbeTransmogrifier has the code we want to cover, not Probe_Transmogrifier if PROJECT == 'Probe_Transmogrifier': - #RPMBUILD_DIR = HOME_DIR + '/rpmbuild/BUILD/' + 'ProbeTransmogrifier' - OBJ_DIR = "ProbeTransmgrifier.dir" + RPMBUILD_DIR = HOME_DIR + '/rpmbuild/BUILD/' + 'ProbeTransmogrifier' - #copy_coverage_files_into_cov_dir(launch_dir=LAUNCH_DIR, rpmbuild_dir=RPMBUILD_DIR) copy_coverage_files_into_cov_dir(launch_dir=LAUNCH_DIR, rpmbuild_dir=RPMBUILD_DIR) run_gcovr(project_name=PROJECT, whitelist_filter=gcovr_whitelist, From e38ed8f998237a25f886614736684d13073a2287 Mon Sep 17 00:00:00 2001 From: DylanSchneider Date: Tue, 24 Jul 2018 08:54:35 -0600 Subject: [PATCH 16/16] removed debug comments and prints --- scripts/CodeCoverage.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/scripts/CodeCoverage.py b/scripts/CodeCoverage.py index d2f588e..14d4311 100755 --- a/scripts/CodeCoverage.py +++ b/scripts/CodeCoverage.py @@ -117,17 +117,7 @@ def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir): except: print "ERROR: Copy coverage files into coverage directory failed!" sys.exit(1) -''' -def copy_coverage_files_into_cov_dir(launch_dir, rpmbuild_dir): - CP_COV_FILES_STR = 'cp ' + launch_dir + '/CMakeFiles/' + rpmbuild_dir + '/src/* ' + launch_dir +'/coverage' - try: - ret_code = subprocess.check_call([CP_COV_FILES_STR], stderr=subprocess.STDOUT, shell=True) - print "Copy coverage files into coverage directory return code: " + str(ret_code) - except: - print "ERROR: Copy coverage files into coverage directory failed!" - sys.exit(1) -''' def format_user_list(user_list): formatted_list = None if user_list is not None: