[PATCH] Adaptions for coverage report generator

Hermann Felbinger hermann19829 at gmail.com
Sun Nov 8 21:17:18 UTC 2015


This patch adapts the coverage report generator patch from ticket
https://devel.rtems.org/ticket/2261 by capabilities to create coverage
reports for pc386 and leon2.

---
>From 2fb861b68652e98e9257ff81b6bb953ad3235552 Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Tue, 9 Jun 2015 19:24:08 +0200
Subject: [PATCH 01/18] initial commit

---
 rtemstoolkit/wscript                            |  2 +-
 tester/rtems/testing/coverage/symbolSets.config | 80
++++++++++++-------------
 2 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/rtemstoolkit/wscript b/rtemstoolkit/wscript
index 229deeb..955d491 100644
--- a/rtemstoolkit/wscript
+++ b/rtemstoolkit/wscript
@@ -93,7 +93,7 @@ def build(bld):
               install_path = None,
               source = rld_source + rtems_utils + compression,
               defines = ['HAVE_CONFIG_H=1',
-                         'RTEMS_VERSION=' + bld.env.RTEMS_VERSION,
+                         'RTEMS_VERSION=' + str(bld.env.RTEMS_VERSION),
                          'FASTLZ_LEVEL=1'],
               includes = ['.'] + conf['includes'],
               cflags = conf['cflags'] + conf['warningflags'],
diff --git a/tester/rtems/testing/coverage/symbolSets.config
b/tester/rtems/testing/coverage/symbolSets.config
index 6390dcf..99246c4 100644
--- a/tester/rtems/testing/coverage/symbolSets.config
+++ b/tester/rtems/testing/coverage/symbolSets.config
@@ -1,60 +1,60 @@
 symbolset:
  name=core
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/score/libscore.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/sapi/libsapi.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/librtems.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/score/libscore.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/sapi/libsapi.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/librtems.a
 symbolset:
  name=developmental
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/score/libscore.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/sapi/libsapi.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/librtems.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/librfs.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdosfs.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdevfs.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libimfs.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libcsupport/libcsupport.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstackchk.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libbspcmdline.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libcpuuse.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstringto.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdevnull.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdumpbuf.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libblock/libblock.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/score/libscore.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/sapi/libsapi.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/librtems.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/librfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdosfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdevfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libimfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libcsupport/libcsupport.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstackchk.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libbspcmdline.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libcpuuse.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstringto.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdevnull.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdumpbuf.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libblock/libblock.a
 symbolset:
  name=score
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/score/libscore.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/score/libscore.a
 symbolset:
  name=sapi
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/sapi/libsapi.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/sapi/libsapi.a
 symbolset:
  name=rtems
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/librtems.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/librtems.a
 symbolset:
  name=filesystems
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdevfs.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdosfs.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libimfs.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/librfs.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libjffs2.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdefaultfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdevfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdosfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libimfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/librfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libjffs2.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdefaultfs.a
 symbolset:
  name=libmisc
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstackchk.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libbspcmdline.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libcpuuse.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstringto.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdevnull.a
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdumpbuf.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstackchk.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libbspcmdline.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libcpuuse.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstringto.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdevnull.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdumpbuf.a
 symbolset:
  name=libcsupport
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libcsupport/libcsupport.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libcsupport/libcsupport.a
 symbolset:
  name=libblock
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/libblock/libblock.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libblock/libblock.a
 symbolset:
  name=posix
-
lib=/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/cpukit/posix/libposix.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/posix/libposix.a
-- 
1.9.1


>From 2cbe541900b04b1ff9d3e8240639106b0f0724b7 Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Wed, 10 Jun 2015 21:02:52 +0200
Subject: [PATCH 02/18] since coverage.run() (coverage.py) is called in
test.py
 the hardcoded paths in the coverage are commented out

---
 tester/rt/coverage.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index e458241..4601e27 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -363,7 +363,7 @@ def output_handler(text):
     log.notice(text, stdout_only = False)

 if __name__ == "__main__":
-    c =
coverage_run("/home/krzysztof/coverage/kmtest","/home/krzysztof/development/rtems/src/rtems-tools/tester")
-    c.prepareEnvironment()
-    c.executables =
["/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/testsuites/samples/hello/hello.exe"]
-    c.run()
+#    c =
coverage_run("/home/krzysztof/coverage/kmtest","/home/krzysztof/development/rtems/src/rtems-tools/tester")
+#    c.prepareEnvironment()
+#    c.executables =
["/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/testsuites/samples/hello/hello.exe"]
+#    c.run()
-- 
1.9.1


>From 4c82203c9310ee5bb0a05ec6a9b991b2581621ce Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Wed, 10 Jun 2015 23:18:19 +0200
Subject: [PATCH 03/18] created macro file to create coverage report by
running
 leon2 on qemu

---
 tester/rt/coverage.py                       |  1 +
 tester/rtems/testing/bsps/leon2-coverage.mc | 64
+++++++++++++++++++++++++++++
 tester/rtems/testing/bsps/pc386.mc          | 22 +++++-----
 3 files changed, 76 insertions(+), 11 deletions(-)
 create mode 100644 tester/rtems/testing/bsps/leon2-coverage.mc

diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index 4601e27..4745a16 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -363,6 +363,7 @@ def output_handler(text):
     log.notice(text, stdout_only = False)

 if __name__ == "__main__":
+    print "coverage main"
 #    c =
coverage_run("/home/krzysztof/coverage/kmtest","/home/krzysztof/development/rtems/src/rtems-tools/tester")
 #    c.prepareEnvironment()
 #    c.executables =
["/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/testsuites/samples/hello/hello.exe"]
diff --git a/tester/rtems/testing/bsps/leon2-coverage.mc
b/tester/rtems/testing/bsps/leon2-coverage.mc
new file mode 100644
index 0000000..1c7453c
--- /dev/null
+++ b/tester/rtems/testing/bsps/leon2-coverage.mc
@@ -0,0 +1,64 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2010-2014 Chris Johns (chrisj at rtems.org)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# All paths in defaults must be Unix format. Do not store any Windows
format
+# paths in the defaults.
+#
+# Every entry must describe the type of checking a host must pass.
+#
+# Records:
+#  key: type, attribute, value
+#   type     : none, dir, exe, triplet
+#   attribute: none, required, optional
+#   value    : 'single line', '''multi line'''
+#
+
+#
+# The sparc/leon2 QEMU BSP
+#
+
+[global]
+bsp:                      none,    none,     'leon2'
+coverage_supported:      none,   none,   '1'
+
+[leon2]
+leon2:                    none,    none,     '%{_rtscripts}/qemu.cfg'
+leon2_arch:               none,    none,     'sparc'
+leon2_opts:               none,    none,     '-nographic -M at697 -append
"--console=com1;boot;"'
+
+[coverage]
+format:                none,    none,     'QEMU'
+target:                none,    none,     'sparc-rtems4.11'
+explanations:            none,    none,
'%{_rtscripts}/coverage/Explanations.txt'
+coverageExtension:      none,    none,     'exe.cov'
+gcnosFile:              none,    none,
'%{_rtscripts}/coverage/rtems.gcnos'
+executableExtension:    none,    none,     'exe'
+projectName:            none,    none,     'RTEMS 4.11'
diff --git a/tester/rtems/testing/bsps/pc386.mc b/tester/rtems/testing/bsps/
pc386.mc
index 9418c00..52ed275 100644
--- a/tester/rtems/testing/bsps/pc386.mc
+++ b/tester/rtems/testing/bsps/pc386.mc
@@ -49,18 +49,18 @@ hda: none, dir, '%{_rtscripts}/coverage/rtems-boot.img'

 [global]
 bsp:                      none,    none,     'pc386'
-coverage_supported:  none,   none, '1'
+coverage_supported:      none,   none,   '1'

 [pc386]
-pc386:      none,    none,  '%{_rtscripts}/qemu.cfg'
-pc386_arch: none,    none,  'i386'
-pc386_opts: none,    none,  '-m 128 -boot b -hda %{hda} %{qemu_opts_base}
-append "--console=com1;boot;"'
+pc386:                    none,    none,     '%{_rtscripts}/qemu.cfg'
+pc386_arch:               none,    none,     'i386'
+pc386_opts:               none,    none,     '-m 128 -boot b -hda %{hda}
%{qemu_opts_base} -append "--console=com1;boot;"'

 [coverage]
-format: none, none, 'QEMU'
-target: none, none, 'i386-rtems4.11'
-explanations: none, none, '%{_rtscripts}/coverage/Explanations.txt'
-coverageExtension: none, none, 'exe.cov'
-gcnosFile: none, none, '%{_rtscripts}/coverage/rtems.gcnos'
-executableExtension: none, none, 'exe'
-projectName: none, none, 'RTEMS 4.11'
+format:                none,    none,     'QEMU'
+target:                none,    none,     'i386-rtems4.11'
+explanations:            none,    none,
'%{_rtscripts}/coverage/Explanations.txt'
+coverageExtension:      none,    none,     'exe.cov'
+gcnosFile:              none,    none,
'%{_rtscripts}/coverage/rtems.gcnos'
+executableExtension:    none,    none,     'exe'
+projectName:            none,    none,     'RTEMS 4.11'
-- 
1.9.1


>From 2538a9072d622cf3837ce02a06ec52209add615c Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Thu, 11 Jun 2015 22:41:32 +0200
Subject: [PATCH 04/18] added some error handling if test execution does not
 cover any branch

---
 tester/rt/coverage.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index 4745a16..0255dab 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -44,13 +44,18 @@ class summary:
         self.branches_alwaysTaken =
self._getValueFromNextLineWithoutColon(summaryFile)
         self.branches_neverTaken =
self._getValueFromNextLineWithoutColon(summaryFile)
         summaryFile.close()
-
-        self.percentage_branchesCovered = 1 -
float(self.branches_uncovered) / float(self.branches_total)
+        if not self.branches_uncovered == '' and not self.branches_total
== '':
+            self.percentage_branchesCovered = 1 -
float(self.branches_uncovered) / float(self.branches_total)
+        else:
+            self.percentage_branchesCovered = 0.0
         return

     def _getValueFromNextLineWithColon(self, summaryFile):
         line = summaryFile.readline()
-        return line.split(':')[1].strip()
+        if ':' in line:
+            return line.split(':')[1].strip()
+        else:
+            return ''

     def _getValueFromNextLineWithoutColon(self, summaryFile):
         line = summaryFile.readline()
-- 
1.9.1


>From 6788a341c0071865341c8bbc9fb053b3f9b33456 Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Thu, 11 Jun 2015 22:57:56 +0200
Subject: [PATCH 05/18] added configuration macro file to use coverage
 reporting for leon3

---
 tester/rtems/testing/bsps/leon2-coverage.mc |  2 +-
 tester/rtems/testing/bsps/leon3-coverage.mc | 64
+++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 tester/rtems/testing/bsps/leon3-coverage.mc

diff --git a/tester/rtems/testing/bsps/leon2-coverage.mc
b/tester/rtems/testing/bsps/leon2-coverage.mc
index 1c7453c..ae004e9 100644
--- a/tester/rtems/testing/bsps/leon2-coverage.mc
+++ b/tester/rtems/testing/bsps/leon2-coverage.mc
@@ -52,7 +52,7 @@ coverage_supported:      none,   none,   '1'
 [leon2]
 leon2:                    none,    none,     '%{_rtscripts}/qemu.cfg'
 leon2_arch:               none,    none,     'sparc'
-leon2_opts:               none,    none,     '-nographic -M at697 -append
"--console=com1;boot;"'
+leon2_opts:               none,    none,     '-M at697 -append
"--console=com1;boot;"'

 [coverage]
 format:                none,    none,     'QEMU'
diff --git a/tester/rtems/testing/bsps/leon3-coverage.mc
b/tester/rtems/testing/bsps/leon3-coverage.mc
new file mode 100644
index 0000000..ae25268
--- /dev/null
+++ b/tester/rtems/testing/bsps/leon3-coverage.mc
@@ -0,0 +1,64 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2010-2014 Chris Johns (chrisj at rtems.org)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# All paths in defaults must be Unix format. Do not store any Windows
format
+# paths in the defaults.
+#
+# Every entry must describe the type of checking a host must pass.
+#
+# Records:
+#  key: type, attribute, value
+#   type     : none, dir, exe, triplet
+#   attribute: none, required, optional
+#   value    : 'single line', '''multi line'''
+#
+
+#
+# The sparc/leon3 QEMU BSP
+#
+
+[global]
+bsp:                      none,    none,     'leon3'
+coverage_supported:      none,   none,   '1'
+
+[leon3]
+leon3:                    none,    none,     '%{_rtscripts}/qemu.cfg'
+leon3_arch:               none,    none,     'sparc'
+leon3_opts:               none,    none,     '-M leon3_generic -m 64M
"--console=com1;boot;"'
+
+[coverage]
+format:                none,    none,     'QEMU'
+target:                none,    none,     'sparc-rtems4.11'
+explanations:            none,    none,
'%{_rtscripts}/coverage/Explanations.txt'
+coverageExtension:      none,    none,     'exe.cov'
+gcnosFile:              none,    none,
'%{_rtscripts}/coverage/rtems.gcnos'
+executableExtension:    none,    none,     'exe'
+projectName:            none,    none,     'RTEMS 4.11'
-- 
1.9.1


>From 2e9dc54506e68abb57ee8a17f407b565f4541b9d Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Fri, 12 Jun 2015 22:53:28 +0200
Subject: [PATCH 06/18] added dump of executableInfo when creating coverage
map
 in DesiredSymbols

---
 tester/covoar/DesiredSymbols.cc                    |  5 +-
 tester/covoar/DesiredSymbols.h                     |  3 +-
 tester/covoar/ObjdumpProcessor.cc                  |  2 +-
 tester/rtems/testing/coverage/symbolSets.config    | 80
+++++++++++-----------
 .../rtems/testing/coverage/symbolSets_pc386.config | 60 ++++++++++++++++
 5 files changed, 107 insertions(+), 43 deletions(-)
 create mode 100644 tester/rtems/testing/coverage/symbolSets_pc386.config

diff --git a/tester/covoar/DesiredSymbols.cc
b/tester/covoar/DesiredSymbols.cc
index b5032b4..827a78c 100644
--- a/tester/covoar/DesiredSymbols.cc
+++ b/tester/covoar/DesiredSymbols.cc
@@ -336,13 +336,16 @@ namespace Coverage {

   void DesiredSymbols::createCoverageMap(
     const std::string& symbolName,
-    uint32_t           size
+    uint32_t           size,
+    ExecutableInfo* const theExecutable
   )
   {
     CoverageMapBase*      aCoverageMap;
     uint32_t              highAddress;
     symbolSet_t::iterator itr;

+    theExecutable->dumpExecutableInfo();
+
     // Ensure that the symbol is a desired symbol.
     itr = set.find( symbolName );

diff --git a/tester/covoar/DesiredSymbols.h b/tester/covoar/DesiredSymbols.h
index 448f263..7c00e48 100644
--- a/tester/covoar/DesiredSymbols.h
+++ b/tester/covoar/DesiredSymbols.h
@@ -224,7 +224,8 @@ namespace Coverage {
      */
     void createCoverageMap(
       const std::string& symbolName,
-      uint32_t           size
+      uint32_t           size,
+      ExecutableInfo* const theExecutable
     );

     /*!
diff --git a/tester/covoar/ObjdumpProcessor.cc
b/tester/covoar/ObjdumpProcessor.cc
index 486c720..71c798d 100644
--- a/tester/covoar/ObjdumpProcessor.cc
+++ b/tester/covoar/ObjdumpProcessor.cc
@@ -112,7 +112,7 @@ namespace Coverage {

       // Create a unified coverage map for the symbol.
       SymbolsToAnalyze->createCoverageMap(
-        symbolName, endAddress - lowAddress + 1
+        symbolName, endAddress - lowAddress + 1, executableInfo
       );
     }
   }
diff --git a/tester/rtems/testing/coverage/symbolSets.config
b/tester/rtems/testing/coverage/symbolSets.config
index 99246c4..b87a3d4 100644
--- a/tester/rtems/testing/coverage/symbolSets.config
+++ b/tester/rtems/testing/coverage/symbolSets.config
@@ -1,60 +1,60 @@
 symbolset:
  name=core
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/score/libscore.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/sapi/libsapi.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/librtems.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/score/libscore.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/sapi/libsapi.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/rtems/librtems.a
 symbolset:
  name=developmental
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/score/libscore.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/sapi/libsapi.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/librtems.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/librfs.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdosfs.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdevfs.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libimfs.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libcsupport/libcsupport.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstackchk.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libbspcmdline.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libcpuuse.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstringto.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdevnull.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdumpbuf.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libblock/libblock.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/score/libscore.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/sapi/libsapi.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/rtems/librtems.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/librfs.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libdosfs.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libdevfs.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libimfs.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libcsupport/libcsupport.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libstackchk.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libfsmount.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libbspcmdline.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libcpuuse.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libfsmount.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libstringto.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libdevnull.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libdumpbuf.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libblock/libblock.a
 symbolset:
  name=score
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/score/libscore.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/score/libscore.a
 symbolset:
  name=sapi
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/sapi/libsapi.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/sapi/libsapi.a
 symbolset:
  name=rtems
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/librtems.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/rtems/librtems.a
 symbolset:
  name=filesystems
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdevfs.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdosfs.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libimfs.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/librfs.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libjffs2.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdefaultfs.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libdevfs.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libdosfs.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libimfs.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/librfs.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libjffs2.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libdefaultfs.a
 symbolset:
  name=libmisc
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstackchk.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libbspcmdline.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libcpuuse.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstringto.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdevnull.a
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdumpbuf.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libstackchk.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libfsmount.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libbspcmdline.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libcpuuse.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libfsmount.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libstringto.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libdevnull.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libdumpbuf.a
 symbolset:
  name=libcsupport
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libcsupport/libcsupport.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libcsupport/libcsupport.a
 symbolset:
  name=libblock
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libblock/libblock.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libblock/libblock.a
 symbolset:
  name=posix
-
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/posix/libposix.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/posix/libposix.a
diff --git a/tester/rtems/testing/coverage/symbolSets_pc386.config
b/tester/rtems/testing/coverage/symbolSets_pc386.config
new file mode 100644
index 0000000..99246c4
--- /dev/null
+++ b/tester/rtems/testing/coverage/symbolSets_pc386.config
@@ -0,0 +1,60 @@
+symbolset:
+ name=core
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/score/libscore.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/sapi/libsapi.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/librtems.a
+symbolset:
+ name=developmental
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/score/libscore.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/sapi/libsapi.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/librtems.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/librfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdosfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdevfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libimfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libcsupport/libcsupport.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstackchk.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libbspcmdline.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libcpuuse.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstringto.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdevnull.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdumpbuf.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libblock/libblock.a
+symbolset:
+ name=score
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/score/libscore.a
+symbolset:
+ name=sapi
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/sapi/libsapi.a
+symbolset:
+ name=rtems
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/librtems.a
+symbolset:
+ name=filesystems
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdevfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdosfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libimfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/librfs.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libjffs2.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libfs/libdefaultfs.a
+symbolset:
+ name=libmisc
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstackchk.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libbspcmdline.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libcpuuse.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libfsmount.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libstringto.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdevnull.a
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libmisc/libdumpbuf.a
+symbolset:
+ name=libcsupport
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libcsupport/libcsupport.a
+symbolset:
+ name=libblock
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/libblock/libblock.a
+symbolset:
+ name=posix
+
lib=/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/posix/libposix.a
-- 
1.9.1


>From 652ab7bc3567479e1727d022cd4eaa087754bba6 Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Wed, 24 Jun 2015 23:20:33 +0200
Subject: [PATCH 07/18] sample test cases pass when executing them on leon2
 with qemu

---
 tester/covoar/DesiredSymbols.cc                 |  2 +-
 tester/covoar/covoar.cc                         |  4 ++--
 tester/rt/coverage.py                           | 12 ++++++------
 tester/rtems/testing/bsps/leon2-coverage.mc     |  2 +-
 tester/rtems/testing/coverage/symbolSets.config |  1 -
 5 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/tester/covoar/DesiredSymbols.cc
b/tester/covoar/DesiredSymbols.cc
index 827a78c..6b855f8 100644
--- a/tester/covoar/DesiredSymbols.cc
+++ b/tester/covoar/DesiredSymbols.cc
@@ -344,7 +344,7 @@ namespace Coverage {
     uint32_t              highAddress;
     symbolSet_t::iterator itr;

-    theExecutable->dumpExecutableInfo();
+    //theExecutable->dumpExecutableInfo();

     // Ensure that the symbol is a desired symbol.
     itr = set.find( symbolName );
diff --git a/tester/covoar/covoar.cc b/tester/covoar/covoar.cc
index f8681ec..fa58828 100644
--- a/tester/covoar/covoar.cc
+++ b/tester/covoar/covoar.cc
@@ -94,7 +94,7 @@ Configuration::Options_t Options[] = {
   { "explanations",         NULL },
   { "format",               NULL },
   { "symbolsFile",          NULL },
-  { "symbolSetFile", NULL },
+  { "symbolSetFile",    NULL },
   { "outputDirectory",      NULL },
   { "executableExtension",  NULL },
   { "coverageExtension",    NULL },
@@ -183,7 +183,7 @@ int main(
       case 'E': explanations          = optarg; break;
       case 'f': format                = optarg; break;
       case 's': symbolsFile           = optarg; break;
-      case 'S': symbolSetFile  = optarg; break;
+      case 'S': symbolSetFile      = optarg; break;
       case 'T': target                = optarg; break;
       case 'O': outputDirectory       = optarg; break;
       case 'v': Verbose               = true;   break;
diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index 0255dab..53abf43 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -256,7 +256,7 @@ class covoar(object):
             log.stderr("Skipping " + setName)
             return

-        command = "covoar -C" + covoarConfigFile + " -S " + symbolFile + "
-O " + covoarResultDir + " " + path.join(self.tracesDir, "*.exe")
+        command = "covoar -v -C" + covoarConfigFile + " -S " + symbolFile
+ " -O " + covoarResultDir + " " + path.join(self.tracesDir, "*.exe")
         log.notice("Running covoar for " + setName, stdout_only=True)
         log.notice(command, stdout_only=True)
         executor = execute.execute(verbose=True, output=output_handler)
@@ -359,7 +359,7 @@ class coverage_run(object):

     def _cleanup(self):
         log.notice("Cleaning workspace up")
-        path.removeall(self.tracesDir)
+        #path.removeall(self.tracesDir)

     def _summarize(self):
         log.notice("Coverage analysis finished. You can find results in "
+ self.targetDir)
@@ -369,7 +369,7 @@ def output_handler(text):

 if __name__ == "__main__":
     print "coverage main"
-#    c =
coverage_run("/home/krzysztof/coverage/kmtest","/home/krzysztof/development/rtems/src/rtems-tools/tester")
-#    c.prepareEnvironment()
-#    c.executables =
["/home/krzysztof/development/rtems/src/b-pc386/i386-rtems4.11/c/pc386/testsuites/samples/hello/hello.exe"]
-#    c.run()
+    c =
coverage_run("/home/hf/coverage_test_leon2","/home/hf/development/rtems/src/rtems-tools/tester")
+    c.prepareEnvironment()
+    c.executables =
["/home/hf/development/rtems/src/b-leon2/sparc-rtems4.11/c/leon2/testsuites/samples/hello/hello.exe"]
+    c.run()
diff --git a/tester/rtems/testing/bsps/leon2-coverage.mc
b/tester/rtems/testing/bsps/leon2-coverage.mc
index ae004e9..bd552bd 100644
--- a/tester/rtems/testing/bsps/leon2-coverage.mc
+++ b/tester/rtems/testing/bsps/leon2-coverage.mc
@@ -52,7 +52,7 @@ coverage_supported:      none,   none,   '1'
 [leon2]
 leon2:                    none,    none,     '%{_rtscripts}/qemu.cfg'
 leon2_arch:               none,    none,     'sparc'
-leon2_opts:               none,    none,     '-M at697 -append
"--console=com1;boot;"'
+leon2_opts:               none,    none,     '-nographic -machine at697'

 [coverage]
 format:                none,    none,     'QEMU'
diff --git a/tester/rtems/testing/coverage/symbolSets.config
b/tester/rtems/testing/coverage/symbolSets.config
index b87a3d4..fcad5a3 100644
--- a/tester/rtems/testing/coverage/symbolSets.config
+++ b/tester/rtems/testing/coverage/symbolSets.config
@@ -17,7 +17,6 @@ symbolset:

lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libfsmount.a

lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libbspcmdline.a

lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libcpuuse.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libfsmount.a

lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libstringto.a

lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libdevnull.a

lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libdumpbuf.a
-- 
1.9.1


>From 0cd5366e7df3fd7e90405b325a29a5dcb4ad8b6d Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Thu, 25 Jun 2015 17:11:08 +0200
Subject: [PATCH 08/18] covoar improved diagnostics patch applied

---
 tester/covoar/CoverageMap.cc        |  7 ++++---
 tester/covoar/CoverageMap.h         |  5 +++--
 tester/covoar/CoverageMapBase.cc    |  6 ++++--
 tester/covoar/CoverageMapBase.h     | 11 +++++++++--
 tester/covoar/CoverageReaderQEMU.cc |  5 +++--
 tester/covoar/DesiredSymbols.cc     | 16 +++++++++-------
 tester/covoar/DesiredSymbols.h      |  6 ++++--
 tester/covoar/ExecutableInfo.cc     |  3 ++-
 tester/covoar/ExecutableInfo.h      |  2 ++
 tester/covoar/ObjdumpProcessor.cc   |  4 ++--
 tester/rt/coverage.py               |  2 +-
 11 files changed, 43 insertions(+), 24 deletions(-)

diff --git a/tester/covoar/CoverageMap.cc b/tester/covoar/CoverageMap.cc
index 816be11..b470fea 100644
--- a/tester/covoar/CoverageMap.cc
+++ b/tester/covoar/CoverageMap.cc
@@ -10,9 +10,10 @@
 namespace Coverage {

   CoverageMap::CoverageMap(
-    uint32_t low,
-    uint32_t high
-  ) : CoverageMapBase(low, high)
+    const std::string& exefileName,
+    uint32_t           low,
+    uint32_t           high
+  ) : CoverageMapBase(exefileName, low, high)
   {
   }

diff --git a/tester/covoar/CoverageMap.h b/tester/covoar/CoverageMap.h
index 0f2f6d4..c211949 100644
--- a/tester/covoar/CoverageMap.h
+++ b/tester/covoar/CoverageMap.h
@@ -27,8 +27,9 @@ namespace Coverage {
      *  @param[in] high specifies the highest address of the coverage map.
      */
     CoverageMap(
-      uint32_t low,
-      uint32_t high
+      const std::string& exefileName,
+      uint32_t           low,
+      uint32_t           high
     );

     /* Inherit documentation from base class. */
diff --git a/tester/covoar/CoverageMapBase.cc
b/tester/covoar/CoverageMapBase.cc
index 407ef5f..ed30603 100644
--- a/tester/covoar/CoverageMapBase.cc
+++ b/tester/covoar/CoverageMapBase.cc
@@ -16,13 +16,15 @@
 namespace Coverage {

   CoverageMapBase::CoverageMapBase(
-    uint32_t low,
-    uint32_t high
+    const std::string& exefileName,
+    uint32_t           low,
+    uint32_t           high
   )
   {
     uint32_t       a;
     AddressRange_t range;

+    range.fileName    = exefileName;
     range.lowAddress  = low;
     range.highAddress = high;
     RangeList.push_back( range );
diff --git a/tester/covoar/CoverageMapBase.h
b/tester/covoar/CoverageMapBase.h
index 70b2b30..e1310c9 100644
--- a/tester/covoar/CoverageMapBase.h
+++ b/tester/covoar/CoverageMapBase.h
@@ -28,6 +28,11 @@ namespace Coverage {
      */
     typedef struct {
       /*!
+       *  This is the file from which this originated.
+       */
+      std::string fileName;
+
+      /*!
        *  This is the low address of the address map range.
        */
       uint32_t lowAddress;
@@ -48,12 +53,14 @@ namespace Coverage {
     /*!
      *  This method constructs a CoverageMapBase instance.
      *
+     *  @param[in] exefileName specifies the executable this originated in
      *  @param[in] low specifies the lowest address of the coverage map
      *  @param[in] high specifies the highest address of the coverage map
      */
     CoverageMapBase(
-      uint32_t low,
-      uint32_t high
+      const std::string& exefileName,
+      uint32_t           low,
+      uint32_t           high
     );

     /*!
diff --git a/tester/covoar/CoverageReaderQEMU.cc
b/tester/covoar/CoverageReaderQEMU.cc
index 8e34f8f..8681afe 100644
--- a/tester/covoar/CoverageReaderQEMU.cc
+++ b/tester/covoar/CoverageReaderQEMU.cc
@@ -147,10 +147,11 @@ namespace Coverage {
               stderr,
               "*** Trace block is inconsistent with coverage map\n"
               "*** Trace block (0x%08x - 0x%08x) for %d bytes\n"
-              "*** Coverage map XXX \n",
+              "*** Coverage map %s\n",
               entry->pc,
               a,
-              entry->size
+              entry->size,
+              file
             );
           } else {
             while (!aCoverageMap->isStartOfInstruction(a))
diff --git a/tester/covoar/DesiredSymbols.cc
b/tester/covoar/DesiredSymbols.cc
index 6b855f8..f00c2c5 100644
--- a/tester/covoar/DesiredSymbols.cc
+++ b/tester/covoar/DesiredSymbols.cc
@@ -335,17 +335,15 @@ namespace Coverage {


   void DesiredSymbols::createCoverageMap(
+    const std::string& exefileName,
     const std::string& symbolName,
-    uint32_t           size,
-    ExecutableInfo* const theExecutable
+    uint32_t           size
   )
   {
     CoverageMapBase*      aCoverageMap;
     uint32_t              highAddress;
     symbolSet_t::iterator itr;

-    //theExecutable->dumpExecutableInfo();
-
     // Ensure that the symbol is a desired symbol.
     itr = set.find( symbolName );

@@ -369,9 +367,12 @@ namespace Coverage {
         fprintf(
           stderr,
           "ERROR: DesiredSymbols::createCoverageMap - Attempt to create "
-          "unified coverage maps for %s with different sizes (%d != %d)\n",
+          "unified coverage maps for %s with different sizes (%s/%d !=
%s/%d)\n",
+          exefileName.c_str(),
           symbolName.c_str(),
+
           itr->second.stats.sizeInBytes,
+          itr->second.sourceFile->getFileName().c_str(),
           size
         );
         if ( itr->second.stats.sizeInBytes < size )
@@ -387,13 +388,14 @@ namespace Coverage {

       highAddress = size - 1;

-      aCoverageMap = new CoverageMap( 0, highAddress );
+      aCoverageMap = new CoverageMap( exefileName, 0, highAddress );
       if (!aCoverageMap) {

         fprintf(
           stderr,
           "ERROR: DesiredSymbols::createCoverageMap - Unable to allocate "
-          "coverage map for %s\n",
+          "coverage map for %s:%s\n",
+          exefileName.c_str(),
           symbolName.c_str()
         );
         exit( -1 );
diff --git a/tester/covoar/DesiredSymbols.h b/tester/covoar/DesiredSymbols.h
index 7c00e48..aacc3ef 100644
--- a/tester/covoar/DesiredSymbols.h
+++ b/tester/covoar/DesiredSymbols.h
@@ -218,14 +218,16 @@ namespace Coverage {
      *  This method creates a coverage map for the specified symbol
      *  using the specified size.
      *
+     *  @param[in] exefileName specifies the executable from which the
+     *             coverage map is being created
      *  @param[in] symbolName specifies the symbol for which to create
      *             a coverage map
      *  @param[in] size specifies the size of the coverage map to create
      */
     void createCoverageMap(
+      const std::string& exefileName,
       const std::string& symbolName,
-      uint32_t           size,
-      ExecutableInfo* const theExecutable
+      uint32_t           size
     );

     /*!
diff --git a/tester/covoar/ExecutableInfo.cc
b/tester/covoar/ExecutableInfo.cc
index 0a7eac3..d71c435 100644
--- a/tester/covoar/ExecutableInfo.cc
+++ b/tester/covoar/ExecutableInfo.cc
@@ -89,6 +89,7 @@ namespace Coverage {
   }

   CoverageMapBase* ExecutableInfo::createCoverageMap (
+    const std::string& fileName,
     const std::string& symbolName,
     uint32_t           lowAddress,
     uint32_t           highAddress
@@ -99,7 +100,7 @@ namespace Coverage {

     itr = coverageMaps.find( symbolName );
     if ( itr == coverageMaps.end() ) {
-      theMap = new CoverageMap( lowAddress, highAddress );
+      theMap = new CoverageMap( fileName, lowAddress, highAddress );
       coverageMaps[ symbolName ] = theMap;
     } else {
       theMap = itr->second;
diff --git a/tester/covoar/ExecutableInfo.h b/tester/covoar/ExecutableInfo.h
index ca4184a..7242715 100644
--- a/tester/covoar/ExecutableInfo.h
+++ b/tester/covoar/ExecutableInfo.h
@@ -93,6 +93,7 @@ namespace Coverage {
     /*!
      *  This method creates a coverage map for the specified symbol.
      *
+     *  @param[in] exefileName specifies the source of the information
      *  @param[in] symbolName specifies the name of the symbol
      *  @param[in] lowAddress specifies the low address of the coverage map
      *  @param[in] highAddress specifies the high address of the coverage
map
@@ -100,6 +101,7 @@ namespace Coverage {
      *  @return Returns a pointer to the coverage map
      */
     CoverageMapBase* createCoverageMap (
+      const std::string& exefileName,
       const std::string& symbolName,
       uint32_t           lowAddress,
       uint32_t           highAddress
diff --git a/tester/covoar/ObjdumpProcessor.cc
b/tester/covoar/ObjdumpProcessor.cc
index 71c798d..5c9b6a0 100644
--- a/tester/covoar/ObjdumpProcessor.cc
+++ b/tester/covoar/ObjdumpProcessor.cc
@@ -97,7 +97,7 @@ namespace Coverage {

     // Create a coverage map for the symbol.
     aCoverageMap = executableInfo->createCoverageMap(
-      symbolName, lowAddress, endAddress
+      executableInfo->getFileName().c_str(), symbolName, lowAddress,
endAddress
     );

     if (aCoverageMap) {
@@ -112,7 +112,7 @@ namespace Coverage {

       // Create a unified coverage map for the symbol.
       SymbolsToAnalyze->createCoverageMap(
-        symbolName, endAddress - lowAddress + 1, executableInfo
+        executableInfo->getFileName().c_str(), symbolName, endAddress -
lowAddress + 1
       );
     }
   }
diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index 53abf43..eb6e761 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -371,5 +371,5 @@ if __name__ == "__main__":
     print "coverage main"
     c =
coverage_run("/home/hf/coverage_test_leon2","/home/hf/development/rtems/src/rtems-tools/tester")
     c.prepareEnvironment()
-    c.executables =
["/home/hf/development/rtems/src/b-leon2/sparc-rtems4.11/c/leon2/testsuites/samples/hello/hello.exe"]
+    c.executables =
["/home/hf/development/rtems/src/b-leon2/sparc-rtems4.11/c/leon2/testsuites/samples/hello/hello.ralf"]
     c.run()
-- 
1.9.1


>From ac004cfba2aecde267322f2d8d5e40c5732933ea Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Fri, 26 Jun 2015 01:17:17 +0200
Subject: [PATCH 09/18] added some debug output

---
 tester/covoar/DesiredSymbols.cc                 |  4 +-
 tester/covoar/ObjdumpProcessor.cc               |  5 +++
 tester/covoar/qemu-traces.h                     |  1 +
 tester/rtems/testing/coverage/symbolSets.config | 56
-------------------------
 4 files changed, 8 insertions(+), 58 deletions(-)

diff --git a/tester/covoar/DesiredSymbols.cc
b/tester/covoar/DesiredSymbols.cc
index f00c2c5..d2595f2 100644
--- a/tester/covoar/DesiredSymbols.cc
+++ b/tester/covoar/DesiredSymbols.cc
@@ -368,9 +368,9 @@ namespace Coverage {
           stderr,
           "ERROR: DesiredSymbols::createCoverageMap - Attempt to create "
           "unified coverage maps for %s with different sizes (%s/%d !=
%s/%d)\n",
-          exefileName.c_str(),
-          symbolName.c_str(),

+          symbolName.c_str(),
+          exefileName.c_str(),
           itr->second.stats.sizeInBytes,
           itr->second.sourceFile->getFileName().c_str(),
           size
diff --git a/tester/covoar/ObjdumpProcessor.cc
b/tester/covoar/ObjdumpProcessor.cc
index 5c9b6a0..ee83d13 100644
--- a/tester/covoar/ObjdumpProcessor.cc
+++ b/tester/covoar/ObjdumpProcessor.cc
@@ -108,7 +108,12 @@ namespace Coverage {
            itr++ ) {

         aCoverageMap->setIsStartOfInstruction( itr->address );
+        if (strcmp(symbolName.c_str(), "_Thread_Handler"))
+        {
+          fprintf(stderr, "%s\n", itr->line.c_str());
+        }
       }
+

       // Create a unified coverage map for the symbol.
       SymbolsToAnalyze->createCoverageMap(
diff --git a/tester/covoar/qemu-traces.h b/tester/covoar/qemu-traces.h
index 7e37840..1bee66f 100644
--- a/tester/covoar/qemu-traces.h
+++ b/tester/covoar/qemu-traces.h
@@ -33,6 +33,7 @@

 /* XXX really not always right */
 /* XXX Added for covoar so this compiles */
+//typedef uint32_t target_ulong;
 typedef uint32_t target_ulong;

 /* File header definition.  */
diff --git a/tester/rtems/testing/coverage/symbolSets.config
b/tester/rtems/testing/coverage/symbolSets.config
index fcad5a3..9ec44d7 100644
--- a/tester/rtems/testing/coverage/symbolSets.config
+++ b/tester/rtems/testing/coverage/symbolSets.config
@@ -1,59 +1,3 @@
 symbolset:
- name=core
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/score/libscore.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/sapi/libsapi.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/rtems/librtems.a
-symbolset:
- name=developmental
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/score/libscore.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/sapi/libsapi.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/rtems/librtems.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/librfs.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libdosfs.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libdevfs.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libimfs.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libcsupport/libcsupport.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libstackchk.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libfsmount.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libbspcmdline.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libcpuuse.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libstringto.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libdevnull.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libdumpbuf.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libblock/libblock.a
-symbolset:
  name=score

lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/score/libscore.a
-symbolset:
- name=sapi
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/sapi/libsapi.a
-symbolset:
- name=rtems
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/rtems/librtems.a
-symbolset:
- name=filesystems
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libdevfs.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libdosfs.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libimfs.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/librfs.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libjffs2.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libfs/libdefaultfs.a
-symbolset:
- name=libmisc
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libstackchk.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libfsmount.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libbspcmdline.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libcpuuse.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libfsmount.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libstringto.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libdevnull.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libmisc/libdumpbuf.a
-symbolset:
- name=libcsupport
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libcsupport/libcsupport.a
-symbolset:
- name=libblock
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/libblock/libblock.a
-symbolset:
- name=posix
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/posix/libposix.a
-- 
1.9.1


>From 10c0d5a9dd8c01ef1a82945669e9ae47d384678f Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Fri, 26 Jun 2015 20:51:56 +0200
Subject: [PATCH 10/18] removed some debug outputs which were needed to find
 the byte size differences when analyzing the obj dumps

---
 tester/covoar/ObjdumpProcessor.cc               | 4 ----
 tester/rt/coverage.py                           | 2 +-
 tester/rtems/testing/coverage/symbolSets.config | 4 +++-
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/tester/covoar/ObjdumpProcessor.cc
b/tester/covoar/ObjdumpProcessor.cc
index ee83d13..851dc56 100644
--- a/tester/covoar/ObjdumpProcessor.cc
+++ b/tester/covoar/ObjdumpProcessor.cc
@@ -108,10 +108,6 @@ namespace Coverage {
            itr++ ) {

         aCoverageMap->setIsStartOfInstruction( itr->address );
-        if (strcmp(symbolName.c_str(), "_Thread_Handler"))
-        {
-          fprintf(stderr, "%s\n", itr->line.c_str());
-        }
       }


diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index eb6e761..6dc86c7 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -256,7 +256,7 @@ class covoar(object):
             log.stderr("Skipping " + setName)
             return

-        command = "covoar -v -C" + covoarConfigFile + " -S " + symbolFile
+ " -O " + covoarResultDir + " " + path.join(self.tracesDir, "*.exe")
+        command = "covoar -C" + covoarConfigFile + " -S " + symbolFile + "
-O " + covoarResultDir + " " + path.join(self.tracesDir, "*.exe")
         log.notice("Running covoar for " + setName, stdout_only=True)
         log.notice(command, stdout_only=True)
         executor = execute.execute(verbose=True, output=output_handler)
diff --git a/tester/rtems/testing/coverage/symbolSets.config
b/tester/rtems/testing/coverage/symbolSets.config
index 9ec44d7..47c6323 100644
--- a/tester/rtems/testing/coverage/symbolSets.config
+++ b/tester/rtems/testing/coverage/symbolSets.config
@@ -1,3 +1,5 @@
 symbolset:
- name=score
+ name=core

lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/score/libscore.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/sapi/libsapi.a
+
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/rtems/librtems.a
-- 
1.9.1


>From e842cc5234cf600c81851853821062cdfe5c5898 Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Tue, 14 Jul 2015 17:39:57 +0200
Subject: [PATCH 11/18] changed <br> tag in html report generator

---
 tester/covoar/ReportsHtml.cc | 42
+++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/tester/covoar/ReportsHtml.cc b/tester/covoar/ReportsHtml.cc
index 101c76b..80d3a43 100644
--- a/tester/covoar/ReportsHtml.cc
+++ b/tester/covoar/ReportsHtml.cc
@@ -69,7 +69,7 @@ namespace Coverage {
     if (projectName)
       fprintf(
         aFile,
-         "%s</br>",
+         "%s<br>",
          projectName
       );

@@ -144,7 +144,7 @@ namespace Coverage {
     if (projectName)
       fprintf(
         aFile,
-         "%s</br>",
+         "%s<br>",
          projectName
       );

@@ -181,7 +181,7 @@ namespace Coverage {
       if (projectName)
         fprintf(
           aFile,
-          "%s</br>",
+          "%s<br>",
           projectName
         );

@@ -197,7 +197,7 @@ namespace Coverage {
         "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
         "<th class=\"table-sortable:default\" align=\"left\">Line</th>\n"
         "<th class=\"table-filterable table-sortable:default\"
align=\"left\">File</th>\n"
-        "<th class=\"table-sortable:numeric\" align=\"left\">Size
</br>Bytes</th>\n"
+        "<th class=\"table-sortable:numeric\" align=\"left\">Size
<br>Bytes</th>\n"
         "<th class=\"table-sortable:default\" align=\"left\">Reason</th>\n"
         "<th class=\"table-filterable table-sortable:default\"
align=\"left\">Taken</th>\n"
  "<th class=\"table-filterable table-sortable:default\" align=\"left\">Not
Taken</th>\n"
@@ -232,7 +232,7 @@ namespace Coverage {
     if (projectName)
       fprintf(
         aFile,
-        "%s</br>",
+        "%s<br>",
         projectName
       );

@@ -248,8 +248,8 @@ namespace Coverage {
       "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n"
       "<th class=\"table-sortable:default\" align=\"left\">Range</th>\n"
       "<th class=\"table-filterable table-sortable:default\"
align=\"left\">File</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"left\">Size
</br>Bytes</th>\n"
-      "<th class=\"table-sortable:numeric\" align=\"left\">Size
</br>Instructions</th>\n"
+      "<th class=\"table-sortable:numeric\" align=\"left\">Size
<br>Bytes</th>\n"
+      "<th class=\"table-sortable:numeric\" align=\"left\">Size
<br>Instructions</th>\n"
       "<th class=\"table-filterable table-sortable:default\"
align=\"left\">Classification</th>\n"
       "<th class=\"table-sortable:default\"
align=\"left\">Explanation</th>\n"
       "</tr>\n"
@@ -281,7 +281,7 @@ namespace Coverage {
     if (projectName)
       fprintf(
         aFile,
-        "%s</br>",
+        "%s<br>",
         projectName
       );

@@ -326,7 +326,7 @@ namespace Coverage {
     if (projectName)
       fprintf(
         aFile,
-        "%s</br>",
+        "%s<br>",
         projectName
       );

@@ -371,7 +371,7 @@ namespace Coverage {
     if (projectName)
       fprintf(
         aFile,
-        "%s</br>",
+        "%s<br>",
         projectName
       );

@@ -385,16 +385,16 @@ namespace Coverage {
       "<thead>\n"
       "<tr>\n"
       "<th class=\"table-sortable:default\" align=\"center\">Symbol</th>\n"
-      "<th class=\"table-sortable:numeric\"
align=\"center\">Total</br>Size</br>Bytes</th>\n"
-      "<th class=\"table-sortable:numeric\"
align=\"center\">Total</br>Size</br>Instr</th>\n"
-      "<th class=\"table-sortable:numeric\"
align=\"center\">#</br>Ranges</th>\n"
-      "<th class=\"table-sortable:numeric\"
align=\"center\">Uncovered</br>Size</br>Bytes</th>\n"
-      "<th class=\"table-sortable:numeric\"
align=\"center\">Uncovered</br>Size</br>Instr</th>\n"
-      "<th class=\"table-sortable:numeric\"
align=\"center\">#</br>Branches</th>\n"
-      "<th class=\"table-sortable:numeric\"
align=\"center\">#</br>Always</br>Taken</th>\n"
-      "<th class=\"table-sortable:numeric\"
align=\"center\">#</br>Never</br>Taken</th>\n"
-      "<th class=\"table-sortable:numeric\"
align=\"center\">Percent</br>Uncovered</br>Instructions</th>\n"
-      "<th class=\"table-sortable:numeric\"
align=\"center\">Percent</br>Uncovered</br>Bytes</th>\n"
+      "<th class=\"table-sortable:numeric\"
align=\"center\">Total<br>Size<br>Bytes</th>\n"
+      "<th class=\"table-sortable:numeric\"
align=\"center\">Total<br>Size<br>Instr</th>\n"
+      "<th class=\"table-sortable:numeric\"
align=\"center\">#<br>Ranges</th>\n"
+      "<th class=\"table-sortable:numeric\"
align=\"center\">Uncovered<br>Size<br>Bytes</th>\n"
+      "<th class=\"table-sortable:numeric\"
align=\"center\">Uncovered<br>Size<br>Instr</th>\n"
+      "<th class=\"table-sortable:numeric\"
align=\"center\">#<br>Branches</th>\n"
+      "<th class=\"table-sortable:numeric\"
align=\"center\">#<br>Always<br>Taken</th>\n"
+      "<th class=\"table-sortable:numeric\"
align=\"center\">#<br>Never<br>Taken</th>\n"
+      "<th class=\"table-sortable:numeric\"
align=\"center\">Percent<br>Uncovered<br>Instructions</th>\n"
+      "<th class=\"table-sortable:numeric\"
align=\"center\">Percent<br>Uncovered<br>Bytes</th>\n"
       "</tr>\n"
       "</thead>\n"
       "<tbody>\n",
@@ -728,7 +728,7 @@ namespace Coverage {
     // Range
     fprintf(
       report,
-      "<td class=\"covoar-td\" align=\"center\"><a href
=\"annotated.html#range%d\">%s </br>%s</td>\n",
+      "<td class=\"covoar-td\" align=\"center\"><a href
=\"annotated.html#range%d\">%s <br>%s</td>\n",
       rangePtr->id,
       rangePtr->lowSourceLine.c_str(),
       rangePtr->highSourceLine.c_str()
-- 
1.9.1


>From a5ecb908c39ba1b84f638476c426b2770c32b52e Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Tue, 4 Aug 2015 12:33:10 +0200
Subject: [PATCH 12/18] added 'rtems-cpukit' parameter to replace hardcoded
 paths in symbolSets.config file

---
 tester/covoar/DesiredSymbols.cc                 |  9 +++++++--
 tester/rt/coverage.py                           | 14 ++++++++++----
 tester/rt/options.py                            |  2 +-
 tester/rt/test.py                               |  9 +++++++--
 tester/rtems/testing/coverage/symbolSets.config |  6 +++---
 5 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/tester/covoar/DesiredSymbols.cc
b/tester/covoar/DesiredSymbols.cc
index d2595f2..a4b7868 100644
--- a/tester/covoar/DesiredSymbols.cc
+++ b/tester/covoar/DesiredSymbols.cc
@@ -364,9 +364,13 @@ namespace Coverage {
       // ensure that the specified size matches the existing size.
       if (itr->second.stats.sizeInBytes != size) {

+        // Changed ERROR to INFO because size mismatch is not treated as
error anymore.
+        // Set smallest size as size and continue.
+        // Update value for longer byte size.
+        // 2015-07-22
         fprintf(
           stderr,
-          "ERROR: DesiredSymbols::createCoverageMap - Attempt to create "
+          "INFO: DesiredSymbols::createCoverageMap - Attempt to create "
           "unified coverage maps for %s with different sizes (%s/%d !=
%s/%d)\n",

           symbolName.c_str(),
@@ -658,6 +662,7 @@ namespace Coverage {

     // Ensure that the source and destination coverage maps
     // are the same size.
+    // Changed from ERROR msg to INFO, because size mismatch is not
treated as error anymore. 2015-07-20
     dMapSize = itr->second.stats.sizeInBytes;
     sBaseAddress = sourceCoverageMap->getFirstLowAddress();
     sMapSize = sourceCoverageMap->getSize();
@@ -665,7 +670,7 @@ namespace Coverage {

       fprintf(
         stderr,
-        "ERROR: DesiredSymbols::mergeCoverageMap - Unable to merge "
+        "INFO: DesiredSymbols::mergeCoverageMap - Unable to merge "
         "coverage map for %s because the sizes are different\n",
         symbolName.c_str()
       );
diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index 6dc86c7..beac357 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -11,6 +11,8 @@ import shutil
 import os
 from datetime import datetime

+import options
+
 class summary:
     def __init__(self, p_summaryDir):
         self.summaryFilePath = path.join(p_summaryDir, "summary.txt")
@@ -179,7 +181,7 @@ class symbolsConfiguration(object):
                     name=SYMBOLSET_NAME_N
                     lib=PATH_TO_LIBRARY        ''')

-    def load(self, symbolSetConfigFile):
+    def load(self, symbolSetConfigFile, path_to_cpukit):
         scf = open(symbolSetConfigFile, 'r')
         for line in scf:
             try:
@@ -190,10 +192,13 @@ class symbolsConfiguration(object):
                     if(len(splitted) == 2):
                         key = splitted[0].strip()
                         value = splitted[1].strip()
+
                         if key == 'name':
                             self.symbolSets[-1].name = value
                         elif key == 'lib':
-                            self.symbolSets[-1].libs.append(value)
+                            lib = os.path.join(path_to_cpukit, value)
+                            log.stderr(lib + "\n")
+                            self.symbolSets[-1].libs.append(lib)
                         else:
                             log.stderr("Invalid key : " + key + " in
symbol set configuration file " + symbolSetConfigFile)
                     else:
@@ -277,7 +282,7 @@ class coverage_run(object):
     Coverage analysis support for rtems-test
     '''

-    def __init__(self, p_macros):
+    def __init__(self, p_macros, path_to_cpukit):
         '''
         Constructor
         '''
@@ -292,6 +297,7 @@ class coverage_run(object):
         self.config_map = self.macros.macros['coverage']
         self.executables = None
         self.symbolSets = []
+        self.path_to_cpukit = path_to_cpukit

     def prepareEnvironment(self):
         if(path.exists(self.tracesDir)):
@@ -327,7 +333,7 @@ class coverage_run(object):
         self._linkExecutables()

         symbolConfig = symbolsConfiguration()
-        symbolConfig.load(self.symbolConfigPath)
+        symbolConfig.load(self.symbolConfigPath, self.path_to_cpukit)

         for sset in symbolConfig.symbolSets:
             if sset.isValid():
diff --git a/tester/rt/options.py b/tester/rt/options.py
index a916cbb..ff4ea60 100644
--- a/tester/rt/options.py
+++ b/tester/rt/options.py
@@ -1,6 +1,6 @@
 #
 # RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2013-2015 Chris Johns (chrisj at rtems.org)
+        # Copyright 2013-2015 Chris Johns (chrisj at rtems.org)
 # All rights reserved.
 #
 # This file is part of the RTEMS Tools package in 'rtems-tools'.
diff --git a/tester/rt/test.py b/tester/rt/test.py
index 6fd0f6e..ad4e600 100644
--- a/tester/rt/test.py
+++ b/tester/rt/test.py
@@ -198,7 +198,8 @@ def run(command_path = None):
                     '--debug-trace': 'Debug trace based on specific flags',
                     '--filter':      'Glob that executables must match to
run (default: ' +
                               default_exefilter + ')',
-                    '--stacktrace':  'Dump a stack trace on a user
termination (^C)'}
+                    '--stacktrace':  'Dump a stack trace on a user
termination (^C)',
+                    '--rtems-cpukit': 'The path to the cpukit directory (
including /cpukit )'}
         opts = options.load(sys.argv,
                             optargs = optargs,
                             command_path = command_path)
@@ -248,7 +249,11 @@ def run(command_path = None):
             opts.defaults.load('%%{_configdir}/coverage.mc')
             if not check.check_exe('__covoar', opts.defaults['__covoar']):
                 raise error.general("Covoar not found!")
-            coverage = coverage.coverage_run(opts.defaults)
+
+            path_to_cpukit = opts.find_arg('--rtems-cpukit')
+            if not path_to_cpukit:
+                raise error.general("Path to cpukit directory not
provided")
+            coverage = coverage.coverage_run(opts.defaults,
path_to_cpukit[1])
             coverage.prepareEnvironment();

         report_mode = opts.find_arg('--report-mode')
diff --git a/tester/rtems/testing/coverage/symbolSets.config
b/tester/rtems/testing/coverage/symbolSets.config
index 47c6323..fb2273e 100644
--- a/tester/rtems/testing/coverage/symbolSets.config
+++ b/tester/rtems/testing/coverage/symbolSets.config
@@ -1,5 +1,5 @@
 symbolset:
  name=core
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/score/libscore.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/sapi/libsapi.a
-
lib=/home/hf/development/rtems/b-leon2/sparc-rtems4.11/c/leon2/cpukit/rtems/librtems.a
+ lib=score/libscore.a
+ lib=sapi/libsapi.a
+ lib=rtems/librtems.a
-- 
1.9.1


>From 4e2d9310b835f605fd89777797a6c30611553026 Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Tue, 4 Aug 2015 17:16:00 +0200
Subject: [PATCH 13/18] changes such that when executing rtems-test the path
to
 the test cases does not have to be absolute anymore

---
 tester/rt/coverage.py                           | 10 +++++-----
 tester/rt/test.py                               | 16 +++++++++-------
 tester/rtems/testing/coverage/symbolSets.config |  6 +++---
 3 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index beac357..32195cf 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -181,7 +181,7 @@ class symbolsConfiguration(object):
                     name=SYMBOLSET_NAME_N
                     lib=PATH_TO_LIBRARY        ''')

-    def load(self, symbolSetConfigFile, path_to_cpukit):
+    def load(self, symbolSetConfigFile, path_to_builddir):
         scf = open(symbolSetConfigFile, 'r')
         for line in scf:
             try:
@@ -196,7 +196,7 @@ class symbolsConfiguration(object):
                         if key == 'name':
                             self.symbolSets[-1].name = value
                         elif key == 'lib':
-                            lib = os.path.join(path_to_cpukit, value)
+                            lib = os.path.join(path_to_builddir, value)
                             log.stderr(lib + "\n")
                             self.symbolSets[-1].libs.append(lib)
                         else:
@@ -282,7 +282,7 @@ class coverage_run(object):
     Coverage analysis support for rtems-test
     '''

-    def __init__(self, p_macros, path_to_cpukit):
+    def __init__(self, p_macros, path_to_builddir):
         '''
         Constructor
         '''
@@ -297,7 +297,7 @@ class coverage_run(object):
         self.config_map = self.macros.macros['coverage']
         self.executables = None
         self.symbolSets = []
-        self.path_to_cpukit = path_to_cpukit
+        self.path_to_builddir= path_to_builddir

     def prepareEnvironment(self):
         if(path.exists(self.tracesDir)):
@@ -333,7 +333,7 @@ class coverage_run(object):
         self._linkExecutables()

         symbolConfig = symbolsConfiguration()
-        symbolConfig.load(self.symbolConfigPath, self.path_to_cpukit)
+        symbolConfig.load(self.symbolConfigPath, self.path_to_builddir)

         for sset in symbolConfig.symbolSets:
             if sset.isValid():
diff --git a/tester/rt/test.py b/tester/rt/test.py
index ad4e600..cbe7332 100644
--- a/tester/rt/test.py
+++ b/tester/rt/test.py
@@ -125,9 +125,10 @@ class test_run(object):
         if self.test:
             self.test.kill()

-def find_executables(paths, glob):
+def find_executables(paths, glob, path_to_builddir):
     executables = []
     for p in paths:
+        p = os.path.join(path_to_builddir, p)
         if path.isfile(p):
             executables += [p]
         elif path.isdir(p):
@@ -199,7 +200,7 @@ def run(command_path = None):
                     '--filter':      'Glob that executables must match to
run (default: ' +
                               default_exefilter + ')',
                     '--stacktrace':  'Dump a stack trace on a user
termination (^C)',
-                    '--rtems-cpukit': 'The path to the cpukit directory (
including /cpukit )'}
+                    '--rtems-builddir': 'The path to the build directory (
including e.g. /b-leon2/ )'}
         opts = options.load(sys.argv,
                             optargs = optargs,
                             command_path = command_path)
@@ -241,6 +242,10 @@ def run(command_path = None):
             raise error.general('BSP script not found: %s' % (bsp))
         bsp_config = opts.defaults.expand(opts.defaults[bsp])

+        path_to_builddir= opts.find_arg('--rtems-builddir')
+        if not path_to_builddir:
+            raise error.general("Path to build directory not provided")
+
         coverage_enabled = opts.coverage()
         if coverage_enabled:
             import coverage
@@ -250,10 +255,7 @@ def run(command_path = None):
             if not check.check_exe('__covoar', opts.defaults['__covoar']):
                 raise error.general("Covoar not found!")

-            path_to_cpukit = opts.find_arg('--rtems-cpukit')
-            if not path_to_cpukit:
-                raise error.general("Path to cpukit directory not
provided")
-            coverage = coverage.coverage_run(opts.defaults,
path_to_cpukit[1])
+            coverage = coverage.coverage_run(opts.defaults,
path_to_builddir[1])
             coverage.prepareEnvironment();

         report_mode = opts.find_arg('--report-mode')
@@ -265,7 +267,7 @@ def run(command_path = None):
             report_mode = report_mode[1]
         else:
             report_mode = 'failures'
-        executables = find_executables(opts.params(), exe_filter)
+        executables = find_executables(opts.params(), exe_filter,
path_to_builddir[1])
         if len(executables) == 0:
             raise error.general('no executables supplied')
         start_time = datetime.datetime.now()
diff --git a/tester/rtems/testing/coverage/symbolSets.config
b/tester/rtems/testing/coverage/symbolSets.config
index fb2273e..4b90fc7 100644
--- a/tester/rtems/testing/coverage/symbolSets.config
+++ b/tester/rtems/testing/coverage/symbolSets.config
@@ -1,5 +1,5 @@
 symbolset:
  name=core
- lib=score/libscore.a
- lib=sapi/libsapi.a
- lib=rtems/librtems.a
+ lib=sparc-rtems4.11/c/leon2/cpukit/score/libscore.a
+ lib=sparc-rtems4.11/c/leon2/cpukit/sapi/libsapi.a
+ lib=sparc-rtems4.11/c/leon2/cpukit/rtems/librtems.a
-- 
1.9.1


>From d6bf24717d188b83059b05e4e2b6f3856fa83b8f Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Tue, 4 Aug 2015 18:20:46 +0200
Subject: [PATCH 14/18] small fixes in html report generator

---
 tester/covoar/ReportsHtml.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tester/covoar/ReportsHtml.cc b/tester/covoar/ReportsHtml.cc
index 80d3a43..247253c 100644
--- a/tester/covoar/ReportsHtml.cc
+++ b/tester/covoar/ReportsHtml.cc
@@ -52,7 +52,7 @@ namespace Coverage {
     #define PRINT_TEXT_ITEM( _t, _n ) \
        fprintf( \
          aFile, \
-         "<li>%s (<a href=\"%s\">text</a>)\n", \
+         "<li>%s (<a href=\"%s\">text</a>)</li>\n", \
         _t, _n );

     FILE*  aFile;
@@ -93,7 +93,7 @@ namespace Coverage {

     fprintf(
       aFile,
-      "</li>\n"
+      "</ul>\n"
       "<!-- INSERT PROJECT SPECIFIC ITEMS HERE -->\n"
       "</html>\n"
     );
-- 
1.9.1


>From 47961f73d4ec991cc722262319fa13b72f67dee3 Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Fri, 28 Aug 2015 18:49:07 +0200
Subject: [PATCH 15/18] Added debug messages to analyze gcov output

---
 rtemstoolkit/macros.py                          |   2 +
 tester/covoar/GcovData.cc                       | 731
++++++++++++------------
 tester/covoar/GcovFunctionData.cc               |   2 +-
 tester/covoar/app_common.h                      |   2 +-
 tester/rt/coverage.py                           |   2 +-
 tester/rt/options.py                            |   2 +
 tester/rt/test.py                               |   4 +
 tester/rtems/testing/bsps/pc386.mc              |   2 +-
 tester/rtems/testing/coverage/symbolSets.config |   4 +-
 9 files changed, 390 insertions(+), 361 deletions(-)

diff --git a/rtemstoolkit/macros.py b/rtemstoolkit/macros.py
index 8db0729..8cbef3f 100644
--- a/rtemstoolkit/macros.py
+++ b/rtemstoolkit/macros.py
@@ -73,6 +73,7 @@ class macros:
             self.read_map_locked = False
             self.write_map = 'global'
             self.rtpath =
path.abspath(path.dirname(inspect.getfile(macros)))
+            print "rtpath " + self.rtpath + "\n"
             if path.dirname(self.rtpath).endswith('/share/rtems'):
                 self.prefix =
path.dirname(self.rtpath)[:-len('/share/rtems')]
             else:
@@ -87,6 +88,7 @@ class macros:
                                                'required',

path.abspath(self.expand(rtdir)))
             self.macros['global']['_rttop'] = ('dir', 'required',
self.prefix)
+            print "prefix: " + str(self.macros['global']['_prefix']) + "\n"
         else:
             self.macros = {}
             for m in original.macros:
diff --git a/tester/covoar/GcovData.cc b/tester/covoar/GcovData.cc
index 6d10337..edaa1bf 100644
--- a/tester/covoar/GcovData.cc
+++ b/tester/covoar/GcovData.cc
@@ -28,7 +28,7 @@ namespace Gcov {

   GcovData::GcovData()
   {
-   numberOfFunctions = 0;
+    numberOfFunctions = 0;
   }

   GcovData::~GcovData()
@@ -43,12 +43,13 @@ namespace Gcov {
     char* tempString2;
     char* tempString3;

+    fprintf(stdout, "filename: %s\n", fileName);
     if ( strlen(fileName) >= FILE_NAME_LENGTH ){
       fprintf(
-        stderr,
-        "ERROR: File name is too long to be correctly stored: %u\n",
-        (unsigned int) strlen(fileName)
-      );
+          stderr,
+          "ERROR: File name is too long to be correctly stored: %u\n",
+          (unsigned int) strlen(fileName)
+          );
       return false;
     }
     strcpy( gcnoFileName, fileName );
@@ -70,23 +71,29 @@ namespace Gcov {
     }

     // Debug message
-    // fprintf( stderr, "Readning file: %s\n",  gcnoFileName);
+    fprintf( stderr, "Readning file: %s\n",  gcnoFileName);

     // Open the notes file.
     gcovFile = fopen( gcnoFileName, "r" );
     if ( !gcovFile ) {
-     fprintf( stderr, "Unable to open %s\n", gcnoFileName );
-     return false;
+      fprintf( stderr, "Unable to open %s\n", gcnoFileName );
+      return false;
     }

     // Read and validate the gcnoPreamble (magic, version, timestamp) from
the file
     status = readFilePreamble( &gcnoPreamble, gcovFile, GCNO_MAGIC );
     if ( status <= 0 ){
-     fprintf( stderr, "Unable to read %s\n", gcnoFileName );
- fclose( gcovFile );
-     return false;
+      fprintf( stderr, "Unable to read %s\n", gcnoFileName );
+      fclose( gcovFile );
+      return false;
+    }
+    else
+    {
+      fprintf( stdout, "Successfully read file preamble for %s.\n",
gcnoFileName);
+      fprintf( stdout, "MAGIC: %u\n", gcnoPreamble.magic );
+      fprintf( stdout, "VERSION: %u\n", gcnoPreamble.version );
+      fprintf( stdout, "TIMESTAMP: %u\n", gcnoPreamble.timestamp );
     }
-
     //Read all remaining frames from file
     while( readFrame(gcovFile) ){}

@@ -97,371 +104,375 @@ namespace Gcov {

   bool GcovData::writeGcdaFile ()
   {
-  gcov_preamble preamble;
-  gcov_frame_header header;
-  FILE* gcdaFile;
-  functions_iterator_t currentFunction;
-  arcs_iterator_t currentArc;
-  uint32_t buffer;
-  uint32_t countersFound;
-  uint32_t countersFoundSum;
-  uint64_t countersSum;
-  uint64_t countersMax;
-  uint64_t llBuffer[4096]; // TODO: Use common buffer
-  gcov_statistics objectStats;
-  gcov_statistics programStats;
-  size_t status;
-
-  // Debug message
-  // fprintf( stderr, "Writing file: %s\n",  gcdaFileName);
-
-  // Lets clear counters sumators
-  countersSum = 0;
-  countersMax = 0;
-  countersFoundSum = 0;
-
-  // Open the data file.
-  gcdaFile = fopen( gcdaFileName, "w" );
-  if ( !gcdaFile ) {
-  fprintf( stderr, "Unable to create %s\n", gcdaFileName );
-  return false;
-  }
-
-  //Form preamble
-  preamble.magic = GCDA_MAGIC;
-  preamble.version = gcnoPreamble.version;
-  preamble.timestamp = gcnoPreamble.timestamp;
-
-  //Write preamble
-  status = fwrite (&preamble , sizeof( preamble ), 1 , gcdaFile );
-  if ( status != 1 )
-            fprintf( stderr, "Error while writing gcda preamble to a file
%s\n", gcdaFileName );
-
-  //Write function info and counter counts
-  for (
-  currentFunction = functions.begin();
-  currentFunction != functions.end();
-  currentFunction++
-  )
-  {
-  //Write function announcement frame header (length always equals 2)
-  header.tag = GCOV_TAG_FUNCTION;
-  header.length = 2;
-  status = fwrite (&header, sizeof(header), 1, gcdaFile );
-          if ( status != 1 )
-                    fprintf( stderr, "Error while writing function
announcement to a file %s\n", gcdaFileName );
-
-  //Write function id
-  buffer = (*currentFunction)->getId();
-  status = fwrite (&buffer, sizeof( buffer ), 1, gcdaFile );
-          if ( status != 1 )
-                    fprintf( stderr, "Error while writing function id to a
file %s\n", gcdaFileName );
-
-  //Write function checksum
-  buffer = (*currentFunction)->getChecksum();
-  status = fwrite (&buffer, sizeof( buffer ), 1, gcdaFile );
-          if ( status != 1 )
-                    fprintf( stderr, "Error while writing function
checksum to a file %s\n", gcdaFileName );
-
-  // Determine how many counters there are
-  // and store their counts in buffer
-  countersFound = 0;
-  (*currentFunction)->getCounters( llBuffer, countersFound, countersSum,
countersMax );
-  countersFoundSum += countersFound;
-
-  //Write info about counters
-  header.tag = GCOV_TAG_COUNTER;
-  header.length = countersFound * 2;
-  status = fwrite (&header, sizeof( header ), 1, gcdaFile );
-          if ( status != 1 )
-                    fprintf( stderr, "Error while writing counter header
to a file %s\n", gcdaFileName );
-
-  status = fwrite (llBuffer, sizeof( uint64_t ), countersFound , gcdaFile
);
-          if ( status != countersFound )
-                    fprintf( stderr, "Error while writing counter data to
a file %s\n", gcdaFileName );
-  }
-
-  // Prepare frame with object file statistics
-  header.tag = GCOV_TAG_OBJECT_SUMMARY;
-  header.length = 9;
-  objectStats.checksum = 0; // TODO: have no idea hov to calculates it :)
-  objectStats.counters = countersFoundSum;
-  objectStats.runs = 1; // We are lying for now, we have no means of
figuring this out
-  objectStats.sum = countersSum; // Sum of all counters
-  objectStats.max = countersMax; // max value for counter on last run, we
have no clue
-  objectStats.sumMax = countersMax; // we have no clue
-
-  // Write data
-  status = fwrite (&header, sizeof( header ), 1, gcdaFile );
-  if ( status != 1 )
-            fprintf( stderr, "Error while writing stats header to a file
%s\n", gcdaFileName );
-  status = fwrite (&objectStats, sizeof( objectStats ), 1, gcdaFile );
-  if ( status != 1 )
-            fprintf( stderr, "Error while writing object stats to a file
%s\n", gcdaFileName );
-
-
-  // Prepare frame with program statistics
-  header.tag = GCOV_TAG_PROGRAM_SUMMARY;
-  header.length = 9;
-  programStats.checksum = 0; // TODO: have no idea hov to calculate it :)
-  programStats.counters = countersFoundSum;
-  programStats.runs = 1; // We are lying for now, we have no clue
-  programStats.sum = countersSum; // Sum of all counters
-  programStats.max = countersMax; // max value for counter on last run, we
have no clue
-  programStats.sumMax = countersMax; // we have no clue
-
-  // Write data
-  status = fwrite (&header, sizeof( header ), 1, gcdaFile );
-  if ( status != 1 )
-            fprintf( stderr, "Error while writing stats header to a file
%s\n", gcdaFileName );
-  status = fwrite (&programStats, sizeof( programStats ), 1, gcdaFile );
-  if ( status != 1 )
-            fprintf( stderr, "Error while writing program stats to a file
%s\n", gcdaFileName );
-
-  fclose( gcdaFile );
-
-  return true;
+    gcov_preamble preamble;
+    gcov_frame_header header;
+    FILE* gcdaFile;
+    functions_iterator_t currentFunction;
+    arcs_iterator_t currentArc;
+    uint32_t buffer;
+    uint32_t countersFound;
+    uint32_t countersFoundSum;
+    uint64_t countersSum;
+    uint64_t countersMax;
+    uint64_t llBuffer[4096]; // TODO: Use common buffer
+    gcov_statistics objectStats;
+    gcov_statistics programStats;
+    size_t status;
+
+    // Debug message
+    // fprintf( stderr, "Writing file: %s\n",  gcdaFileName);
+
+    // Lets clear counters sumators
+    countersSum = 0;
+    countersMax = 0;
+    countersFoundSum = 0;
+
+    // Open the data file.
+    gcdaFile = fopen( gcdaFileName, "w" );
+    if ( !gcdaFile ) {
+      fprintf( stderr, "Unable to create %s\n", gcdaFileName );
+      return false;
+    }
+
+    //Form preamble
+    preamble.magic = GCDA_MAGIC;
+    preamble.version = gcnoPreamble.version;
+    preamble.timestamp = gcnoPreamble.timestamp;
+
+    //Write preamble
+    status = fwrite (&preamble , sizeof( preamble ), 1 , gcdaFile );
+    if ( status != 1 )
+      fprintf( stderr, "Error while writing gcda preamble to a file %s\n",
gcdaFileName );
+
+    //Write function info and counter counts
+    for (
+        currentFunction = functions.begin();
+        currentFunction != functions.end();
+        currentFunction++
+        )
+    {
+      //Write function announcement frame header (length always equals 2)
+      header.tag = GCOV_TAG_FUNCTION;
+      header.length = 2;
+      status = fwrite (&header, sizeof(header), 1, gcdaFile );
+      if ( status != 1 )
+        fprintf( stderr, "Error while writing function announcement to a
file %s\n", gcdaFileName );
+
+      //Write function id
+      buffer = (*currentFunction)->getId();
+      status = fwrite (&buffer, sizeof( buffer ), 1, gcdaFile );
+      if ( status != 1 )
+        fprintf( stderr, "Error while writing function id to a file %s\n",
gcdaFileName );
+
+      //Write function checksum
+      buffer = (*currentFunction)->getChecksum();
+      status = fwrite (&buffer, sizeof( buffer ), 1, gcdaFile );
+      if ( status != 1 )
+        fprintf( stderr, "Error while writing function checksum to a file
%s\n", gcdaFileName );
+
+      // Determine how many counters there are
+      // and store their counts in buffer
+      countersFound = 0;
+      (*currentFunction)->getCounters( llBuffer, countersFound,
countersSum, countersMax );
+      countersFoundSum += countersFound;
+
+      //Write info about counters
+      header.tag = GCOV_TAG_COUNTER;
+      header.length = countersFound * 2;
+      status = fwrite (&header, sizeof( header ), 1, gcdaFile );
+      if ( status != 1 )
+        fprintf( stderr, "Error while writing counter header to a file
%s\n", gcdaFileName );
+
+      status = fwrite (llBuffer, sizeof( uint64_t ), countersFound ,
gcdaFile );
+      if ( status != countersFound )
+        fprintf( stderr, "Error while writing counter data to a file
%s\n", gcdaFileName );
+    }
+
+    // Prepare frame with object file statistics
+    header.tag = GCOV_TAG_OBJECT_SUMMARY;
+    header.length = 9;
+    objectStats.checksum = 0; // TODO: have no idea hov to calculates it :)
+    objectStats.counters = countersFoundSum;
+    objectStats.runs = 1; // We are lying for now, we have no means of
figuring this out
+    objectStats.sum = countersSum; // Sum of all counters
+    objectStats.max = countersMax; // max value for counter on last run,
we have no clue
+    objectStats.sumMax = countersMax; // we have no clue
+
+    // Write data
+    status = fwrite (&header, sizeof( header ), 1, gcdaFile );
+    if ( status != 1 )
+      fprintf( stderr, "Error while writing stats header to a file %s\n",
gcdaFileName );
+    status = fwrite (&objectStats, sizeof( objectStats ), 1, gcdaFile );
+    if ( status != 1 )
+      fprintf( stderr, "Error while writing object stats to a file %s\n",
gcdaFileName );
+
+
+    // Prepare frame with program statistics
+    header.tag = GCOV_TAG_PROGRAM_SUMMARY;
+    header.length = 9;
+    programStats.checksum = 0; // TODO: have no idea hov to calculate it :)
+    programStats.counters = countersFoundSum;
+    programStats.runs = 1; // We are lying for now, we have no clue
+    programStats.sum = countersSum; // Sum of all counters
+    programStats.max = countersMax; // max value for counter on last run,
we have no clue
+    programStats.sumMax = countersMax; // we have no clue
+
+    // Write data
+    status = fwrite (&header, sizeof( header ), 1, gcdaFile );
+    if ( status != 1 )
+      fprintf( stderr, "Error while writing stats header to a file %s\n",
gcdaFileName );
+    status = fwrite (&programStats, sizeof( programStats ), 1, gcdaFile );
+    if ( status != 1 )
+      fprintf( stderr, "Error while writing program stats to a file %s\n",
gcdaFileName );
+
+    fclose( gcdaFile );
+
+    return true;
   }

   bool GcovData::readFrame(
-       FILE*         gcovFile
-   )
+      FILE*         gcovFile
+      )
   {
-    gcov_frame_header header;
-    char buffer[512];
-    uint32_t            intBuffer[4096];
-    uint32_t            tempBlockId;
-    blocks_iterator_t tempBlockIterator;
-    int                 status;
-    GcovFunctionData* newFunction;
-
-    status = readFrameHeader( &header, gcovFile);
-
-    if ( status <= 0 ){
-                // Not printing error message because this
- // happenns at the end of each file
-     return false;
-    }
-
-    switch (header.tag){
-
- case GCOV_TAG_FUNCTION:
-
- numberOfFunctions++;
- newFunction = new GcovFunctionData;
- if ( !readFunctionFrame(header, gcovFile, newFunction) ){
- fprintf( stderr, "Error while reading FUNCTION from gcov file...\n" );
- return false;
- }
- functions.push_back(newFunction);
- break;
-
- case GCOV_TAG_BLOCKS:
-
- status = fread( &intBuffer, 4, header.length, gcovFile );
- if ( status != (int) header.length){
- fprintf(
- stderr, "Error while reading BLOCKS from gcov file...\n"
- "Header lenght is %u instead of %u\n",
- header.length,
- status
- );
- return false;
- }
-
- for( uint32_t i = 0; i < header.length; i++ )
- functions.back()->addBlock(i, intBuffer[i], "");
-
- break;
-
- case GCOV_TAG_ARCS:
-
- status = fread( &intBuffer, 4, header.length, gcovFile );
- if (status != (int) header.length){
- return false;
- }
-
- for ( int i = 1; i < (int) header.length; i += 2 )
- functions.back()->addArc(intBuffer[0], intBuffer[i], intBuffer[i+1]);
-
- break;
-
- case GCOV_TAG_LINES:
-
- status = fread( &intBuffer, 4, 2, gcovFile );
- if (status != 2 || intBuffer[1] != 0){
- fprintf(
- stderr,
- "Error while reading block id for LINES from gcov file..."
- );
- return false;
- }
- tempBlockId = intBuffer[0];
- header.length -= 2;
-
- // Find the right block
- tempBlockIterator =functions.back()->findBlockById(tempBlockId);
-
- header.length -= readString(buffer, gcovFile);
- functions.back()->setBlockFileName( tempBlockIterator, buffer );
-
- status = fread( &intBuffer, 4, header.length, gcovFile );
- if (status != (int) header.length){
- fprintf( stderr, "Error while reading LINES from gcov file..." );
- return false;
- }
-
- else
- for (int i = 0; i < (int) (header.length - 2); i++)
- functions.back()->addBlockLine( tempBlockIterator, intBuffer[i] );
-
- break;
-
- default:
-
- fprintf( stderr, "\n\nERROR - encountered unknown *.gcno tag : 0x%x\n",
header.tag );
- break;
-    }
-
-    return true;
+    gcov_frame_header header;
+    char buffer[512];
+    uint32_t            intBuffer[4096];
+    uint32_t            tempBlockId;
+    blocks_iterator_t tempBlockIterator;
+    int                 status;
+    GcovFunctionData* newFunction;
+
+    status = readFrameHeader( &header, gcovFile);
+
+    if ( status <= 0 ){
+      // Not printing error message because this
+      // happenns at the end of each file
+      return false;
+    }
+
+    switch (header.tag){
+      case GCOV_TAG_FUNCTION:
+        fprintf( stderr, "gcno header tag: GCOV_TAG_FUNCTION\n");
+        numberOfFunctions++;
+        newFunction = new GcovFunctionData;
+        if ( !readFunctionFrame(header, gcovFile, newFunction) ){
+          fprintf( stderr, "Error while reading FUNCTION from gcov
file...\n" );
+          return false;
+        }
+        functions.push_back(newFunction);
+        break;
+
+      case GCOV_TAG_BLOCKS:
+        fprintf( stderr, "gcno header tag: GCOV_TAG_BLOCKS\n");
+        status = fread( &intBuffer, 4, header.length, gcovFile );
+        if ( status != (int) header.length){
+          fprintf(
+              stderr, "Error while reading BLOCKS from gcov file...\n"
+              "Header lenght is %u instead of %u\n",
+              header.length,
+              status
+              );
+          return false;
+        }
+
+        for( uint32_t i = 0; i < header.length; i++ )
+          functions.back()->addBlock(i, intBuffer[i], "");
+        break;
+
+      case GCOV_TAG_ARCS:
+        fprintf( stderr, "gcno header tag: GCOV_TAG_ARCS\n");
+        status = fread( &intBuffer, 4, header.length, gcovFile );
+        if (status != (int) header.length){
+          return false;
+        }
+
+        for ( int i = 1; i < (int) header.length; i += 2 )
+          functions.back()->addArc(intBuffer[0], intBuffer[i],
intBuffer[i+1]);
+        break;
+
+      case GCOV_TAG_LINES:
+        fprintf( stderr, "gcno header tag: GCOV_TAG_LINES\n");
+        status = fread( &intBuffer, 4, 2, gcovFile );
+        if (status != 2 || intBuffer[1] != 0){
+          fprintf(
+              stderr,
+              "Error while reading block id for LINES from gcov file..."
+              );
+          return false;
+        }
+        tempBlockId = intBuffer[0];
+        header.length -= 2;
+
+        // Find the right block
+        tempBlockIterator =functions.back()->findBlockById(tempBlockId);
+
+        header.length -= readString(buffer, gcovFile);
+        functions.back()->setBlockFileName( tempBlockIterator, buffer );
+
+        status = fread( &intBuffer, 4, header.length, gcovFile );
+        fprintf ( stdout, "status: %d - header.length: %u - (int)
header.length %d \n", status, header.length, (int) header.length);
+        if (status != (int) header.length){
+          fprintf( stderr, "Error while reading LINES from gcov file..." );
+          return false;
+        }
+
+        else
+          for (int i = 0; i < (int) (header.length - 2); i++)
+            functions.back()->addBlockLine( tempBlockIterator,
intBuffer[i] );
+
+        break;
+
+      default:
+        fprintf( stderr, "\n\nERROR - encountered unknown *.gcno tag :
0x%x\n", header.tag );
+        break;
+    }
+
+    return true;
   }

   int GcovData::readString(
-   char* buffer,   //TODO: use global buffer here
-       FILE*         gcovFile
-  )
+      char* buffer,   //TODO: use global buffer here
+      FILE*         gcovFile
+      )
   {
-    int status;
-    int length;
-
-    status = fread( &length, sizeof(int), 1, gcovFile );
-    if (status != 1){
-              fprintf( stderr, "ERROR: Unable to read string length from
gcov file\n" );
-      return -1;
-            }
+    int status;
+    uint32_t length;
+
+    status = fread( &length, sizeof(uint32_t), 1, gcovFile );
+    fprintf( stdout, "size of read bytes: %u\n", length);
+    if (status != 1){
+      fprintf( stderr, "ERROR: Unable to read string length from gcov
file\n" );
+      return -1;
+    }

-    status = fread( buffer, length * 4 , 1, gcovFile );
-    if (status != 1){
-              fprintf( stderr, "ERROR: Unable to read string from gcov
file\n" );
-      return -1;
-            }
+    status = fread( buffer, length * 4 , 1, gcovFile );
+    if (status != 1){
+      fprintf( stderr, "ERROR: Unable to read string from gcov file\n" );
+      return -1;
+    }

-    buffer[length * 4] = '\0';
+    buffer[length * 4] = '\0';

-    return length +1;
+    return length +1;
   }

   int GcovData::readFrameHeader(
-       gcov_frame_header* header,
-       FILE*         gcovFile
-   )
+      gcov_frame_header* header,
+      FILE*         gcovFile
+      )
   {
-    int status;
-    int length;
-
-    length = sizeof(gcov_frame_header);
-    status = fread( header, length, 1, gcovFile );
-    if (status != 1){
- //fprintf( stderr, "ERROR: Unable to read frame header from gcov file\n"
);
-     return -1;
-    }
+    int status;
+    int     length;
+
+    length = sizeof(gcov_frame_header);
+    status = fread( header, length, 1, gcovFile );
+    if (status != 1){
+      fprintf( stderr, "ERROR: Unable to read frame header from gcov
file\n" );
+      return -1;
+    }

-    return length / 4;
+    fprintf( stdout, "Succesfully read frame header with \n \
+        TAG: %u\n \
+        LENGTH: %u \n", header->tag, header->length);
+      return length / 4; // Why x/4 ?
   }

   int GcovData::readFilePreamble(
-     gcov_preamble*    preamble,
-   FILE*         gcovFile,
-   uint32_t desiredMagic
-  )
+      gcov_preamble*    preamble,
+      FILE*         gcovFile,
+      uint32_t desiredMagic
+      )
   {
-    int status;
-    int length;
-
-    length = sizeof( gcov_preamble );
-    status = fread( preamble, sizeof( gcov_preamble), 1, gcovFile );
-    if (status <= 0) {
-      fprintf( stderr, "Error while reading file preamble\n" );
-      return -1;
-    }
-
-    if ( preamble->magic != GCNO_MAGIC ) {
-      fprintf( stderr, "File is not a valid *.gcno output (magic:
0x%4x)\n", preamble->magic );
-      return -1;
-    }
-
-    return length / 4;
+    int status;
+    int length;
+
+    length = sizeof( gcov_preamble );
+    status = fread( preamble, sizeof( gcov_preamble), 1, gcovFile );
+    if (status <= 0) {
+      fprintf( stderr, "Error while reading file preamble\n" );
+      return -1;
+    }
+
+    if ( preamble->magic != GCNO_MAGIC ) {
+      fprintf( stderr, "File is not a valid *.gcno output (magic:
0x%4x)\n", preamble->magic );
+      return -1;
+    }
+
+    return length / 4;
   }

   bool GcovData::readFunctionFrame(
-   gcov_frame_header header,
-   FILE*         gcovFile,
-   GcovFunctionData* function
-  )
+      gcov_frame_header header,
+      FILE*         gcovFile,
+      GcovFunctionData* function
+      )
   {
-  char    buffer[512]; //TODO: use common buffers
-  uint32_t          intBuffer[4096];
-  int               status;
-
-  status = fread( &intBuffer, 8, 1, gcovFile );
-  if (status != 1){
- fprintf( stderr, "ERROR: Unable to read Function ID & checksum\n" );
-   return false;
-  }
-  header.length -= 2;
-  function->setId( intBuffer[0] );
-  function->setChecksum( intBuffer[1] );
-
-  header.length -= readString( buffer, gcovFile );
-  function->setFunctionName( buffer );
-  header.length -= readString( buffer, gcovFile );
-  function->setFileName( buffer );
-  status = fread( &intBuffer, 4, header.length, gcovFile );
-  if (status <= 0){
- fprintf( stderr, "ERROR: Unable to read Function starting line number\n"
);
-   return false;
-  }
-  function->setFirstLineNumber( intBuffer[0] );
-
-  return true;
+    char    buffer[512]; //TODO: use common buffers
+    uint32_t          intBuffer[4096];
+    int               status;
+
+    status = fread( &intBuffer, 12, 1, gcovFile );
+    if (status != 1){
+      fprintf( stderr, "ERROR: Unable to read Function ID & checksum\n" );
+      return false;
+    }
+    header.length -= 2;
+    function->setId( intBuffer[0] );
+    function->setChecksum( intBuffer[1] );
+
+    header.length -= readString( buffer, gcovFile );
+    function->setFunctionName( buffer );
+    fprintf( stdout, "FunctionName: %s - in readFunctionName\n", buffer );
+    header.length -= readString( buffer, gcovFile );
+    function->setFileName( buffer );
+    fprintf( stdout, "Filename: %s - in readFunctionName\n", buffer );
+    //status = fread( &intBuffer, 4, header.length, gcovFile );
+    status = fread( &intBuffer, 4, 1, gcovFile );
+    if (status <= 0){
+      fprintf( stderr, "ERROR: Unable to read Function starting line
number\n" );
+      return false;
+    }
+    function->setFirstLineNumber( intBuffer[0] );
+
+    return true;
   }

   bool GcovData::writeReportFile()
   {
-  functions_iterator_t currentFunction;
-  uint32_t i = 1; //iterator
-  FILE* textFile;
-
-  // Debug message
-  // fprintf( stderr, "Writing file: %s\n",  textFileName);
-
-        // Open the data file.
-        textFile = fopen( textFileName, "w" );
- if ( !textFile ) {
-  fprintf( stderr, "Unable to create %s\n", textFileName );
-  return false;
- }
-
- printGcnoFileInfo( textFile );
-
- for (
- currentFunction = functions.begin();
- currentFunction != functions.end();
- currentFunction++
- )
- {
- (*currentFunction)->printFunctionInfo( textFile, i );
-                (*currentFunction)->printCoverageInfo( textFile, i );
- i++;
- }
-
- fclose ( textFile );
- return true;
+    functions_iterator_t currentFunction;
+    uint32_t i = 1; //iterator
+    FILE* textFile;
+
+    // Debug message
+    // fprintf( stderr, "Writing file: %s\n",  textFileName);
+
+    // Open the data file.
+    textFile = fopen( textFileName, "w" );
+    if ( !textFile ) {
+      fprintf( stderr, "Unable to create %s\n", textFileName );
+      return false;
+    }
+
+    printGcnoFileInfo( textFile );
+
+    for (
+        currentFunction = functions.begin();
+        currentFunction != functions.end();
+        currentFunction++
+        )
+    {
+      (*currentFunction)->printFunctionInfo( textFile, i );
+      (*currentFunction)->printCoverageInfo( textFile, i );
+      i++;
+    }
+
+    fclose ( textFile );
+    return true;
   }

   void GcovData::printGcnoFileInfo( FILE * textFile )
   {
-      fprintf(
+    fprintf(
         textFile,
         "\nFILE:\t\t\t%s\n"
         "magic:\t\t\t%x\n"
@@ -473,19 +484,31 @@ namespace Gcov {
         gcnoPreamble.version,
         gcnoPreamble.timestamp,
         numberOfFunctions
-      );
+        );
   }

   void GcovData::writeGcovFile( )
   {
     char        path[512];
     char        command[512];
-
-    //fprintf (stderr, "Attempting to run gcov for: %s\n", cFileName );
+    char        source_file_name[512];
+    fprintf (stderr, "Attempting to run gcov for: %s\n", cFileName );
     strcpy( path, cFileName );
     dirname( path );
-    sprintf( command, "( cd %s && gcov %s &>> gcov.log)", path, basename(
cFileName ) );
-    //fprintf (stderr, "> %s\n", command );
+    char* target_file_name = basename( cFileName );
+
+    //if ( strstr( path, "rtems") )
+    //{
+    //  strncpy(source_file_name, target_file_name + 11,
strlen(target_file_name) - 11);
+    //  sprintf( command, "cp
/home/hf/development/rtems/src/rtems/cpukit/%s/src/%s
/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/src/%s",
"rtems", source_file_name, target_file_name);
+    //}
+
+    fprintf (stderr, "> %s\n", command );
+    system( command );
+    memset(&command, 0, sizeof(command));
+
+    sprintf( command, "( cd %s && gcov %s &>> gcov.log)", path,
target_file_name);
+    fprintf (stderr, "> %s\n", command );
     system( command );
   }

@@ -494,10 +517,10 @@ namespace Gcov {
     functions_iterator_t currentFunction;
     bool status = true;
     for (
-      currentFunction = functions.begin();
-      currentFunction != functions.end();
-      currentFunction++
-    )
+        currentFunction = functions.begin();
+        currentFunction != functions.end();
+        currentFunction++
+        )
     {
       if ( !(*currentFunction)->processFunctionCounters(  ) )
         status = false;
diff --git a/tester/covoar/GcovFunctionData.cc
b/tester/covoar/GcovFunctionData.cc
index f746b12..e432d1e 100644
--- a/tester/covoar/GcovFunctionData.cc
+++ b/tester/covoar/GcovFunctionData.cc
@@ -67,7 +67,7 @@ namespace Gcov {
     if ( symbolInfo != NULL )
       coverageMap = symbolInfo->unifiedCoverageMap;

-#if 0
+#if 1
     if ( coverageMap == NULL) {
       fprintf(
         stderr,
diff --git a/tester/covoar/app_common.h b/tester/covoar/app_common.h
index d28bfd0..b8f8605 100644
--- a/tester/covoar/app_common.h
+++ b/tester/covoar/app_common.h
@@ -17,7 +17,7 @@ extern Target::TargetBase*          TargetInfo;
 extern const char*                  dynamicLibrary;
 extern const char*                  projectName;

-#define MAX_LINE_LENGTH             512
+#define MAX_LINE_LENGTH             2048
 extern char                         inputBuffer[MAX_LINE_LENGTH];
 extern char                         inputBuffer2[MAX_LINE_LENGTH];

diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index 32195cf..e250661 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -261,7 +261,7 @@ class covoar(object):
             log.stderr("Skipping " + setName)
             return

-        command = "covoar -C" + covoarConfigFile + " -S " + symbolFile + "
-O " + covoarResultDir + " " + path.join(self.tracesDir, "*.exe")
+        command = "covoar -v -C" + covoarConfigFile + " -S " + symbolFile
+ " -O " + covoarResultDir + " " + path.join(self.tracesDir, "*.exe")
         log.notice("Running covoar for " + setName, stdout_only=True)
         log.notice(command, stdout_only=True)
         executor = execute.execute(verbose=True, output=output_handler)
diff --git a/tester/rt/options.py b/tester/rt/options.py
index ff4ea60..8d5ad01 100644
--- a/tester/rt/options.py
+++ b/tester/rt/options.py
@@ -98,6 +98,8 @@ def load(args, optargs = None,
     # The command line contains the base defaults object all build objects
copy
     # and modify by loading a configuration.
     #
+    log.stderr('rtdir: ')
+    print 'rtdir: ' + rtdir + '\n'
     opts = command_line(args,
                         optargs,
                         macros.macros(name = defaults, rtdir = rtdir),
diff --git a/tester/rt/test.py b/tester/rt/test.py
index cbe7332..57af018 100644
--- a/tester/rt/test.py
+++ b/tester/rt/test.py
@@ -222,6 +222,8 @@ def run(command_path = None):
         job_trace = 'jobs' in debug_trace.split(',')
         rtems_tools = opts.find_arg('--rtems-tools')
         if rtems_tools:
+            bla = '%{_prefix}'
+            print "prefixx: " + bla
             if len(rtems_tools) != 2:
                 raise error.general('invalid RTEMS tools option')
             rtems_tools = rtems_tools[1]
@@ -326,6 +328,8 @@ def run(command_path = None):
         if coverage_enabled:
             coverage.config_map = opts.defaults.macros['coverage']
             coverage.executables = executables
+            print [c for c in coverage.config_map]
+            print [e for e in executables]
             coverage.run()

     except error.general, gerr:
diff --git a/tester/rtems/testing/bsps/pc386.mc b/tester/rtems/testing/bsps/
pc386.mc
index 52ed275..2627aeb 100644
--- a/tester/rtems/testing/bsps/pc386.mc
+++ b/tester/rtems/testing/bsps/pc386.mc
@@ -61,6 +61,6 @@ format:                none,    none,     'QEMU'
 target:                none,    none,     'i386-rtems4.11'
 explanations:            none,    none,
'%{_rtscripts}/coverage/Explanations.txt'
 coverageExtension:      none,    none,     'exe.cov'
-gcnosFile:              none,    none,
'%{_rtscripts}/coverage/rtems.gcnos'
+gcnosFile:              none,    none,     '/home/hf/tmp/rtems.gcnos'
 executableExtension:    none,    none,     'exe'
 projectName:            none,    none,     'RTEMS 4.11'
diff --git a/tester/rtems/testing/coverage/symbolSets.config
b/tester/rtems/testing/coverage/symbolSets.config
index 4b90fc7..0490287 100644
--- a/tester/rtems/testing/coverage/symbolSets.config
+++ b/tester/rtems/testing/coverage/symbolSets.config
@@ -1,5 +1,3 @@
 symbolset:
  name=core
- lib=sparc-rtems4.11/c/leon2/cpukit/score/libscore.a
- lib=sparc-rtems4.11/c/leon2/cpukit/sapi/libsapi.a
- lib=sparc-rtems4.11/c/leon2/cpukit/rtems/librtems.a
+ lib=i386-rtems4.11/c/pc386/cpukit/score/libscore.a
-- 
1.9.1


>From 0b68934579425a7b99cb372b0155bb25cb863a55 Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Mon, 21 Sep 2015 13:37:32 +0200
Subject: [PATCH 16/18] remove absolute paths from gcnos file

---
 tester/covoar/GcovData.cc                   |  6 +++---
 tester/rt/coverage.py                       | 22 +++++++++++++++++++---
 tester/rtems/testing/bsps/leon2-coverage.mc |  2 +-
 tester/rtems/testing/bsps/leon3-coverage.mc |  2 +-
 tester/rtems/testing/bsps/pc386.mc          |  2 +-
 5 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/tester/covoar/GcovData.cc b/tester/covoar/GcovData.cc
index edaa1bf..8dda3e2 100644
--- a/tester/covoar/GcovData.cc
+++ b/tester/covoar/GcovData.cc
@@ -503,9 +503,9 @@ namespace Gcov {
     //  sprintf( command, "cp
/home/hf/development/rtems/src/rtems/cpukit/%s/src/%s
/home/hf/development/rtems/b-pc386/i386-rtems4.11/c/pc386/cpukit/rtems/src/%s",
"rtems", source_file_name, target_file_name);
     //}

-    fprintf (stderr, "> %s\n", command );
-    system( command );
-    memset(&command, 0, sizeof(command));
+    //fprintf (stderr, "> %s\n", command );
+    //system( command );
+    //memset(&command, 0, sizeof(command));

     sprintf( command, "( cd %s && gcov %s &>> gcov.log)", path,
target_file_name);
     fprintf (stderr, "> %s\n", command );
diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index e250661..b2242f7 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -239,6 +239,14 @@ class symbolSet(object):
             f.write("\t lib=" + lib + '\n')
         f.close()

+class gcnos(object):
+    def create_gcnos_file(self, gcnos_config_file_path, gcnos_file_path,
path_to_build_dir):
+        with open(gcnos_file_path, 'w') as gcnos_file:
+            with open(gcnos_config_file_path, 'r') as config_file:
+                for line in config_file:
+                    if line.strip():
+                        gcnos_file.write(path.join(path_to_build_dir,
line))
+
 class covoar(object):
     '''
     Covoar runner
@@ -250,7 +258,7 @@ class covoar(object):
         self.tracesDir = tracesDir
         self.covoarSrcDir = covoarSrcDir

-    def run(self, setName, covoarConfigFile, symbolFile):
+    def run(self, setName, covoarConfigFile, symbolFile, gcnos_file):
         covoarResultDir = path.join(self.baseResultDir, setName)

         if (not path.exists(covoarResultDir)):
@@ -262,6 +270,8 @@ class covoar(object):
             return

         command = "covoar -v -C" + covoarConfigFile + " -S " + symbolFile
+ " -O " + covoarResultDir + " " + path.join(self.tracesDir, "*.exe")
+        if (path.exists(gcnos_file)):
+            command = command + " -g " + gcnos_file
         log.notice("Running covoar for " + setName, stdout_only=True)
         log.notice(command, stdout_only=True)
         executor = execute.execute(verbose=True, output=output_handler)
@@ -298,6 +308,7 @@ class coverage_run(object):
         self.executables = None
         self.symbolSets = []
         self.path_to_builddir= path_to_builddir
+        self.gcnos_file_path = path.join(self.coverageConfigPath,
"rtems.gcnos")

     def prepareEnvironment(self):
         if(path.exists(self.tracesDir)):
@@ -311,7 +322,7 @@ class coverage_run(object):
         ccf.write("target = " + self.config_map['target'][2] + '\n')
         ccf.write("explanations = " +
self.macros.expand(self.config_map['explanations'][2]) + '\n')
         ccf.write("coverageExtension = " +
self.config_map['coverageextension'][2] + '\n')
-        ccf.write("gcnosFile = " +
self.macros.expand(self.config_map['gcnosfile'][2]) + '\n')
+        #ccf.write("gcnosFile = " +
self.macros.expand(self.config_map['gcnosfile'][2]) + '\n')
         ccf.write("executableExtension = " +
self.config_map['executableextension'][2] + '\n')
         ccf.write("projectName = " + self.config_map['projectname'][2] +
'\n')
         ccf.close()
@@ -334,6 +345,11 @@ class coverage_run(object):

         symbolConfig = symbolsConfiguration()
         symbolConfig.load(self.symbolConfigPath, self.path_to_builddir)
+        # create gcnosConfiguration
+        # load paths to gcno files, join paths with path_to_builddir
+        # write gcnos file to traces dir
+        gcnos_file = path.join(self.tracesDir, "rtems.gcnos")
+        gcnos().create_gcnos_file(self.gcnos_file_path, gcnos_file,
self.path_to_builddir)

         for sset in symbolConfig.symbolSets:
             if sset.isValid():
@@ -342,7 +358,7 @@ class coverage_run(object):
                 self.symbolSets.append(sset.name)

                 covoar_run = covoar(self.testDir, self.symbolConfigPath,
self.tracesDir, path.join(self.rtdir, 'covoar'))
-                covoar_run.run(sset.name, covoarConfigFile, symbolSetFile)
+                covoar_run.run(sset.name, covoarConfigFile, symbolSetFile,
gcnos_file)
             else:
                 log.stderr("Invalid symbol set " + sset.name + ". Skipping
covoar run.")

diff --git a/tester/rtems/testing/bsps/leon2-coverage.mc
b/tester/rtems/testing/bsps/leon2-coverage.mc
index bd552bd..660301d 100644
--- a/tester/rtems/testing/bsps/leon2-coverage.mc
+++ b/tester/rtems/testing/bsps/leon2-coverage.mc
@@ -59,6 +59,6 @@ format:                none,    none,     'QEMU'
 target:                none,    none,     'sparc-rtems4.11'
 explanations:            none,    none,
'%{_rtscripts}/coverage/Explanations.txt'
 coverageExtension:      none,    none,     'exe.cov'
-gcnosFile:              none,    none,
'%{_rtscripts}/coverage/rtems.gcnos'
+# gcnosFile:              none,    none,
'%{_rtscripts}/coverage/rtems.gcnos'
 executableExtension:    none,    none,     'exe'
 projectName:            none,    none,     'RTEMS 4.11'
diff --git a/tester/rtems/testing/bsps/leon3-coverage.mc
b/tester/rtems/testing/bsps/leon3-coverage.mc
index ae25268..a64cd1c 100644
--- a/tester/rtems/testing/bsps/leon3-coverage.mc
+++ b/tester/rtems/testing/bsps/leon3-coverage.mc
@@ -59,6 +59,6 @@ format:                none,    none,     'QEMU'
 target:                none,    none,     'sparc-rtems4.11'
 explanations:            none,    none,
'%{_rtscripts}/coverage/Explanations.txt'
 coverageExtension:      none,    none,     'exe.cov'
-gcnosFile:              none,    none,
'%{_rtscripts}/coverage/rtems.gcnos'
+# gcnosFile:              none,    none,
'%{_rtscripts}/coverage/rtems.gcnos'
 executableExtension:    none,    none,     'exe'
 projectName:            none,    none,     'RTEMS 4.11'
diff --git a/tester/rtems/testing/bsps/pc386.mc b/tester/rtems/testing/bsps/
pc386.mc
index 2627aeb..791ac9b 100644
--- a/tester/rtems/testing/bsps/pc386.mc
+++ b/tester/rtems/testing/bsps/pc386.mc
@@ -61,6 +61,6 @@ format:                none,    none,     'QEMU'
 target:                none,    none,     'i386-rtems4.11'
 explanations:            none,    none,
'%{_rtscripts}/coverage/Explanations.txt'
 coverageExtension:      none,    none,     'exe.cov'
-gcnosFile:              none,    none,     '/home/hf/tmp/rtems.gcnos'
+# gcnosFile:              none,    none,
'%{_rtscripts}/coverage/rtems.gcnos'
 executableExtension:    none,    none,     'exe'
 projectName:            none,    none,     'RTEMS 4.11'
-- 
1.9.1


>From 45cdfc800597646940be4e1156a1e7967e63d714 Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Mon, 21 Sep 2015 13:39:36 +0200
Subject: [PATCH 17/18] added rtems.gcnos file which contains the relative
 paths to the gcno files starting from the build directory

---
 tester/rtems/testing/coverage/rtems.gcnos | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 tester/rtems/testing/coverage/rtems.gcnos

diff --git a/tester/rtems/testing/coverage/rtems.gcnos
b/tester/rtems/testing/coverage/rtems.gcnos
new file mode 100644
index 0000000..7223192
--- /dev/null
+++ b/tester/rtems/testing/coverage/rtems.gcnos
@@ -0,0 +1,2 @@
+i386-rtems4.11/c/pc386/cpukit/score/src/libscore_a-timespecsubtract.gcno
+
-- 
1.9.1


>From 1daa55efe2826796d7f944756a740d2729efb6de Mon Sep 17 00:00:00 2001
From: hermann <hermann19829 at gmail.com>
Date: Thu, 24 Sep 2015 12:51:03 +0200
Subject: [PATCH 18/18] added try-catch statement if hardlink to a test case
 exe could not be produced

---
 tester/rt/coverage.py                           |  6 +++++-
 tester/rtems/testing/coverage/symbolSets.config | 26
++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index b2242f7..0855801 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -371,7 +371,11 @@ class coverage_run(object):

         for exe in self.executables:
             dst = path.join(self.tracesDir, path.basename(exe))
-            os.link(exe, dst)
+            try:
+                os.link(exe, dst)
+            except OSError, e:
+                log.stderr("creating hardlink from " + path.abspath(exe) +
" to " + dst + " failed!")
+                raise
         log.notice("Symlinks made")

     def _generateReports(self):
diff --git a/tester/rtems/testing/coverage/symbolSets.config
b/tester/rtems/testing/coverage/symbolSets.config
index 0490287..b91f5c0 100644
--- a/tester/rtems/testing/coverage/symbolSets.config
+++ b/tester/rtems/testing/coverage/symbolSets.config
@@ -1,3 +1,27 @@
 symbolset:
  name=core
- lib=i386-rtems4.11/c/pc386/cpukit/score/libscore.a
+ lib=sparc-rtems4.11/c/leon2/cpukit/score/libscore.a
+ lib=sparc-rtems4.11/c/leon2/cpukit/sapi/libsapi.a
+ lib=sparc-rtems4.11/c/leon2/cpukit/rtems/librtems.a
+symbolset:
+ name=score
+ lib=sparc-rtems4.11/c/leon2/cpukit/score/libscore.a
+symbolset:
+ name=sapi
+ lib=sparc-rtems4.11/c/leon2/cpukit/sapi/libsapi.a
+symbolset:
+ name=rtems
+ lib=sparc-rtems4.11/c/leon2/cpukit/rtems/librtems.a
+symbolset:
+ name=libmisc
+ lib=sparc-rtems4.11/c/leon2/cpukit/libmisc/libstackchk.a
+ lib=sparc-rtems4.11/c/leon2/cpukit/libmisc/libfsmount.a
+ lib=sparc-rtems4.11/c/leon2/cpukit/libmisc/libbspcmdline.a
+ lib=sparc-rtems4.11/c/leon2/cpukit/libmisc/libcpuuse.a
+ lib=sparc-rtems4.11/c/leon2/cpukit/libmisc/libfsmount.a
+ lib=sparc-rtems4.11/c/leon2/cpukit/libmisc/libstringto.a
+ lib=sparc-rtems4.11/c/leon2/cpukit/libmisc/libdevnull.a
+ lib=sparc-rtems4.11/c/leon2/cpukit/libmisc/libdumpbuf.a
+symbolset:
+ name=libblock
+ lib=sparc-rtems4.11/c/leon2/cpukit/libblock/libblock.a
-- 
1.9.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20151108/6e24e5ac/attachment-0001.html>


More information about the devel mailing list