Skip to content

Commit

Permalink
Merge pull request #26 from riscv-software-src/improve-diff-reporting
Browse files Browse the repository at this point in the history
Improve diff reporting.
  • Loading branch information
neelgala authored Oct 22, 2021
2 parents c8dfdc4 + 8967701 commit 4da4fbc
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.23.1] - 2021-10-20
- Improved diff reporting in case of Failed tests.
- Added support for f and d exts in model plugin.
- Added checking to ensure that tests with wrong filtering based on ISA are not selected.
- Fixed spelling for opening and arch test command in docs.

## [1.23.0] - 2021-10-14
- Added support for new RVTEST_ISA macro
- Fixed decode error in Command util.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/arch-tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Running RISCV-ARCH-TESTS
########################

The following guide provides a walkthrough on how to run the tests available at
the `riscv-arch-tests <https://github.com/riscv/riscv-arch-test>`_ repository.
the `riscv-arch-test <https://github.com/riscv/riscv-arch-test>`_ repository.

The following assumes you have installed riscof as a cli on your system. If not, then please refer
to the :ref:`install_riscof` section for the same.
Expand Down Expand Up @@ -64,7 +64,7 @@ Cloning the riscv-arch-test repo

.. code-block:: console
$ riscof --verbose info arch-tests --clone
$ riscof --verbose info arch-test --clone
Running Tests with RISCOF
-------------------------
Expand Down
4 changes: 4 additions & 0 deletions riscof/Templates/setup/model/riscof_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def build(self, isa_yaml, platform_yaml):
self.isa += 'i'
if "M" in ispec["ISA"]:
self.isa += 'm'
if "F" in ispec["ISA"]:
self.isa += 'f'
if "D" in ispec["ISA"]:
self.isa += 'd'
if "C" in ispec["ISA"]:
self.isa += 'c'

Expand Down
15 changes: 12 additions & 3 deletions riscof/Templates/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ span.failed, .failed .col-result {
font-weight: bold
}

table.diff {font-family:Courier; border:medium;overflow-y:auto;height:150px;}
.diff_header {background-color:#e0e0e0}
.diff thead th {
position: sticky;
top: 0;
}
td.diff_header {text-align:right}
.diff_next {background-color:#c0c0c}
.diff_add {background-color:#aaffaa}
.diff_chg {background-color:#ffff77}
.diff_sub {background-color:#ffaaaa}

#sizes-table {
border: 1px solid #cccccc;
color: #313131;
Expand Down Expand Up @@ -121,9 +133,6 @@ span.failed, .failed .col-result {
* 2. Extra
*------------------*/

.log:only-child {
height: inherit
}
.log {
background-color: #e6e6e6;
border: 1px solid #e6e6e6;
Expand Down
2 changes: 1 addition & 1 deletion riscof/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

__author__ = """InCore Semiconductors Pvt Ltd"""
__email__ = 'info@incoresemi.com'
__version__ = '1.23.0'
__version__ = '1.23.1'
4 changes: 2 additions & 2 deletions riscof/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def run(ctx,config,work_dir,suite,env,no_browser,dbfile,testfile,no_ref_run,no_d
if not no_browser:
try:
import webbrowser
logger.info("Openning test report in web-browser")
logger.info("Opening test report in web-browser")
webbrowser.open(reportfile)
raise SystemExit(exitcode)
except:
Expand Down Expand Up @@ -437,7 +437,7 @@ def coverage(ctx,config,work_dir,suite,env,no_browser,cgf_file):
if not no_browser:
try:
import webbrowser
logger.info("Openning test report in web-browser")
logger.info("Opening test report in web-browser")
webbrowser.open(reportfile)
except:
raise SystemExit(0)
Expand Down
11 changes: 9 additions & 2 deletions riscof/framework/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ def compare_signature(file1, file2):
logger.error('Signature file : ' + file1 + ' does not exist')
raise SystemExit(1)
file1_lines = open(file1, "r").readlines()
file2_lines = open(file2, "r").readlines()
res = ("".join(
difflib.unified_diff(file1_lines,open(file2, "r").readlines(), file1, file2))).strip()
difflib.unified_diff(file1_lines,file2_lines, file1, file2))).strip()
if res == "":
if len(file1_lines)==0:
return 'Failed', '---- \nBoth FIles empty\n'
else:
status = 'Passed'
else:
status = 'Failed'
res = difflib.HtmlDiff(tabsize=4).make_table(file1_lines,file2_lines,file1,file2,
context=True, numlines=0)
return status, res

def get_node(spec,node):
Expand Down Expand Up @@ -276,17 +279,21 @@ def prod_isa(dut_isa, test_isa):
dut_exts = isa_set(re.sub("RV(64|128|32)(I|E)","",dut_isa))
isa = set([])
last_prefix = ''
atleast_1 = False
for entry in test_isa:
match = re.findall("(?P<prefix>RV(64|128|32)(I|E))",entry)
prefix = match[0][0]
exts = isa_set(re.sub("RV(64|128|32)(I|E)","",entry))
overlap = dut_exts & exts
if overlap == exts:
atleast_1 = True
isa = isa | overlap
if last_prefix:
if last_prefix != prefix:
raise TestSelectError("Incompatiple prefix for valid ISA strings in test.")
last_prefix = prefix
if not atleast_1:
raise TestSelectError("Test Selected without the relevant extensions being available on DUT.")
return prefix+canonicalise(isa)

def generate_test_pool(ispec, pspec, workdir, dbfile = None):
Expand Down Expand Up @@ -446,7 +453,7 @@ def run_tests(dut, base, ispec, pspec, work_dir, cntr_args):
testentry['commit_id'],
'log':
'commit_id:' + testentry['commit_id'] + "\nMACROS:\n" + "\n".join(testentry['macros']) +
"" if result == "Passed" else diff,
("" if result == "Passed" else diff),
'path':
work_dir,
'repclass':
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.23.0
current_version = 1.23.1
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def read_requires():
test_requirements = [ ]

setup(name="riscof",
version='1.23.0',
version='1.23.1',
description="RISC-V Architectural Test Framework",
long_description=readme + '\n\n',
classifiers=[
Expand Down

0 comments on commit 4da4fbc

Please sign in to comment.