Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug: Add first cut to call "compliance" tests #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions debug/gdbserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,32 @@ def test(self):
if privilege in self.supported:
assertEqual(actual, privilege)

class ComplianceTest(GdbTest):

def test(self):
output = self.gdb.command("monitor riscv test_compliance")
#TODO: Fix OpenOCD to remove the -rtos riscv requirement
assert(("ALL TESTS PASSED") in output or ("Please run with -rtos riscv to run compliance test.") in output)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nicer to do something like:

if "Please run with -rtos riscv to run compliance test." in output:
   return
assertIn("ALL TESTS PASSED", output)

which results in a slightly nicer error message if the tests didn't pass.


def compile(self):
pass

class SystemBusAccessConfigRegTest(GdbTest):

def test(self):
result = self.gdb.command("monitor riscv dmi_read 0x38")
if (int(result, base=16) == 0):
return 'not_applicable'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make sure make pylint is happy before merging?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, but can we add pylint check to the regression (because otherwise you assume I know how to run pylint...)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pylint checks differ slightly between versions. I didn't put it in the regression to avoid the case where it works fine for a developer, but then fails a regression. The how-to-run pylint issue is why there's a make pylint target.

self.gdb.command("monitor riscv set_prefer_sba on")
command = "monitor riscv test_sba_config_reg 0x%08x %d 0x%08x off" % (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run this test I get:

(gdb) monitor riscv test_sba_config_reg 0x1212340000 100 0x121233fffc off
invalid subcommand "test_sba_config_reg 0x1212340000 100 0x121233fffc off"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and you're using latest OpenOCD?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I had the latest source, but hadn't rebuilt. Now the command starts correctly.

self.target.harts[0].ram, # base address to target
min(self.target.harts[0].ram_size, 100), # size to target
self.target.harts[0].ram - 4) # Illegal region to target
print command
output = self.gdb.command(command)
assert("ALL TESTS PASSED") in output

# XXX temporarily disabling this test
#class PrivChange(PrivTest):
# def test(self):
Expand Down