Skip to content

Commit 2582a62

Browse files
authored
Merge pull request #461 from philippe56/more_capi_tests
More capi tests
2 parents eae757b + 412f63d commit 2582a62

File tree

1 file changed

+65
-1
lines changed

1 file changed

+65
-1
lines changed

testcases/OpTestCAPI.py

+65-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def runTest(self):
155155
self.cv_HOST.host_build_cxl_tests(l_dir)
156156

157157
# Run memcpy afu tests
158-
l_exec = "memcpy_afu_ctx -p100 -l100 >/tmp/memcpy_afu_ctx.log"
158+
l_exec = "memcpy_afu_ctx -p0 -l10000 >/tmp/memcpy_afu_ctx.log"
159159
cmd = "cd %s && LD_LIBRARY_PATH=libcxl ./%s" % (l_dir, l_exec)
160160
log.debug(cmd)
161161
try:
@@ -166,6 +166,68 @@ def runTest(self):
166166
self.assertTrue(False, "memcpy_afu_ctx tests failed")
167167

168168

169+
class MemCpyAFUIrqTest(OpTestCAPI, unittest.TestCase):
170+
'''
171+
If a given system has a CAPI FPGA card, then this test load the cxl module
172+
if required and test the memcpy AFU with memcpy_afu_ctx -i
173+
'''
174+
def setUp(self):
175+
super(MemCpyAFUIrqTest, self).setUp()
176+
177+
def runTest(self):
178+
self.set_up()
179+
180+
# Check that cxl-tests binary and library are available
181+
# If not, clone and build cxl-tests (along with libcxl)
182+
l_dir = "/tmp/cxl-tests"
183+
if (self.cv_HOST.host_check_binary(l_dir, "memcpy_afu_ctx") != True or
184+
self.cv_HOST.host_check_binary(l_dir, "libcxl/libcxl.so") != True):
185+
self.cv_HOST.host_clone_cxl_tests(l_dir)
186+
self.cv_HOST.host_build_cxl_tests(l_dir)
187+
188+
# Run memcpy afu tests
189+
l_exec = "memcpy_afu_ctx -p100 -i5 -I5 -l10000 >/tmp/memcpy_afu_ctx-i.log"
190+
cmd = "cd %s && LD_LIBRARY_PATH=libcxl ./%s" % (l_dir, l_exec)
191+
log.debug(cmd)
192+
try:
193+
self.cv_HOST.host_run_command(cmd)
194+
l_msg = "memcpy_afu_ctx -i tests pass"
195+
log.debug(l_msg)
196+
except CommandFailed:
197+
self.assertTrue(False, "memcpy_afu_ctx -i tests failed")
198+
199+
200+
class MemCpyAFUReallocTest(OpTestCAPI, unittest.TestCase):
201+
'''
202+
If a given system has a CAPI FPGA card, then this test load the cxl module
203+
if required and test the memcpy AFU with memcpy_afu_ctx -r
204+
'''
205+
def setUp(self):
206+
super(MemCpyAFUReallocTest, self).setUp()
207+
208+
def runTest(self):
209+
self.set_up()
210+
211+
# Check that cxl-tests binary and library are available
212+
# If not, clone and build cxl-tests (along with libcxl)
213+
l_dir = "/tmp/cxl-tests"
214+
if (self.cv_HOST.host_check_binary(l_dir, "memcpy_afu_ctx") != True or
215+
self.cv_HOST.host_check_binary(l_dir, "libcxl/libcxl.so") != True):
216+
self.cv_HOST.host_clone_cxl_tests(l_dir)
217+
self.cv_HOST.host_build_cxl_tests(l_dir)
218+
219+
# Run memcpy afu tests
220+
l_exec = "memcpy_afu_ctx -p0 -r -l3000 >/tmp/memcpy_afu_ctx-r.log"
221+
cmd = "cd %s && LD_LIBRARY_PATH=libcxl ./%s" % (l_dir, l_exec)
222+
log.debug(cmd)
223+
try:
224+
self.cv_HOST.host_run_command(cmd)
225+
l_msg = "memcpy_afu_ctx -r tests pass"
226+
log.debug(l_msg)
227+
except CommandFailed:
228+
self.assertTrue(False, "memcpy_afu_ctx -r tests failed")
229+
230+
169231
class TimeBaseSyncTest(OpTestCAPI, unittest.TestCase):
170232
'''
171233
If a given system has a CAPI FPGA card, then this test load the cxl module
@@ -210,5 +272,7 @@ def capi_test_suite():
210272
s.addTest(CxlDeviceFileTest())
211273
s.addTest(SysfsABITest())
212274
s.addTest(MemCpyAFUTest())
275+
s.addTest(MemCpyAFUIrqTest())
276+
s.addTest(MemCpyAFUReallocTest())
213277
s.addTest(TimeBaseSyncTest())
214278
return s

0 commit comments

Comments
 (0)