From 4e2d9310b835f605fd89777797a6c30611553026 Mon Sep 17 00:00:00 2001
From: hermann <hermann19...@gmail.com>
Date: Tue, 4 Aug 2015 17:16:00 +0200
Subject: [PATCH 2/2] 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 +++++++++-------
 2 files changed, 14 insertions(+), 12 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()
-- 
1.9.1

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

---
 tester/rt/coverage.py | 14 ++++++++++----
 tester/rt/options.py  |  2 +-
 tester/rt/test.py     |  9 +++++++--
 3 files changed, 18 insertions(+), 7 deletions(-)

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 (chr...@rtems.org)
+        # Copyright 2013-2015 Chris Johns (chr...@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')
-- 
1.9.1

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to