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

OpTestOpenCAPI: add new test OcxlResetTest #585

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
35 changes: 35 additions & 0 deletions testcases/OpTestOpenCAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def set_up(self):
l_module = "ocxl"
self.cv_HOST.host_load_module_based_on_config(l_kernel, l_config,
l_module)
# Load module pnv_php
l_module = "pnv_php"
self.cv_HOST.host_load_module(l_module)


class OcxlDeviceFileTest(OpTestOpenCAPI, unittest.TestCase):
Expand Down Expand Up @@ -257,6 +260,37 @@ def runTest(self):
self.assertTrue(False, "ocxl_memcpy -A tests failed")


class OcxlResetTest(OpTestOpenCAPI, unittest.TestCase):
'''
If the system has an OpenCAPI FPGA card, then load the modules
ocxl and pnv_php if required, and test the card reset.
'''

def setUp(self):
super(OcxlResetTest, self).setUp()

def runTest(self):
self.set_up()

# Check that the ocxl_reset_tests.sh script is available
# If not, clone and build libocxl and afutests
l_dir = "/tmp/libocxl"
if (self.cv_HOST.host_check_binary(l_dir, "afuobj/ocxl_reset_tests.sh") != True):
self.cv_HOST.host_clone_libocxl(l_dir)
self.cv_HOST.host_build_libocxl(l_dir)

# Run reset tests
l_exec = "afuobj/ocxl_reset_tests.sh -l 10"
cmd = "cd %s; ./%s" % (l_dir, l_exec)
log.debug(cmd)
try:
self.cv_HOST.host_run_command(cmd)
l_msg = "ocxl_reset_tests pass"
log.debug(l_msg)
except CommandFailed:
self.assertTrue(False, "ocxl_reset_tests failed")


def opencapi_test_suite():
s = unittest.TestSuite()
s.addTest(OcxlDeviceFileTest())
Expand All @@ -265,4 +299,5 @@ def opencapi_test_suite():
s.addTest(MemCpy3AFUReallocTest())
s.addTest(MemCpy3AFUIncrementTest())
s.addTest(MemCpy3AFUAtomicCasTest())
s.addTest(OcxlResetTest())
return s