Source
747
747
as separate modules. These allow the GUIs to be loaded and used.
748
748
749
749
Some of the GUI tools available as part of CASA 5 are only available in the packaged tar-file based
750
750
distribution of CASA 6. The GUIs that are currently only available in the monolithic version of
751
751
CASA 6 currently includes:
752
752
753
753
1. casabrowser
754
754
2. casafeather
755
755
3. casalogger
756
756
4. casaplotserver
757
+
758
+
## Code coverage
759
+
760
+
It is possible to build CASA with coverage instrumentation enabled as part of the build, and then measure the line coverage of tests across the python binding. This procedure has been implemented as a [bamboo job](https://open-bamboo.nrao.edu/browse/CASASPECS-CMAKECOV) following CAS-14220. Here is a description of the steps required to reproduce this in a local developer build.
761
+
762
+
### Changes to casacpp cmake command
763
+
764
+
In order to enable [gcov](https://gcc.gnu.org/onlinedocs/gcc/Gcov-Intro.html) in builds, it is required to add the special option `--coverage` to gcc. The options `-shared` and `-fPIC` are also used. In addition, linking to the `gcov` library should be done. These steps can be accomplished by adding the following statements to casatools/src/code/CMakeLists.txt:
765
+
```
766
+
add_compile_options(-shared -fPIC --coverage)
767
+
link_libraries(gcov)
768
+
```
769
+
It is important to note that these options will only yield useful results if the build type is set to Debug, which turns off optimizations and lets the line-by-line coverage be calculated accurately. This can be accomplished by adding the following argument to the casacpp cmake call at $build_root/casa6/casatools/src/code:
770
+
```
771
+
-DCMAKE_BUILD_TYPE=Debug
772
+
```
773
+
These changes are exposed in the automated build scripts (of the casa-build-utils repository) via the use of a keyword `-DUSE_GCOV=ON`. This method of adding coverage instrumentation to casacpp has also been tested following the makefile build process.
774
+
775
+
### Generating reports:
776
+
777
+
In order to verify that coverage was succesfully enabled for a casa build, it can be helpful to verify that the build indeed produced the expected note files which are used to generate reports of the measurement (read more [here](https://gcc.gnu.org/onlinedocs/gcc/Gcov-Data-Files.html)). The presence of these files can be detected using shell commands such as:
778
+
```
779
+
find /my/build/directory/ -name "*.gcno" -printf "%T+ %p\n"
780
+
find /my/build/directory/ -name "*.gcda" -printf "%T+ %p\n"
781
+
```
782
+
The process of coverage measurement followed by the automated bamboo plan is first zero the counters using lcov and its related binaries, then run rests, then generate an HTML report. If trying to do this in a local build, make sure that [https://github.com/linux-test-project/lcov/releases/download/v1.16/lcov-1.16.tar.gz](lcov) has been downloaded, uncompressed, and its executables put somewhere on the PATH, like this:
783
+
```
784
+
cd /tmp
785
+
curl -L -O https://github.com/linux-test-project/lcov/releases/download/v1.16/lcov-1.16.tar.gz
786
+
tar -xzvf lcov-1.16.tar.gz
787
+
cp lcov-1.16/bin/lcov lcov-1.16/bin/gen* /home/casatest/bin/
788
+
export PATH=$PATH:/home/casatest/bin/
789
+
```
790
+
It is now possible to zero out the coverage note files, run tests, and generate an HTML report that includes the changes:
791
+
```
792
+
# zero out the note files
793
+
lcov --directory ./build --zerocounters
794
+
795
+
# run C++ unit tests, which will induce a change in the coverage note files
796
+
cd /source/casa6/casatools/src/code/build && ctest -T test --output-on-failure
797
+
798
+
# run all the python task tests, which will induce a change in the coverage note files even across the python binding!
799
+
pytest /source/casa6/casatasks/tests/tasks/
800
+
801
+
# generate a coverage report from the linked gcno+gcda files
802
+
lcov --directory ./build --capture --output-file casacpp_coverage.info --ignore-errors gcov,source,graph
803
+
genhtml casacpp_coverage.info -o casacpp_coverage.htmlreport --ignore-errors source
804
+
```
805
+
The output of this process (casacpp_coverage.htmlreport) is static HTML which can be loaded into a web browser and examined. Repeating this process after another build will yield a different report that, when compared against the previous one, can demonstrate a measurement of the change in source coverage by addition of tests.