summaryrefslogtreecommitdiffstats
path: root/tester
diff options
context:
space:
mode:
Diffstat (limited to 'tester')
-rw-r--r--tester/covoar/ReportsBase.cc2
-rw-r--r--tester/rt/config.py46
-rw-r--r--tester/rt/pygdb/spark.py2
-rw-r--r--tester/rt/report.py12
-rw-r--r--tester/rt/stty.py2
-rw-r--r--tester/rt/test.py201
-rw-r--r--tester/rt/tftp.py44
-rw-r--r--tester/rt/tftpserver.py57
-rw-r--r--tester/rtems/testing/bsps/erc32-sis.ini5
-rw-r--r--tester/rtems/testing/bsps/gr740-sis.ini5
-rw-r--r--tester/rtems/testing/bsps/griscv-sis-cov.ini5
-rw-r--r--tester/rtems/testing/bsps/griscv-sis.ini5
-rw-r--r--tester/rtems/testing/bsps/leon2-sis.ini5
-rw-r--r--tester/rtems/testing/bsps/leon3-run.ini3
-rw-r--r--tester/rtems/testing/bsps/leon3-sis-cov.ini5
-rw-r--r--tester/rtems/testing/bsps/leon3-sis.ini5
-rw-r--r--tester/rtems/testing/bsps/rv32i.ini (renamed from tester/rtems/testing/bsps/rv64imac_medany_spike.ini)17
-rw-r--r--tester/rtems/testing/bsps/rv32imafdc.ini (renamed from tester/rtems/testing/bsps/rv64imafd_medany_spike.ini)17
-rw-r--r--tester/rtems/testing/bsps/rv64imac_spike.ini2
-rw-r--r--tester/rtems/testing/bsps/rv64imafd.ini (renamed from tester/rtems/testing/bsps/rv64imafd_medany.ini)7
-rw-r--r--tester/rtems/testing/bsps/rv64imafd_spike.ini2
-rw-r--r--tester/rtems/testing/bsps/rv64imafdc.ini (renamed from tester/rtems/testing/bsps/rv64imafdc_medany.ini)7
-rw-r--r--tester/rtems/testing/bsps/rv64imafdc_spike.ini2
-rw-r--r--tester/rtems/testing/bsps/sis-run.ini5
-rw-r--r--tester/rtems/testing/bsps/sis.ini6
-rw-r--r--tester/rtems/testing/bsps/stm32h7-stlink.ini (renamed from tester/rtems/testing/bsps/rv64imafdc_medany_spike.ini)22
-rw-r--r--tester/rtems/testing/qemu.cfg5
-rw-r--r--tester/rtems/testing/sis.cfg72
28 files changed, 303 insertions, 265 deletions
diff --git a/tester/covoar/ReportsBase.cc b/tester/covoar/ReportsBase.cc
index 0fb9ce0..eb56c4f 100644
--- a/tester/covoar/ReportsBase.cc
+++ b/tester/covoar/ReportsBase.cc
@@ -65,7 +65,7 @@ void ReportsBase::OpenFile(
// Create the output directory if it does not already exist
#ifdef _WIN32
- sc = _mkdir( symbolSetOutputDirectory );
+ sc = _mkdir( symbolSetOutputDirectory.c_str() );
#else
sc = mkdir( symbolSetOutputDirectory.c_str(), 0755 );
#endif
diff --git a/tester/rt/config.py b/tester/rt/config.py
index a7b9ee3..2361bc9 100644
--- a/tester/rt/config.py
+++ b/tester/rt/config.py
@@ -37,6 +37,7 @@ from __future__ import print_function
import datetime
import os
import re
+import shlex
import threading
from rtemstoolkit import configuration
@@ -258,6 +259,7 @@ class file(config.file):
script = self.expand('%%{%s}' % data[2])
if script:
script = [l.strip() for l in script.splitlines()]
+ self.kill_on_end = True
if not self.in_error:
if self.console:
self.console.open()
@@ -282,7 +284,12 @@ class file(config.file):
raise error.general('invalid %tftp port')
self.kill_on_end = True
if not self.opts.dry_run():
+ if self.defined('session_timeout'):
+ session_timeout = int(self.expand('%{session_timeout}'))
+ else:
+ session_timeout = 120
self.process = tester.rt.tftp.tftp(bsp_arch, bsp,
+ session_timeout = session_timeout,
trace = self.exe_trace('tftp'))
if not self.in_error:
if self.console:
@@ -325,7 +332,7 @@ class file(config.file):
if len(_data):
ds = [_data[0]]
if len(_data) > 1:
- ds += _data[1].split()
+ ds += shlex.split(_data[1])
ds = self.expand(ds)
if _directive == '%console':
@@ -413,28 +420,41 @@ class file(config.file):
reset_target = True
else:
reset_target = False
- if self.target_start_regx is not None:
- if self.target_start_regx.match(text):
- if self.test_started:
- self._capture_console('target start detected')
+ if ('*** TIMEOUT TIMEOUT' in text or \
+ '*** TEST TOO LONG' in text) and \
+ self.defined('target_reset_on_timeout'):
+ reset_target = True
+ restart = \
+ (self.target_start_regx is not None and self.target_start_regx.match(text))
+ if restart:
+ if self.test_started:
+ self._capture_console('target start detected')
+ ok_to_kill = True
+ else:
+ self.restarts += 1
+ if self.restarts > self.max_restarts:
+ self._capture_console('target restart maximum count reached')
ok_to_kill = True
else:
- self.restarts += 1
- if self.restarts > self.max_restarts:
- self._capture_console('target restart maximum count reached')
- ok_to_kill = True
- else:
- self.process.target_restart(self.test_started)
+ self.process.target_restart(self.test_started)
if not reset_target and self.target_reset_regx is not None:
if self.target_reset_regx.match(text):
self._capture_console('target reset condition detected')
self._target_command('reset')
self.process.target_reset(self.test_started)
if self.kill_on_end:
- if not ok_to_kill and '*** END OF TEST ' in text:
+ if not ok_to_kill and \
+ ('*** END OF TEST ' in text or \
+ '*** FATAL ***' in text or \
+ '*** TIMEOUT TIMEOUT' in text or \
+ '*** TEST TOO LONG' in text):
self._capture_console('test end: %s' % (self.test_label))
if self.test_label is not None:
- ok_to_kill = '*** END OF TEST %s ***' % (self.test_label) in text
+ ok_to_kill = \
+ '*** END OF TEST %s ***' % (self.test_label) in text or \
+ '*** FATAL ***' in text or \
+ '*** TIMEOUT TIMEOUT' in text or \
+ '*** TEST TOO LONG' in text
self.process.target_end()
text = [(self.console_prefix, l) for l in text.replace(chr(13), '').splitlines()]
if self.output is not None:
diff --git a/tester/rt/pygdb/spark.py b/tester/rt/pygdb/spark.py
index 0eac365..b669998 100644
--- a/tester/rt/pygdb/spark.py
+++ b/tester/rt/pygdb/spark.py
@@ -119,7 +119,7 @@ class GenericParser:
self.augment(start)
self.ruleschanged = 1
- _NULLABLE = '\e_'
+ _NULLABLE = r'\e_'
_START = 'START'
_BOF = '|-'
diff --git a/tester/rt/report.py b/tester/rt/report.py
index 38ac6f9..642ae73 100644
--- a/tester/rt/report.py
+++ b/tester/rt/report.py
@@ -78,8 +78,8 @@ class report(object):
msg += 'Failed: %*d%s' % (self.total_len, self.failed, os.linesep)
msg += 'User Input: %*d%s' % (self.total_len, self.user_input, os.linesep)
msg += 'Expected Fail: %*d%s' % (self.total_len, self.expected_fail, os.linesep)
- msg += 'Indeterminate: %*d%s' % (self.total_len, self.self.indeterminate, os.linesep)
- msg += 'Benchmark: %*d%s' % (self.total_len, self.self.benchmark, os.linesep)
+ msg += 'Indeterminate: %*d%s' % (self.total_len, self.indeterminate, os.linesep)
+ msg += 'Benchmark: %*d%s' % (self.total_len, self.benchmark, os.linesep)
msg += 'Timeout: %*d%s' % (self.total_len, self.timeouts, os.linesep)
msg += 'Test too long: %*d%s' % (self.total_len, self.test_too_long, os.linesep)
msg += 'Invalid: %*d%s' % (self.total_len, self.invalids, os.linesep)
@@ -141,11 +141,11 @@ class report(object):
if line[0] == output_prefix:
if line[1].startswith('*** '):
banner = line[1][4:]
- if banner.startswith('BEGIN OF '):
+ if banner.startswith('BEGIN OF TEST '):
start = True
- elif line[1][4:].startswith('END OF '):
+ elif banner.startswith('END OF TEST '):
end = True
- elif line[1][4:].startswith('FATAL'):
+ elif banner.startswith('FATAL'):
fatal = True
elif banner.startswith('TIMEOUT TIMEOUT'):
timeout = True
@@ -327,7 +327,7 @@ class report(object):
for name in results:
if results[name]['result'] == state:
l += [' %s' % (path.basename(name))]
- return l
+ return sorted(l)
l = []
if self.failed:
l += ['Failures:']
diff --git a/tester/rt/stty.py b/tester/rt/stty.py
index 130318d..fca026a 100644
--- a/tester/rt/stty.py
+++ b/tester/rt/stty.py
@@ -558,7 +558,7 @@ class tty(object):
self._update()
def read(self):
- return self.fs.read()
+ return self.fd.read()
if __name__ == "__main__":
if len(sys.argv) == 2:
diff --git a/tester/rt/test.py b/tester/rt/test.py
index 113936c..9108206 100644
--- a/tester/rt/test.py
+++ b/tester/rt/test.py
@@ -71,7 +71,7 @@ class log_capture(object):
def get(self):
s = []
status = []
- status_regx = re.compile('^\[\s*\d+/\s*\d+\] p:.+')
+ status_regx = re.compile(r'^\[\s*\d+/\s*\d+\] p:.+')
for l in self.log:
if status_regx.match(l):
status += [l]
@@ -151,6 +151,7 @@ class test_run(object):
name = 'test[%s]' % path.basename(self.executable)
self.thread = threading.Thread(target = self.runner,
name = name)
+ self.thread.daemon = True
self.thread.start()
def is_alive(self):
@@ -174,7 +175,7 @@ def find_executables(paths, glob):
for f in files:
if fnmatch.fnmatch(f.lower(), glob):
executables += [path.join(root, f)]
- norun = re.compile('.*\.norun.*')
+ norun = re.compile(r'.*\.norun.*')
executables = [e for e in executables if not norun.match(e)]
return sorted(executables)
@@ -218,76 +219,48 @@ def killall(tests):
test.kill()
+def results_to_data(args, reports, start_time, end_time):
+ data = {}
+ data['report-version'] = 1
+ data['tester-version'] = version.string()
+ data['command-line'] = args
+ data['host'] = host.label(mode='all')
+ data['python'] = sys.version.replace('\n', '')
+ data['start-time'] = start_time.isoformat()
+ data['end-time'] = end_time.isoformat()
+ reports_data = []
+
+ for name, run in reports.results.items():
+ run_data = {}
+ result = run['result']
+ run_data['result'] = result
+ output = []
+ for line in run['output']:
+ if line.startswith('] '):
+ output.append(line[2:])
+ elif line.startswith('=> exe:'):
+ run_data['command-line'] = line[9:].split()
+ run_data['output'] = output
+ run_data['executable'] = name
+ run_data['executable-sha512'] = get_hash512(name)
+ run_data['start-time'] = run['start'].isoformat()
+ run_data['end-time'] = run['end'].isoformat()
+ run_data['bsp'] = run['bsp']
+ run_data['arch'] = run['bsp_arch']
+ reports_data.append(run_data)
+
+ data['reports'] = sorted(reports_data, key=lambda x: x["executable"])
+ return data
+
+
def generate_json_report(args, reports, start_time, end_time,
- total, json_file):
+ _total, json_file):
import json
- import sys
- json_log = {}
- json_log['Command Line'] = " ".join(args)
- json_log['Python'] = sys.version.replace('\n', '')
- json_log['test_groups'] = []
- json_log['Host'] = host.label(mode='all')
- json_log['summary'] = {}
- json_log['summary']['passed_count'] = reports.passed
- json_log['summary']['failed_count'] = reports.failed
- json_log['summary']['user-input_count'] = reports.user_input
- json_log['summary']['expected-fail_count'] = reports.expected_fail
- json_log['summary']['indeterminate_count'] = reports.indeterminate
- json_log['summary']['benchmark_count'] = reports.benchmark
- json_log['summary']['timeout_count'] = reports.timeouts
- json_log['summary']['test-too-long_count'] = reports.test_too_long
- json_log['summary']['invalid_count'] = reports.invalids
- json_log['summary']['wrong-version_count'] = reports.wrong_version
- json_log['summary']['wrong-build_count'] = reports.wrong_build
- json_log['summary']['wrong-tools_count'] = reports.wrong_tools
- json_log['summary']['invalid-header_count'] = reports.wrong_header
- json_log['summary']['total_count'] = reports.total
- time_delta = end_time - start_time
- json_log['summary']['average_test_time'] = str(time_delta / total)
- json_log['summary']['testing_time'] = str(time_delta)
-
- result_types = [
- 'failed', 'user-input', 'expected-fail', 'indeterminate',
- 'benchmark', 'timeout', 'test-too-long', 'invalid', 'wrong-version',
- 'wrong-build', 'wrong-tools', 'wrong-header'
- ]
- json_results = {}
- for result_type in result_types:
- json_log['summary'][result_type] = []
-
- # collate results for JSON log
- for name in reports.results:
- result_type = reports.results[name]['result']
- # map fatal-error on to failed since the report adds both to the failed count
- if result_type == "fatal-error":
- result_type = "failed"
- test_parts = name.split("/")
- test_category = test_parts[-2]
- test_name = test_parts[-1]
- if result_type != 'passed':
- json_log['summary'][result_type].append(test_name)
- if test_category not in json_results:
- json_results[test_category] = []
- json_result = {}
- # remove the file extension
- json_result["name"] = test_name.split('.')[0]
- json_result["result"] = result_type
- if result_type == "failed" or result_type == "timeout":
- json_result["output"] = reports.results[name]["output"]
- json_results[test_category].append(json_result)
-
- # convert results to a better format for report generation
- sorted_keys = sorted(json_results.keys())
- for i in range(len(sorted_keys)):
- results_log = {}
- results_log["index"] = i + 1
- results_log["name"] = sorted_keys[i]
- results_log["results"] = json_results[sorted_keys[i]]
- json_log["test_groups"].append(results_log)
-
- # write out JSON log
+
+ data = results_to_data(args, reports, start_time, end_time);
+
with open(json_file, 'w') as outfile:
- json.dump(json_log, outfile, sort_keys=True, indent=4)
+ json.dump(data, outfile, sort_keys=True, indent=4)
def generate_junit_report(args, reports, start_time, end_time,
@@ -343,108 +316,28 @@ def generate_junit_report(args, reports, start_time, end_time,
def generate_yaml_report(args, reports, start_time, end_time,
- total, yaml_file):
+ _total, yaml_file):
""" Generates a YAML file containing information about the test run,
including all test outputs """
import yaml
- def format_output(output_list):
- return "\n".join(output_list).replace("] ", '').replace('=> ', '')
-
- yaml_log = {}
- yaml_log['command-line'] = args
- yaml_log['host'] = host.label(mode='all')
- yaml_log['python'] = sys.version.replace('\n', '')
- yaml_log['summary'] = {}
- yaml_log['summary']['passed-count'] = reports.passed
- yaml_log['summary']['failed-count'] = reports.failed
- yaml_log['summary']['user-input-count'] = reports.user_input
- yaml_log['summary']['expected-fail-count'] = reports.expected_fail
- yaml_log['summary']['indeterminate-count'] = reports.indeterminate
- yaml_log['summary']['benchmark-count'] = reports.benchmark
- yaml_log['summary']['timeout-count'] = reports.timeouts
- yaml_log['summary']['test-too-long_count'] = reports.test_too_long
- yaml_log['summary']['invalid-count'] = reports.invalids
- yaml_log['summary']['wrong-version-count'] = reports.wrong_version
- yaml_log['summary']['wrong-build-count'] = reports.wrong_build
- yaml_log['summary']['wrong-tools-count'] = reports.wrong_tools
- yaml_log['summary']['wrong-header-count'] = reports.wrong_header
- yaml_log['summary']['total-count'] = reports.total
- time_delta = end_time - start_time
- yaml_log['summary']['average-test-time'] = str(time_delta / total)
- yaml_log['summary']['testing-time'] = str(time_delta)
-
- result_types = [
- 'failed', 'user-input', 'expected-fail', 'indeterminate',
- 'benchmark', 'timeout', 'test-too-long', 'invalid', 'wrong-version',
- 'wrong-build', 'wrong-tools', 'wrong-header'
- ]
- for result_type in result_types:
- yaml_log['summary'][result_type] = []
-
- result_element = {}
- yaml_log['outputs'] = []
-
- # process output of each test
- for exe_name in reports.results:
- test_parts = exe_name.split("/")
- test_name = test_parts[-1]
- result_element['executable-name'] = test_name
- result_element['executable-sha512'] = get_hash512(exe_name)
- result_element['execution-start'] = reports.results[exe_name]['start'].isoformat()
- result_element['execution-end'] = reports.results[exe_name]['end'].isoformat()
- date_diff = reports.results[exe_name]['end'] - reports.results[exe_name]['start']
- result_element['execution-duration'] = str(date_diff)
- result_element['execution-result'] = reports.results[exe_name]['result']
- result_element['bsp'] = reports.results[exe_name]['bsp']
- result_element['bsp-arch'] = reports.results[exe_name]['bsp_arch']
- result_output = reports.results[exe_name]['output']
-
- dbg_output = []
- test_output = []
- idxs_output = [] # store indices of given substrings
- for elem in result_output:
- if '=> ' in elem:
- idxs_output.append(result_output.index(elem))
- if '*** END' in elem:
- idxs_output.append(result_output.index(elem))
-
- if len(idxs_output) == 3: # test executed and has result
- dbg_output = result_output[idxs_output[0]:idxs_output[1]]
- dbg_output.append("=== Executed Test ===")
- dbg_output = dbg_output + result_output[idxs_output[2]+1:len(result_output)]
- test_output = result_output[idxs_output[1]:idxs_output[2]+1]
- else:
- dbg_output = result_output
-
- result_element['debugger-output'] = format_output(dbg_output)
- result_element['console-output'] = format_output(test_output)
- yaml_log['outputs'].append(result_element)
-
- result_type = reports.results[exe_name]['result']
- # map "fatal-error" on to "failed"
- if result_type == "fatal-error":
- result_type = "failed"
-
- if result_type != 'passed':
- yaml_log['summary'][result_type].append(test_name)
-
- result_element = {}
+ data = results_to_data(args, reports, start_time, end_time);
with open(yaml_file, 'w') as outfile:
- yaml.dump(yaml_log, outfile, default_flow_style=False, allow_unicode=True)
+ yaml.dump(data, outfile, default_flow_style=False, allow_unicode=True)
def get_hash512(exe):
""" returns SHA512 hash string of a given binary file passed as argument """
+ import base64
import hashlib
hash = hashlib.sha512()
with open(exe, "rb") as f:
for byte_block in iter(lambda: f.read(4096), b""):
hash.update(byte_block)
- return hash.hexdigest()
+ return base64.urlsafe_b64encode(hash.digest()).decode("ascii")
report_formatters = {
diff --git a/tester/rt/tftp.py b/tester/rt/tftp.py
index 5a1c7b7..5d2e74a 100644
--- a/tester/rt/tftp.py
+++ b/tester/rt/tftp.py
@@ -49,7 +49,8 @@ import tester.rt.tftpserver
class tftp(object):
'''RTEMS Testing TFTP base.'''
- def __init__(self, bsp_arch, bsp, trace = False):
+ def __init__(self, bsp_arch, bsp, session_timeout, trace = False):
+ self.session_timeout = session_timeout
self.trace = trace
self.lock_trace = False
self.lock = threading.RLock()
@@ -60,7 +61,7 @@ class tftp(object):
def __del__(self):
self.kill()
- def _init(self):
+ def _init(self, state = 'reset'):
self.output_length = None
self.console = None
self.server = None
@@ -73,7 +74,7 @@ class tftp(object):
self.running = False
self.finished = False
self.caught = None
- self.target_state = 'reset'
+ self.target_state = state
def _lock(self, msg):
if self.lock_trace:
@@ -109,7 +110,8 @@ class tftp(object):
try:
if self.server is not None:
self.server.stop()
- self.finished = Finished
+ self.finished = finished
+ self._set_target_state('finished')
except:
pass
@@ -150,14 +152,15 @@ class tftp(object):
def _listener(self, exe):
self.server = tester.rt.tftpserver.tftp_server(host = 'all',
port = self.port,
+ session_timeout = self.session_timeout,
timeout = 10,
forced_file = exe,
sessions = 1)
try:
- if log.tracing:
+ if False and log.tracing:
self.server.trace_packets()
self.server.start()
- self.server.run()
+ return self.server.run() == 1
except:
self.server.stop()
raise
@@ -169,22 +172,30 @@ class tftp(object):
self.exe = None
self._unlock('_runner')
caught = None
+ retry = 0
+ target_loaded = False
try:
self._lock('_runner')
state = self.target_state
self._unlock('_runner')
self._trace('runner: ' + state)
- while state not in ['shutdown', 'finished']:
- if state != 'running':
+ while state not in ['shutdown', 'finished', 'timeout']:
+ if state in ['booting', 'running']:
+ time.sleep(0.25)
+ else:
self._trace('listening: begin: ' + state)
- self._listener(exe)
+ target_loaded = self._listener(exe)
self._lock('_runner')
- if self.target_state == 'booting':
- self._set_target_state('loaded')
+ if target_loaded:
+ self._set_target_state('booting')
+ else:
+ retry += 1
+ if retry > 1:
+ self._set_target_state('timeout')
+ self._timeout()
+ state = self.target_state
self._unlock('_runner')
self._trace('listening: end: ' + state)
- else:
- time.sleep(0.25)
self._lock('_runner')
state = self.target_state
self._unlock('_runner')
@@ -214,16 +225,17 @@ class tftp(object):
self.test_too_long = timeout[3]
self.opened = True
self.running = True
+ self._console('tftp: exe: %s' % (executable))
self.listener = threading.Thread(target = self._runner,
name = 'tftp-listener')
+ self.listener.daemon = True
self._unlock('_open: start listner')
- self._console('tftp: exe: %s' % (executable))
self.listener.start()
self._lock('_open: start listner')
step = 0.25
period = timeout[0]
seconds = timeout[1]
- output_len = self.output_length()
+ output_length = self.output_length()
while not self.finished and period > 0 and seconds > 0:
if not self.running and self.caught:
break
@@ -250,7 +262,7 @@ class tftp(object):
elif seconds == 0:
self._test_too_long()
caught = self.caught
- self._init()
+ self._init('finished')
self._unlock('_open')
if caught is not None:
reraise.reraise(*caught)
diff --git a/tester/rt/tftpserver.py b/tester/rt/tftpserver.py
index 92cd1fd..c200dad 100644
--- a/tester/rt/tftpserver.py
+++ b/tester/rt/tftpserver.py
@@ -453,14 +453,13 @@ class udp_handler(socketserver.BaseRequestHandler):
raise
self._notice('] tftp: %d: error: %s: %s' % (index, type(exp), exp))
self._notice('] tftp: %d: end: %s' % (index, client))
+ self.server.tftp.session_done()
def handle(self):
'''The UDP server handle method.'''
- if self.server.tftp.sessions is None \
- or self.server.tftp.session < self.server.tftp.sessions:
+ if self.server.tftp.sessions_available():
self.handle_session(self.server.tftp.next_session())
-
class udp_server(socketserver.ThreadingMixIn, socketserver.UDPServer):
'''UDP server. Default behaviour.'''
@@ -474,6 +473,7 @@ class tftp_server(object):
def __init__(self,
host,
port,
+ session_timeout=None,
timeout=10,
base=None,
forced_file=None,
@@ -484,6 +484,7 @@ class tftp_server(object):
self.notices = False
self.packet_trace = False
self.exception_is_raise = False
+ self.session_timeout = session_timeout
self.timeout = timeout
self.host = host
self.port = port
@@ -497,6 +498,7 @@ class tftp_server(object):
raise error.general('tftp session count is not a number')
self.sessions = sessions
self.session = 0
+ self.sessions_done = 0
self.reader = reader
def __del__(self):
@@ -542,6 +544,8 @@ class tftp_server(object):
def run(self):
'''Run the TFTP server for the specified number of sessions.'''
running = True
+ session_timeout = self.session_timeout
+ last_session = 0
while running:
period = 1
self._lock()
@@ -549,7 +553,7 @@ class tftp_server(object):
running = False
period = 0
elif self.sessions is not None:
- if self.sessions == 0:
+ if self.sessions_done >= self.sessions:
running = False
period = 0
else:
@@ -557,7 +561,24 @@ class tftp_server(object):
self._unlock()
if period > 0:
time.sleep(period)
+ if session_timeout is not None:
+ session = self.get_session()
+ if last_session != session:
+ last_session = session
+ session_timeout = self.session_timeout
+ else:
+ if session_timeout < period:
+ session_timeout = 0
+ else:
+ session_timeout -= period
+ if session_timeout == 0:
+ log.trace('] tftp: server: session timeout')
+ running = False
self.stop()
+ self._lock()
+ sessions_done = self.sessions_done
+ self._unlock()
+ return sessions_done
def get_session(self):
'''Return the session count.'''
@@ -580,6 +601,24 @@ class tftp_server(object):
self._unlock()
return count
+ def sessions_available(self):
+ '''Return True is there are available sessions.'''
+ available = False
+ self._lock()
+ try:
+ available = self.sessions is None or self.session < self.sessions
+ finally:
+ self._unlock()
+ return available
+
+ def session_done(self):
+ '''Call when a session is done.'''
+ self._lock()
+ try:
+ self.sessions_done += 1
+ finally:
+ self._unlock()
+
def enable_notices(self):
'''Call to enable notices. The server is quiet without this call.'''
self._lock()
@@ -654,10 +693,14 @@ def run(args=sys.argv, command_path=None):
help='port to bind the server too (default: %(default)s).',
type=int,
default='69')
+ argsp.add_argument('-S', '--session-timeout',
+ help='timeout in seconds, client can override ' \
+ '(default: %(default)s).',
+ type = int, default=None)
argsp.add_argument('-t', '--timeout',
- help = 'timeout in seconds, client can override ' \
+ help='timeout in seconds, client can override ' \
'(default: %(default)s).',
- type = int, default = '10')
+ type=int, default='10')
argsp.add_argument(
'-b',
'--base',
@@ -682,7 +725,7 @@ def run(args=sys.argv, command_path=None):
log.output(log.info(args))
log.tracing = argopts.trace
- server = tftp_server(argopts.bind, argopts.port, argopts.timeout,
+ server = tftp_server(argopts.bind, argopts.port, argopts.session_timeout, argopts.timeout,
argopts.base, argopts.force_file,
argopts.sessions)
server.enable_notices()
diff --git a/tester/rtems/testing/bsps/erc32-sis.ini b/tester/rtems/testing/bsps/erc32-sis.ini
index fca2122..a025265 100644
--- a/tester/rtems/testing/bsps/erc32-sis.ini
+++ b/tester/rtems/testing/bsps/erc32-sis.ini
@@ -34,6 +34,5 @@
[erc32-sis]
bsp = erc32
arch = sparc
-tester = %{_rtscripts}/run.cfg
-bsp_run_cmd = %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-sis
-bsp_run_opts = -nouartrx -r -tlim 600 s
+tester = %{_rtscripts}/sis.cfg
+bsp_run_opts =
diff --git a/tester/rtems/testing/bsps/gr740-sis.ini b/tester/rtems/testing/bsps/gr740-sis.ini
index b71048c..c42d716 100644
--- a/tester/rtems/testing/bsps/gr740-sis.ini
+++ b/tester/rtems/testing/bsps/gr740-sis.ini
@@ -33,6 +33,5 @@
[gr740-sis]
bsp = gr740
arch = sparc
-tester = %{_rtscripts}/run.cfg
-bsp_run_cmd = %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-sis
-bsp_run_opts = -gr740 -nouartrx -r -tlim 200 s -m 4
+tester = %{_rtscripts}/sis.cfg
+bsp_run_opts = -gr740 -m 4
diff --git a/tester/rtems/testing/bsps/griscv-sis-cov.ini b/tester/rtems/testing/bsps/griscv-sis-cov.ini
index 9ab37a8..fa86b55 100644
--- a/tester/rtems/testing/bsps/griscv-sis-cov.ini
+++ b/tester/rtems/testing/bsps/griscv-sis-cov.ini
@@ -34,7 +34,6 @@
[griscv-sis-cov]
bsp = griscv-sis
arch = riscv
-tester = %{_rtscripts}/run.cfg
-bsp_run_cmd = %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-sis
-bsp_run_opts = -nouartrx -r -tlim 300 s -m 4 -cov
+tester = %{_rtscripts}/sis.cfg
+bsp_run_opts = -m 4 -cov
bsp_covoar_cmd = -S %{bsp_symbol_path} -E %{cov_explanations} -f TSIM
diff --git a/tester/rtems/testing/bsps/griscv-sis.ini b/tester/rtems/testing/bsps/griscv-sis.ini
index b21cba1..bf32851 100644
--- a/tester/rtems/testing/bsps/griscv-sis.ini
+++ b/tester/rtems/testing/bsps/griscv-sis.ini
@@ -34,6 +34,5 @@
[griscv-sis]
bsp = griscv
arch = riscv
-tester = %{_rtscripts}/run.cfg
-bsp_run_cmd = %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-sis
-bsp_run_opts = -nouartrx -r -tlim 300 s -m 4
+tester = %{_rtscripts}/sis.cfg
+bsp_run_opts = -m 4
diff --git a/tester/rtems/testing/bsps/leon2-sis.ini b/tester/rtems/testing/bsps/leon2-sis.ini
index 61205ad..810320c 100644
--- a/tester/rtems/testing/bsps/leon2-sis.ini
+++ b/tester/rtems/testing/bsps/leon2-sis.ini
@@ -34,6 +34,5 @@
[leon2-sis]
bsp = leon2
arch = sparc
-tester = %{_rtscripts}/run.cfg
-bsp_run_cmd = %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-sis
-bsp_run_opts = -leon2 -nouartrx -r -tlim 200 s
+tester = %{_rtscripts}/sis.cfg
+bsp_run_opts = -leon2
diff --git a/tester/rtems/testing/bsps/leon3-run.ini b/tester/rtems/testing/bsps/leon3-run.ini
index a8c97a6..99c391b 100644
--- a/tester/rtems/testing/bsps/leon3-run.ini
+++ b/tester/rtems/testing/bsps/leon3-run.ini
@@ -34,6 +34,5 @@
[leon3-run]
bsp = leon3
arch = sparc
-tester = %{_rtscripts}/run.cfg
-bsp_run_cmd = %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-run
+tester = %{_rtscripts}/sis.cfg
bsp_run_opts = -a -leon3
diff --git a/tester/rtems/testing/bsps/leon3-sis-cov.ini b/tester/rtems/testing/bsps/leon3-sis-cov.ini
index d8ffe28..7c6a279 100644
--- a/tester/rtems/testing/bsps/leon3-sis-cov.ini
+++ b/tester/rtems/testing/bsps/leon3-sis-cov.ini
@@ -34,7 +34,6 @@
[leon3-sis-cov]
bsp = leon3-sis
arch = sparc
-tester = %{_rtscripts}/run.cfg
-bsp_run_cmd = %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-sis
-bsp_run_opts = -leon3 -nouartrx -r -tlim 200 s -cov
+tester = %{_rtscripts}/sis.cfg
+bsp_run_opts = -leon3 -cov
bsp_covoar_cmd = -S %{bsp_symbol_path} -E %{cov_explanations} -f TSIM
diff --git a/tester/rtems/testing/bsps/leon3-sis.ini b/tester/rtems/testing/bsps/leon3-sis.ini
index 2f933a7..9035f48 100644
--- a/tester/rtems/testing/bsps/leon3-sis.ini
+++ b/tester/rtems/testing/bsps/leon3-sis.ini
@@ -34,6 +34,5 @@
[leon3-sis]
bsp = leon3
arch = sparc
-tester = %{_rtscripts}/run.cfg
-bsp_run_cmd = %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-sis
-bsp_run_opts = -leon3 -nouartrx -r -tlim 200 s -m 4
+tester = %{_rtscripts}/sis.cfg
+bsp_run_opts = -leon3 -m 4
diff --git a/tester/rtems/testing/bsps/rv64imac_medany_spike.ini b/tester/rtems/testing/bsps/rv32i.ini
index 1d9a522..1817216 100644
--- a/tester/rtems/testing/bsps/rv64imac_medany_spike.ini
+++ b/tester/rtems/testing/bsps/rv32i.ini
@@ -1,6 +1,7 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2010-2014 Chris Johns (chrisj@rtems.org)
+# Copyright 2020 Hesham Almatary
+# Copyright 2018 embedded brains GmbH
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -28,11 +29,9 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-#
-# The Generic RISC-V BSP
-#
-[rv64imac_medany_spike]
-bsp = rv64imac
-arch = riscv64
-tester = %{_rtscripts}/spike.cfg
-bsp_spike_opts = --isa=RV64IMAC
+[rv32i]
+bsp = rv32i
+arch = riscv32
+tester = %{_rtscripts}/qemu.cfg
+bsp_qemu_image_type = -bios
+bsp_qemu_opts = -no-reboot -nographic %{qemu_opts_no_net} -machine virt -m 128M
diff --git a/tester/rtems/testing/bsps/rv64imafd_medany_spike.ini b/tester/rtems/testing/bsps/rv32imafdc.ini
index 9348131..2f91a9a 100644
--- a/tester/rtems/testing/bsps/rv64imafd_medany_spike.ini
+++ b/tester/rtems/testing/bsps/rv32imafdc.ini
@@ -1,6 +1,7 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2010-2014 Chris Johns (chrisj@rtems.org)
+# Copyright 2020 Hesham Almatary
+# Copyright 2018 embedded brains GmbH
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -28,11 +29,9 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-#
-# The Generic RISC-V BSP
-#
-[rv64imafd_medany_spike]
-bsp = rv64imafd
-arch = riscv64
-tester = %{_rtscripts}/spike.cfg
-bsp_spike_opts = --isa=RV64IMAFD
+[rv32imafdc]
+bsp = rv32imafdc
+arch = riscv32
+tester = %{_rtscripts}/qemu.cfg
+bsp_qemu_image_type = -bios
+bsp_qemu_opts = -no-reboot -nographic %{qemu_opts_no_net} -machine virt -m 128M
diff --git a/tester/rtems/testing/bsps/rv64imac_spike.ini b/tester/rtems/testing/bsps/rv64imac_spike.ini
index b2a35fd..10900d8 100644
--- a/tester/rtems/testing/bsps/rv64imac_spike.ini
+++ b/tester/rtems/testing/bsps/rv64imac_spike.ini
@@ -35,4 +35,4 @@
bsp = rv64imac
arch = riscv64
tester = %{_rtscripts}/spike.cfg
-bsp_spike_opts = --isa=RV64IMAC -m0x70000000:0x10000000
+bsp_spike_opts = --isa=RV64IMAC
diff --git a/tester/rtems/testing/bsps/rv64imafd_medany.ini b/tester/rtems/testing/bsps/rv64imafd.ini
index 15137df..bbb4ee3 100644
--- a/tester/rtems/testing/bsps/rv64imafd_medany.ini
+++ b/tester/rtems/testing/bsps/rv64imafd.ini
@@ -28,8 +28,9 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-[rv64imafd_medany]
-bsp = rv64imafd_medany
+[rv64imafd]
+bsp = rv64imafd
arch = riscv64
tester = %{_rtscripts}/qemu.cfg
-bsp_qemu_opts = -no-reboot -nographic %{qemu_opts_no_net} -machine virt -m 64M
+bsp_qemu_image_type = -bios
+bsp_qemu_opts = -no-reboot -nographic %{qemu_opts_no_net} -machine virt -m 128M
diff --git a/tester/rtems/testing/bsps/rv64imafd_spike.ini b/tester/rtems/testing/bsps/rv64imafd_spike.ini
index 74336aa..8e975f7 100644
--- a/tester/rtems/testing/bsps/rv64imafd_spike.ini
+++ b/tester/rtems/testing/bsps/rv64imafd_spike.ini
@@ -35,4 +35,4 @@
bsp = rv64imafd
arch = riscv64
tester = %{_rtscripts}/spike.cfg
-bsp_spike_opts = --isa=RV64IMAFD -m0x70000000:0x10000000
+bsp_spike_opts = --isa=RV64IMAFD
diff --git a/tester/rtems/testing/bsps/rv64imafdc_medany.ini b/tester/rtems/testing/bsps/rv64imafdc.ini
index 30abd50..d42680b 100644
--- a/tester/rtems/testing/bsps/rv64imafdc_medany.ini
+++ b/tester/rtems/testing/bsps/rv64imafdc.ini
@@ -29,8 +29,9 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-[rv64imafdc_medany]
-bsp = rv64imafdc_medany
+[rv64imafdc]
+bsp = rv64imafdc
arch = riscv64
tester = %{_rtscripts}/qemu.cfg
-bsp_qemu_opts = -no-reboot -nographic %{qemu_opts_no_net} -machine virt -m 64M
+bsp_qemu_image_type = -bios
+bsp_qemu_opts = -no-reboot -nographic %{qemu_opts_no_net} -machine virt -m 128M
diff --git a/tester/rtems/testing/bsps/rv64imafdc_spike.ini b/tester/rtems/testing/bsps/rv64imafdc_spike.ini
index b72b471..c95a840 100644
--- a/tester/rtems/testing/bsps/rv64imafdc_spike.ini
+++ b/tester/rtems/testing/bsps/rv64imafdc_spike.ini
@@ -35,4 +35,4 @@
bsp = rv64imafdc
arch = riscv64
tester = %{_rtscripts}/spike.cfg
-bsp_spike_opts = --isa=RV64IMAFDC -m0x70000000:0x10000000
+bsp_spike_opts = --isa=RV64IMAFDC
diff --git a/tester/rtems/testing/bsps/sis-run.ini b/tester/rtems/testing/bsps/sis-run.ini
index 55c30ac..4861231 100644
--- a/tester/rtems/testing/bsps/sis-run.ini
+++ b/tester/rtems/testing/bsps/sis-run.ini
@@ -34,6 +34,5 @@
[sis-run]
bsp = sis
arch = sparc
-tester = %{_rtscripts}/run.cfg
-bsp_run_cmd = %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-run
-bsp_run_opts = -a -nouartrx
+tester = %{_rtscripts}/sis.cfg
+bsp_run_opts =
diff --git a/tester/rtems/testing/bsps/sis.ini b/tester/rtems/testing/bsps/sis.ini
index b5d700f..086cb45 100644
--- a/tester/rtems/testing/bsps/sis.ini
+++ b/tester/rtems/testing/bsps/sis.ini
@@ -34,8 +34,6 @@
[sis]
bsp = sis
arch = sparc
-tester = %{_rtscripts}/gdb.cfg
+tester = %{_rtscripts}/sis.cfg
gdb_script = bsp_gdb_script
-bsp_gdb_script = target sim -a -nouartrx
- load
- run
+bsp_run_opts =
diff --git a/tester/rtems/testing/bsps/rv64imafdc_medany_spike.ini b/tester/rtems/testing/bsps/stm32h7-stlink.ini
index b691a60..2c375f5 100644
--- a/tester/rtems/testing/bsps/rv64imafdc_medany_spike.ini
+++ b/tester/rtems/testing/bsps/stm32h7-stlink.ini
@@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2010-2014 Chris Johns (chrisj@rtems.org)
+# Copyright 2015 On-Line Applications Research Corporation (OAR).
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -29,10 +29,16 @@
#
#
-# The Generic RISC-V BSP
-#
-[rv64imafdc_medany_spike]
-bsp = rv64imafdc_medany
-arch = riscv64
-tester = %{_rtscripts}/spike.cfg
-bsp_spike_opts = --isa=RV64IMAFDC
+# The stm32h7 BSP family
+#
+[stm32h7-stlink]
+bsp = stm32h7-stlink
+arch = arm
+tester = %{_rtscripts}/gdb.cfg
+jobs = 1
+gdb_script = bsp_gdb_script
+requires = bsp_tty_dev, bsp_gdb_script, target_pretest_command, target_posttest_command
+bsp_gdb_script = target extended-remote :61234
+ load
+ handle SIGTRAP nostop
+ cont
diff --git a/tester/rtems/testing/qemu.cfg b/tester/rtems/testing/qemu.cfg
index 3c51bee..0b592ef 100644
--- a/tester/rtems/testing/qemu.cfg
+++ b/tester/rtems/testing/qemu.cfg
@@ -78,6 +78,9 @@
%ifn %{defined bsp_qemu_extra_opts}
%define bsp_qemu_extra_opts %{nil}
%endif
+%ifn %{defined bsp_qemu_image_type}
+ %define bsp_qemu_image_type -kernel
+%endif
%define qemu_cmd qemu-system-%{bsp_arch}
%define qemu_opts %{bsp_qemu_opts} %{bsp_qemu_cov_opts}
@@ -85,4 +88,4 @@
#
# Executable
#
-%execute %{qemu_cmd} %{qemu_opts} %{bsp_qemu_extra_opts} -kernel %{test_executable}
+%execute %{qemu_cmd} %{qemu_opts} %{bsp_qemu_extra_opts} %{bsp_qemu_image_type} %{test_executable}
diff --git a/tester/rtems/testing/sis.cfg b/tester/rtems/testing/sis.cfg
new file mode 100644
index 0000000..bb8d0bc
--- /dev/null
+++ b/tester/rtems/testing/sis.cfg
@@ -0,0 +1,72 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2022 Chris Johns (chrisj@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.
+#
+
+#
+# SIS. The main simulator for SPARC/LEON
+#
+# Use sis command to run the executable in the spike simulator.
+#
+
+%include %{_configdir}/base.cfg
+%include %{_configdir}/checks.cfg
+
+#
+# Console.
+#
+%define console_stdio
+%include %{_configdir}/console.cfg
+
+#
+# RTEMS version
+#
+%include %{_rtdir}/rtems/version.cfg
+
+#
+# Timeout option. This is the default for timeout for the CPU realtime
+# clock
+
+%ifn %{defined sis_time_limit}
+ %define sis_time_limit -tlim 400 s
+%endif
+
+#
+# Default command
+#
+%ifn %{defined bsp_run_cmd}
+ %define bsp_run_cmd %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-sis
+%endif
+
+%define sis_cmd %{bsp_run_cmd}
+%define sis_opts -nouartrx -r %{sis_time_limit} %{bsp_run_opts}
+
+#
+# Executable
+#
+%execute %{sis_cmd} %{sis_opts} %{test_executable}