diff --git a/runCFSscript.sh b/runCFSscript.sh index b3ad7a354..68fc23783 100755 --- a/runCFSscript.sh +++ b/runCFSscript.sh @@ -1,6 +1,6 @@ #!/bin/bash -cfs_apps=( apps/sch_lab apps/ci_lab apps/to_lab apps/sample_app tools/cFS-GroundSystem tools/elf2cfetbl tools/tblCRCTool apps/cf apps/cs apps/ds apps/fm apps/hk apps/hs apps/lc apps/md apps/mm apps/sc cfe ) +cfs_apps=( apps/sch_lab apps/ci_lab apps/to_lab apps/sample_app tools/cFS-GroundSystem tools/elf2cfetbl tools/tblCRCTool apps/cf apps/cs apps/ds apps/fm apps/hk apps/hs apps/lc apps/md apps/mm apps/sc cfe psp ) scriptNums=( 1 2 3 4 5 6 7 8 ) # Process each element to get the substring after the last '/' diff --git a/scripts/lcov.sh b/scripts/lcov.sh index 8d24fc774..1c7b3e1eb 100755 --- a/scripts/lcov.sh +++ b/scripts/lcov.sh @@ -4,9 +4,12 @@ #assumes these are all in the cFS/apps directory #and that they're all in lowercase app=$1 +applist="cf cs ds fm hk hs lc md mm sc" +results_dir="${app}_lcov_results/" # start fresh make distclean +rm -rf ${results_dir} rm -rf sample_defs rm Makefile @@ -18,11 +21,16 @@ APP_UPPER=$(echo $app | sed 's/[a-z]/\U&/g') cp ./cfe/cmake/Makefile.sample Makefile cp -r ./cfe/cmake/sample_defs sample_defs -# add repo to build -app_list_line=$(cat sample_defs/targets.cmake | grep -o "list(APPEND MISSION_GLOBAL_APPLIST.*") -if [[ ${app_list_line} != *"$APP_LOWER"* ]];then - prev_app="sample_lib" - sed -i "s/$prev_app/& $APP_LOWER/" "sample_defs/targets.cmake"; +if [[ " $applist " =~ " $app " ]]; then + # add repo to build + app_list_line=$(cat sample_defs/targets.cmake | grep -o "list(APPEND MISSION_GLOBAL_APPLIST.*") + if [[ ${app_list_line} != *"$APP_LOWER"* ]];then + prev_app="sample_lib" + sed -i "s/$prev_app/& $APP_LOWER/" "sample_defs/targets.cmake"; + fi + app_dir="apps/" +elif [ ${app} = "psp" ]; then + app_dir="" fi # make prep @@ -32,15 +40,16 @@ make SIMULATION=native ENABLE_UNIT_TESTS=true OMIT_DEPRECATED=true prep make -C build/tools/elf2cfetbl # build app target -make -C build/native/default_cpu1/apps/$APP_LOWER +make -C build/native/default_cpu1/$app_dir$APP_LOWER + +# store all result files +mkdir -p ${results_dir} # capture initial lcov and run test -lcov --capture --initial --directory build --output-file "${app}_coverage_base.info" -(cd build/native/default_cpu1/apps/$APP_LOWER; ctest --verbose) | tee "${app}_test_results.txt" +lcov --capture --initial --directory build --output-file "${results_dir}${app}_coverage_base.info" +(cd build/native/default_cpu1/$app_dir$APP_LOWER; ctest --verbose) | tee "${results_dir}${app}_test_results.txt" # calculate coveage -lcov --capture --rc lcov_branch_coverage=1 --directory build --output-file "${app}_coverage_test.info" -lcov --rc lcov_branch_coverage=1 --add-tracefile "${app}_coverage_base.info" --add-tracefile "${app}_coverage_test.info" --output-file "${app}_coverage_total.info" -genhtml "${app}_coverage_total.info" --branch-coverage --output-directory "${app}_lcov" | tee "${app}_lcov_out.txt" - - +lcov --capture --rc lcov_branch_coverage=1 --directory build --output-file "${results_dir}${app}_coverage_test.info" +lcov --rc lcov_branch_coverage=1 --add-tracefile "${results_dir}${app}_coverage_base.info" --add-tracefile "${results_dir}${app}_coverage_test.info" --output-file "${results_dir}${app}_coverage_total.info" +genhtml "${results_dir}${app}_coverage_total.info" --branch-coverage --output-directory "${results_dir}${app}_lcov" | tee "${results_dir}${app}_lcov_out.txt"