As participant of the ESA Summer of Code in Space 2015 I work for RTEMS. This blog keeps you up to date about the work on coverage analysis of RTEMS.

2015-07-08

Build RTEMS and execute coverage analysis for a LEON2 CPU


Here I describe the instructions on how to build RTEMS for a Leon2 CPU, how to build the required RTEMS tools to run test cases and a coverage analysis on RTEMS for these tests, and how to build the Couverture-QEMU emulator which is required to obtain the coverage results. 

Most of the instructions were already explained in the former blog post describing the instructions for a PC386 CPU. In this post are only the instructions listed, which differ to the instructions for a PC386 CPU where the numbers of the instructions are equivalent.

6. Change to the rtems directory (given that you are still in rtems-source-builder directory) and build a toolset for the SPARC architecture: 

cd rtems
../source-builder/sb-set-builder --log=l-sparc.txt --prefix=$HOME/development/rtems/4.11 4.11/rtems-sparc

10. Change to a directory in which you create a new directory that contains the built binaries of rtems for a Leon2 CPU:

cd ~/development/rtems mkdir b-leon2
(b- for build)

11. Change to the directory which you created for the binaries of rtems for a Leon2 CPU and run configure and make:

cd b-leon2
../src/rtems/configure --target=sparc-rtems4.11 --enable-rtemsbsp=leon2 --enable-tests=yes --disable-posix
make
sudo PATH=/opt/rtems/4.11/bin:${PATH} make install

15. Configure and make Couverture-QEMU for emulation of a sparc architecture (requires additional binaries, run to install: sudo apt-get install pkg-config libglib2.0-dev): 

./configure --prefix=$HOME/qemu/install --target-list=sparc-softmmu --disable-virtfs --disable-werror --disable-docs
make
make install
(could require to install: sudo apt-get install pkg-config libglib2.0-dev)

24. In file symbolSets.config ensure that the path to the static libraries which are analyzed is correct; the path has to look like:

$HOME/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/score/libscore.a

26. Execute rtems-test (enable coverage reports by --coverage):

$HOME/development/rtems/src/rtems-tools/tester/rtems-test --rtems-bsp=leon2 --coverage --log=log-leon2.log --rtems-tools=$HOME/development/rtems/4.11 $HOME/development/rtems/b-leon2/testsuites/

2015-07-01

Build RTEMS and execute coverage analysis for a PC386 CPU


Here I describe the instructions on how to build RTEMS for a PC386 CPU, how to build the required RTEMS tools to run test cases and a coverage analysis on RTEMS for these tests, and how to build the Couverture-QEMU emulator which is required to obtain the coverage results.

1. To get the source code from the different git repositories, an installation of git is required:


sudo apt-get install git

2. Create a directory that contains the cloned RTEMS, RTEMS-TOOLS, and the RTEMS Source Builder repositories when you are finished, and change to this directory:

mkdir development/rtems/src
cd development/rtems/src

3. Clone the RTEMS Source Builder repository. RTEMS Source Builder is a tool to aid building packages from source used by the RTEMS project: 


4. Change to the RTEMS Source Builder directory and run the source builder check to analyze whether all required tools are on your system:

cd rtems-source-builder
source-builder/sb-check

The possible errors, which are shown after running the check are:

RTEMS Source Builder - Check, v0.5.0
error: exe: not found: (__bison) /usr/bin/bison
error: exe: not found: (__cc) /usr/bin/gcc
error: exe: not found: (__cvs) /usr/bin/cvs
error: exe: not found: (__cxx) /usr/bin/g++
error: exe: not found: (__flex) /usr/bin/flex
error: exe: not found: (__makeinfo) /usr/bin/makeinfo
Environment is not correctly set up

5. To correct errors by installing all required external binaries run:


sudo apt-get install bison gcc cvs g++ flex texinfo zlib1g-dev libncurses5-dev python2.7-dev dos2unix

After rerunning the source builder check again you should see the following output:

RTEMS Source Builder - Check, v0.5.0
Environment is ok

6. Change to the rtems directory (given that you are still in rtems-source-builder directory) and build a toolset for the i386 architecture:

cd rtems
../source-builder/sb-set-builder --log=l-i386.txt --prefix=$HOME/development/rtems/4.11 4.11/rtems-i386

7. Add the path to the built toolset to the environment variable:

export PATH=~/development/rtems/4.11/bin:$PATH

8. Change to the directory that we initially created to contain the cloned repositories and clone the RTEMS repository:

cd ~/development/rtems/src
git clone git://git.rtems.org/rtems.git

9. Change to the new RTEMS directory bootstrap the sources (requires dh-autoreconf, if not installed run: apt-get install dh-autoreconf):

cd rtems
./bootstrap
(requires dh-autoreconf, run: apt-get install dh-autoreconf)

10. Change to a directory in which you create a new directory that contains the built binaries of rtems for a PC386 CPU:

cd ~/development/rtems
mkdir b-pc386
(b- for build)
11. Change to the directory which you created for the binaries of rtems for a PC386 CPU and run configure and make:

cd b-pc386
../src/rtems/configure --target=i386-rtems4.11 --enable-rtemsbsp=pc386 --enable-tests=yes --disable-posix
make
sudo PATH=/opt/rtems/4.11/bin:${PATH} make install

12. Add the path to the installed binaries to the environment variable:

export PATH=/opt/rtems/4.11/bin:$PATH

13. Change to a directory into which you clone the Couverture-QEMU repository:


14. Download and apply a necessary patch for Couverture-QEMU from https://devel.rtems.org/attachment/wiki/SOCIS/2015/CoverageAnalysis/couverture-qemu_patch.diff. Otherwise the build process fails:

git apply couverture-qemu_patch.diff

15. Configure and make Couverture-QEMU for emulation of an i386 architecture (requires additional binaries, run to install: sudo apt-get install pkg-config libglib2.0-dev): 

./configure --prefix=$HOME/qemu/install --target-list=i386-softmmu --disable-virtfs --disable-werror --disable-docs
make
make install
(could require to install: sudo apt-get install pkg-config libglib2.0-dev)

16. Add the path to the installed binaries of Couverture-QEMU to the environment variable:

export PATH=~/qemu/install/bin:$PATH

17. & 18. For these instructions we provide two different versions which are first 17.a and 18.a, and second 17.b and 18.b

17.a Change to the directory that we initially created to contain the cloned repositories and clone the RTEMS-TOOLS repository:

cd development/rtems/src
git clone git://git.rtems.org/rtems-tools.git

18.a Change to the new RTEMS-TOOLS directory, download a patch from https://devel.rtems.org/attachment/wiki/SOCIS/2015/CoverageAnalysis/0001-Create_coverage_report_incl_debug_output_for_byte_size_diff.patch and apply this patch:

cd rtems-tools
git apply --reject 0001-Create_coverage_report_incl_debug_output_for_byte_size_diff.patch

17.b & 18.b This instruction combines the instructions 17.a and 18.a by cloning a different RTEMS-TOOLS repository, which already contains the additional sources that are required to produce coverage reports. Therefore this instruction does not require to apply the patch as in instruction 18.a.

cd development/rtems/src
git clone https://github.com/hermann19829/rtems-tools.git
cd rtems-tools

19. Build the RTEMS tools as explained in rtems-tools/README

./waf configure --prefix=$HOME/development/rtems/4.11
./waf build install

20. Clone the RTEMS linker repository, which is used to create dynamically loadable applications:

git clone git://git.rtems.org/chrisj/rtl-host.git

21. Build the linker:

cd rtl-host
../waf configure build
cd ..

22. Build covoar:

cd tester/covoar
../../waf configure build

23. Change to the directory which contains the configuration files for the coverage report generator:

cd ../rtems/testing/coverage

24. In file symbolSets.config ensure that the path to the static libraries which are analyzed is correct; the path has to look like:

$HOME/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/score/libscore.a

25. Create directory which contains the coverage results:

cd ~
mkdir coverage-tests
cd coverage-tests

26. Execute rtems-test (enable coverage reports by --coverage):

$HOME/development/rtems/src/rtems-tools/tester/rtems-test --rtems-bsp=pc386 --coverage --log=log-pc386.log --rtems-tools=$HOME/development/rtems/4.11 $HOME/development/rtems/b-pc386/testsuites/

2015-05-29

Project Goal

The goal of this project is to improve the reporting of structural coverage analysis on testing RTEMS. The existing coverage analysis implementation supports statement and branch coverage. Mainly the tool for generating reports of this coverage analysis implementation is updated. The detailed coverage analyisis reports are generated providing hints to uncovered code fragments depending on the used coverage metrics.