diff mbox series

[rdma-core,03/14] build: Add pyverbs-based test to the build

Message ID 20190819065827.26921-4-noaos@mellanox.com (mailing list archive)
State Not Applicable
Headers show
Series rdma-core tests infrastructure | expand

Commit Message

Noa Osherovich Aug. 19, 2019, 6:58 a.m. UTC
Have the tests installed separately from pyverbs as they're not a
part of the package. They will now be placed under
/usr/share/doc/rdma-core-{version}/tests.
The tests can be executed as follows:
python3 /usr/share/doc/rdma-core-{version}/run_tests.py

Signed-off-by: Noa Osherovich <noaos@mellanox.com>
---
 CMakeLists.txt                       | 11 +++++++++++
 buildlib/pyverbs_functions.cmake     |  7 +++++++
 debian/python3-pyverbs.install       |  2 ++
 pyverbs/CMakeLists.txt               | 17 -----------------
 redhat/rdma-core.spec                |  2 ++
 pyverbs/run_tests.py => run_tests.py |  0
 suse/rdma-core.spec                  |  2 ++
 7 files changed, 24 insertions(+), 17 deletions(-)
 rename pyverbs/run_tests.py => run_tests.py (100%)

Comments

Jason Gunthorpe Aug. 19, 2019, 1:50 p.m. UTC | #1
On Mon, Aug 19, 2019 at 09:58:16AM +0300, Noa Osherovich wrote:
> Have the tests installed separately from pyverbs as they're not a
> part of the package. They will now be placed under
> /usr/share/doc/rdma-core-{version}/tests.
> The tests can be executed as follows:
> python3 /usr/share/doc/rdma-core-{version}/run_tests.py
> 
> Signed-off-by: Noa Osherovich <noaos@mellanox.com>
>  CMakeLists.txt                       | 11 +++++++++++
>  buildlib/pyverbs_functions.cmake     |  7 +++++++
>  debian/python3-pyverbs.install       |  2 ++
>  pyverbs/CMakeLists.txt               | 17 -----------------
>  redhat/rdma-core.spec                |  2 ++
>  pyverbs/run_tests.py => run_tests.py |  0

I'd prefer run_tests to be in the tests directory..

Jason
Noa Osherovich Aug. 20, 2019, 1 p.m. UTC | #2
On 8/19/2019 4:50 PM, Jason Gunthorpe wrote:

> I'd prefer run_tests to be in the tests directory..
>
> Jason

PR was updated

Thanks,
Noa
Leon Romanovsky Aug. 22, 2019, 4:18 p.m. UTC | #3
On Tue, Aug 20, 2019 at 01:00:47PM +0000, Noa Osherovich wrote:
> On 8/19/2019 4:50 PM, Jason Gunthorpe wrote:
>
> > I'd prefer run_tests to be in the tests directory..
> >
> > Jason
>
> PR was updated

1.
IMHO, run_tests.py should be placed inside tests directory too and not
only installed into tests/.

➜  rdma-core git:(noaos-pr-tests) ✗ pwd
/images/leonro/src/rdma-core
➜  rdma-core git:(noaos-pr-tests) ✗ ls -al | grep  run_tests.py
-rw-rw-r--.  1 leonro leonro   549 Aug 22 18:59 run_tests.py

Expected
➜  rdma-core git:(noaos-pr-tests) ✗ ls -al tests/ | grep  run_tests.py
-rw-rw-r--.  1 leonro leonro   549 Aug 22 18:59 run_tests.py

2.
Execution of run_tests.py produces a lot of untracked filed
➜  rdma-core git:(noaos-pr-tests) ✗ git st
On branch noaos-pr-tests
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	pyverbs/__init__.pyc
	pyverbs/pyverbs_error.pyc
	tests/__init__.pyc
	tests/base.pyc
	tests/test_addr.pyc
	tests/test_cq.pyc
	tests/test_device.pyc
	tests/test_mr.pyc
	tests/test_odp.pyc
	tests/test_pd.pyc
	tests/test_qp.pyc

3. run_tests.py lacks of python3 shebang
4. Attempt to run on system without ib* modules causes to awful splat.
Is it expected?
t:(noaos-pr-tests) python ./run_tests.py
EEEEEEE
======================================================================
ERROR: test_mr (unittest.loader.ModuleImportFailure)
----------------------------------------------------------------------
ImportError: Failed to import test module: test_mr
Traceback (most recent call last):
  File "/usr/lib64/python2.7/unittest/loader.py", line 254, in   _find_tests
    module = self._get_module_from_name(name)
  File "/usr/lib64/python2.7/unittest/loader.py", line 232, in _get_module_from_name
    __import__(name)
  File "/images/leonro/src/rdma-core/tests/test_mr.py", line 10, in <module>
    from tests.base import PyverbsAPITestCase
  File "/images/leonro/src/rdma-core/tests/base.py", line 7, in <module>
    from pyverbs.qp import QPCap, QPInitAttr, QPAttr, QP
ImportError: No module named qp

.....

----------------------------------------------------------------------
Ran 7 tests in 0.000s

FAILED (errors=7)

Thanks

>
> Thanks,
> Noa
>
Jason Gunthorpe Aug. 22, 2019, 4:52 p.m. UTC | #4
On Thu, Aug 22, 2019 at 01:18:24PM -0300, Leon Romanovsky wrote:
> On Tue, Aug 20, 2019 at 01:00:47PM +0000, Noa Osherovich wrote:
> > On 8/19/2019 4:50 PM, Jason Gunthorpe wrote:
> >
> > > I'd prefer run_tests to be in the tests directory..
> > >
> > > Jason
> >
> > PR was updated
> 
> 1.
> IMHO, run_tests.py should be placed inside tests directory too and not
> only installed into tests/.

Yes, this is what I ment. The file should be in tests/ and it should
be built into build/bin, and installed into the examples


> 2.
> Execution of run_tests.py produces a lot of untracked filed
> ➜  rdma-core git:(noaos-pr-tests) ✗ git st
> On branch noaos-pr-tests
> Untracked files:
>   (use "git add <file>..." to include in what will be committed)
> 
> 	pyverbs/__init__.pyc
> 	pyverbs/pyverbs_error.pyc
> 	tests/__init__.pyc
> 	tests/base.pyc
> 	tests/test_addr.pyc
> 	tests/test_cq.pyc
> 	tests/test_device.pyc
> 	tests/test_mr.pyc
> 	tests/test_odp.pyc
> 	tests/test_pd.pyc
> 	tests/test_qp.pyc

*.pyc will have to be added to the .gitignore

> 3. run_tests.py lacks of python3 shebang

Originally it was not installed, so this was fine, as the build/bin
script does all the required setup, however now that it is to be
installed it should have the #! - and it should also work without any
trouble from it's example location.

Jason
Noa Osherovich Sept. 1, 2019, 1:30 p.m. UTC | #5
On 8/22/2019 7:52 PM, Jason Gunthorpe wrote:

> On Thu, Aug 22, 2019 at 01:18:24PM -0300, Leon Romanovsky wrote:
>> On Tue, Aug 20, 2019 at 01:00:47PM +0000, Noa Osherovich wrote:
>>> On 8/19/2019 4:50 PM, Jason Gunthorpe wrote:
>>>
>>>> I'd prefer run_tests to be in the tests directory..
>>>>
>>>> Jason
>>> PR was updated
>> 1.
>> IMHO, run_tests.py should be placed inside tests directory too and not
>> only installed into tests/.
> Yes, this is what I ment. The file should be in tests/ and it should
> be built into build/bin, and installed into the examples
>> 2.
>> Execution of run_tests.py produces a lot of untracked filed
>> ➜  rdma-core git:(noaos-pr-tests) ✗ git st
>> On branch noaos-pr-tests
>> Untracked files:
>>   (use "git add <file>..." to include in what will be committed)
>>
>> 	pyverbs/__init__.pyc
>> 	pyverbs/pyverbs_error.pyc
>> 	tests/__init__.pyc
>> 	tests/base.pyc
>> 	tests/test_addr.pyc
>> 	tests/test_cq.pyc
>> 	tests/test_device.pyc
>> 	tests/test_mr.pyc
>> 	tests/test_odp.pyc
>> 	tests/test_pd.pyc
>> 	tests/test_qp.pyc
> *.pyc will have to be added to the .gitignore
>> 3. run_tests.py lacks of python3 shebang
> Originally it was not installed, so this was fine, as the build/bin
> script does all the required setup, however now that it is to be
> installed it should have the #! - and it should also work without any
> trouble from it's example location.
>
> Jason

PR was updated.

Thanks,

Noa
Leon Romanovsky Sept. 9, 2019, 10:29 a.m. UTC | #6
On Sun, Sep 01, 2019 at 01:30:56PM +0000, Noa Osherovich wrote:
> On 8/22/2019 7:52 PM, Jason Gunthorpe wrote:
>
> > On Thu, Aug 22, 2019 at 01:18:24PM -0300, Leon Romanovsky wrote:
> >> On Tue, Aug 20, 2019 at 01:00:47PM +0000, Noa Osherovich wrote:
> >>> On 8/19/2019 4:50 PM, Jason Gunthorpe wrote:
> >>>
> >>>> I'd prefer run_tests to be in the tests directory..
> >>>>
> >>>> Jason
> >>> PR was updated
> >> 1.
> >> IMHO, run_tests.py should be placed inside tests directory too and not
> >> only installed into tests/.
> > Yes, this is what I ment. The file should be in tests/ and it should
> > be built into build/bin, and installed into the examples
> >> 2.
> >> Execution of run_tests.py produces a lot of untracked filed
> >> ➜  rdma-core git:(noaos-pr-tests) ✗ git st
> >> On branch noaos-pr-tests
> >> Untracked files:
> >>   (use "git add <file>..." to include in what will be committed)
> >>
> >> 	pyverbs/__init__.pyc
> >> 	pyverbs/pyverbs_error.pyc
> >> 	tests/__init__.pyc
> >> 	tests/base.pyc
> >> 	tests/test_addr.pyc
> >> 	tests/test_cq.pyc
> >> 	tests/test_device.pyc
> >> 	tests/test_mr.pyc
> >> 	tests/test_odp.pyc
> >> 	tests/test_pd.pyc
> >> 	tests/test_qp.pyc
> > *.pyc will have to be added to the .gitignore
> >> 3. run_tests.py lacks of python3 shebang
> > Originally it was not installed, so this was fine, as the build/bin
> > script does all the required setup, however now that it is to be
> > installed it should have the #! - and it should also work without any
> > trouble from it's example location.
> >
> > Jason
>
> PR was updated.

I tried it now and got very confusing results.

On my machine there are no ib_devices, and I expected to see ALL tests
marked as skipped, but got two skipped only, is it expected behaviour?

_  rdma-core git:(noaos-pr-tests) ./build/bin/run_tests.py
..........................................ss...............
----------------------------------------------------------------------
Ran 59 tests in 0.004s

OK (skipped=2)

Thanks

>
> Thanks,
>
> Noa
>
Noa Osherovich Sept. 9, 2019, 10:39 a.m. UTC | #7
On 9/9/2019 1:29 PM, Leon Romanovsky wrote:
> On Sun, Sep 01, 2019 at 01:30:56PM +0000, Noa Osherovich wrote:
>> On 8/22/2019 7:52 PM, Jason Gunthorpe wrote:
>>
>>> On Thu, Aug 22, 2019 at 01:18:24PM -0300, Leon Romanovsky wrote:
>>>> On Tue, Aug 20, 2019 at 01:00:47PM +0000, Noa Osherovich wrote:
>>>>> On 8/19/2019 4:50 PM, Jason Gunthorpe wrote:
>>>>>
>>>>>> I'd prefer run_tests to be in the tests directory..
>>>>>>
>>>>>> Jason
>>>>> PR was updated
>>>> 1.
>>>> IMHO, run_tests.py should be placed inside tests directory too and not
>>>> only installed into tests/.
>>> Yes, this is what I ment. The file should be in tests/ and it should
>>> be built into build/bin, and installed into the examples
>>>> 2.
>>>> Execution of run_tests.py produces a lot of untracked filed
>>>> ➜  rdma-core git:(noaos-pr-tests) ✗ git st
>>>> On branch noaos-pr-tests
>>>> Untracked files:
>>>>   (use "git add <file>..." to include in what will be committed)
>>>>
>>>> 	pyverbs/__init__.pyc
>>>> 	pyverbs/pyverbs_error.pyc
>>>> 	tests/__init__.pyc
>>>> 	tests/base.pyc
>>>> 	tests/test_addr.pyc
>>>> 	tests/test_cq.pyc
>>>> 	tests/test_device.pyc
>>>> 	tests/test_mr.pyc
>>>> 	tests/test_odp.pyc
>>>> 	tests/test_pd.pyc
>>>> 	tests/test_qp.pyc
>>> *.pyc will have to be added to the .gitignore
>>>> 3. run_tests.py lacks of python3 shebang
>>> Originally it was not installed, so this was fine, as the build/bin
>>> script does all the required setup, however now that it is to be
>>> installed it should have the #! - and it should also work without any
>>> trouble from it's example location.
>>>
>>> Jason
>> PR was updated.
> I tried it now and got very confusing results.
>
> On my machine there are no ib_devices, and I expected to see ALL tests
> marked as skipped, but got two skipped only, is it expected behaviour?

Yes. If you recall, our previous unittests worked differently than the new ones; each
test would iterate over an array of all available devices and would run on each device.
The array can be of length 0. If no failure was found, they're marked as passed.
The new tests skip (the reported 's' you saw) in case a combination of device/port/GID
index wasn't found.

Thanks,
Noa

>
> _  rdma-core git:(noaos-pr-tests) ./build/bin/run_tests.py
> ..........................................ss...............
> ----------------------------------------------------------------------
> Ran 59 tests in 0.004s
>
> OK (skipped=2)
>
> Thanks
>
>> Thanks,
>>
>> Noa
>>
Leon Romanovsky Sept. 9, 2019, 11:26 a.m. UTC | #8
On Mon, Sep 09, 2019 at 10:39:44AM +0000, Noa Osherovich wrote:
>
> On 9/9/2019 1:29 PM, Leon Romanovsky wrote:
> > On Sun, Sep 01, 2019 at 01:30:56PM +0000, Noa Osherovich wrote:
> >> On 8/22/2019 7:52 PM, Jason Gunthorpe wrote:
> >>
> >>> On Thu, Aug 22, 2019 at 01:18:24PM -0300, Leon Romanovsky wrote:
> >>>> On Tue, Aug 20, 2019 at 01:00:47PM +0000, Noa Osherovich wrote:
> >>>>> On 8/19/2019 4:50 PM, Jason Gunthorpe wrote:
> >>>>>
> >>>>>> I'd prefer run_tests to be in the tests directory..
> >>>>>>
> >>>>>> Jason
> >>>>> PR was updated
> >>>> 1.
> >>>> IMHO, run_tests.py should be placed inside tests directory too and not
> >>>> only installed into tests/.
> >>> Yes, this is what I ment. The file should be in tests/ and it should
> >>> be built into build/bin, and installed into the examples
> >>>> 2.
> >>>> Execution of run_tests.py produces a lot of untracked filed
> >>>> ➜  rdma-core git:(noaos-pr-tests) ✗ git st
> >>>> On branch noaos-pr-tests
> >>>> Untracked files:
> >>>>   (use "git add <file>..." to include in what will be committed)
> >>>>
> >>>> 	pyverbs/__init__.pyc
> >>>> 	pyverbs/pyverbs_error.pyc
> >>>> 	tests/__init__.pyc
> >>>> 	tests/base.pyc
> >>>> 	tests/test_addr.pyc
> >>>> 	tests/test_cq.pyc
> >>>> 	tests/test_device.pyc
> >>>> 	tests/test_mr.pyc
> >>>> 	tests/test_odp.pyc
> >>>> 	tests/test_pd.pyc
> >>>> 	tests/test_qp.pyc
> >>> *.pyc will have to be added to the .gitignore
> >>>> 3. run_tests.py lacks of python3 shebang
> >>> Originally it was not installed, so this was fine, as the build/bin
> >>> script does all the required setup, however now that it is to be
> >>> installed it should have the #! - and it should also work without any
> >>> trouble from it's example location.
> >>>
> >>> Jason
> >> PR was updated.
> > I tried it now and got very confusing results.
> >
> > On my machine there are no ib_devices, and I expected to see ALL tests
> > marked as skipped, but got two skipped only, is it expected behaviour?
>
> Yes. If you recall, our previous unittests worked differently than the new ones; each
> test would iterate over an array of all available devices and would run on each device.
> The array can be of length 0. If no failure was found, they're marked as passed.
> The new tests skip (the reported 's' you saw) in case a combination of device/port/GID
> index wasn't found.

array length 0 should return "skipped" and not "passed".

Thanks

>
> Thanks,
> Noa
>
> >
> > _  rdma-core git:(noaos-pr-tests) ./build/bin/run_tests.py
> > ..........................................ss...............
> > ----------------------------------------------------------------------
> > Ran 59 tests in 0.004s
> >
> > OK (skipped=2)
> >
> > Thanks
> >
> >> Thanks,
> >>
> >> Noa
> >>
Noa Osherovich Sept. 9, 2019, 11:30 a.m. UTC | #9
On 9/9/2019 2:26 PM, Leon Romanovsky wrote:
> On Mon, Sep 09, 2019 at 10:39:44AM +0000, Noa Osherovich wrote:
>> On 9/9/2019 1:29 PM, Leon Romanovsky wrote:
>>> On Sun, Sep 01, 2019 at 01:30:56PM +0000, Noa Osherovich wrote:
>>>> On 8/22/2019 7:52 PM, Jason Gunthorpe wrote:
>>>>
>>>>> On Thu, Aug 22, 2019 at 01:18:24PM -0300, Leon Romanovsky wrote:
>>>>>> On Tue, Aug 20, 2019 at 01:00:47PM +0000, Noa Osherovich wrote:
>>>>>>> On 8/19/2019 4:50 PM, Jason Gunthorpe wrote:
>>>>>>>
>>>>>>>> I'd prefer run_tests to be in the tests directory..
>>>>>>>>
>>>>>>>> Jason
>>>>>>> PR was updated
>>>>>> 1.
>>>>>> IMHO, run_tests.py should be placed inside tests directory too and not
>>>>>> only installed into tests/.
>>>>> Yes, this is what I ment. The file should be in tests/ and it should
>>>>> be built into build/bin, and installed into the examples
>>>>>> 2.
>>>>>> Execution of run_tests.py produces a lot of untracked filed
>>>>>> ➜  rdma-core git:(noaos-pr-tests) ✗ git st
>>>>>> On branch noaos-pr-tests
>>>>>> Untracked files:
>>>>>>   (use "git add <file>..." to include in what will be committed)
>>>>>>
>>>>>> 	pyverbs/__init__.pyc
>>>>>> 	pyverbs/pyverbs_error.pyc
>>>>>> 	tests/__init__.pyc
>>>>>> 	tests/base.pyc
>>>>>> 	tests/test_addr.pyc
>>>>>> 	tests/test_cq.pyc
>>>>>> 	tests/test_device.pyc
>>>>>> 	tests/test_mr.pyc
>>>>>> 	tests/test_odp.pyc
>>>>>> 	tests/test_pd.pyc
>>>>>> 	tests/test_qp.pyc
>>>>> *.pyc will have to be added to the .gitignore
>>>>>> 3. run_tests.py lacks of python3 shebang
>>>>> Originally it was not installed, so this was fine, as the build/bin
>>>>> script does all the required setup, however now that it is to be
>>>>> installed it should have the #! - and it should also work without any
>>>>> trouble from it's example location.
>>>>>
>>>>> Jason
>>>> PR was updated.
>>> I tried it now and got very confusing results.
>>>
>>> On my machine there are no ib_devices, and I expected to see ALL tests
>>> marked as skipped, but got two skipped only, is it expected behaviour?
>> Yes. If you recall, our previous unittests worked differently than the new ones; each
>> test would iterate over an array of all available devices and would run on each device.
>> The array can be of length 0. If no failure was found, they're marked as passed.
>> The new tests skip (the reported 's' you saw) in case a combination of device/port/GID
>> index wasn't found.
> array length 0 should return "skipped" and not "passed".
>
> Thanks

Leon, these are older tests, not related to the current PR.
I can update their behavior, but let's separate it from the PR.

Thanks,
Noa

>> Thanks,
>> Noa
>>
>>> _  rdma-core git:(noaos-pr-tests) ./build/bin/run_tests.py
>>> ..........................................ss...............
>>> ----------------------------------------------------------------------
>>> Ran 59 tests in 0.004s
>>>
>>> OK (skipped=2)
>>>
>>> Thanks
>>>
>>>> Thanks,
>>>>
>>>> Noa
>>>>
Leon Romanovsky Sept. 9, 2019, 11:34 a.m. UTC | #10
On Mon, Sep 09, 2019 at 11:26:35AM +0000, Leon Romanovsky wrote:
> On Mon, Sep 09, 2019 at 10:39:44AM +0000, Noa Osherovich wrote:
> >
> > On 9/9/2019 1:29 PM, Leon Romanovsky wrote:
> > > On Sun, Sep 01, 2019 at 01:30:56PM +0000, Noa Osherovich wrote:
> > >> On 8/22/2019 7:52 PM, Jason Gunthorpe wrote:
> > >>
> > >>> On Thu, Aug 22, 2019 at 01:18:24PM -0300, Leon Romanovsky wrote:
> > >>>> On Tue, Aug 20, 2019 at 01:00:47PM +0000, Noa Osherovich wrote:
> > >>>>> On 8/19/2019 4:50 PM, Jason Gunthorpe wrote:
> > >>>>>
> > >>>>>> I'd prefer run_tests to be in the tests directory..
> > >>>>>>
> > >>>>>> Jason
> > >>>>> PR was updated
> > >>>> 1.
> > >>>> IMHO, run_tests.py should be placed inside tests directory too and not
> > >>>> only installed into tests/.
> > >>> Yes, this is what I ment. The file should be in tests/ and it should
> > >>> be built into build/bin, and installed into the examples
> > >>>> 2.
> > >>>> Execution of run_tests.py produces a lot of untracked filed
> > >>>> ➜  rdma-core git:(noaos-pr-tests) ✗ git st
> > >>>> On branch noaos-pr-tests
> > >>>> Untracked files:
> > >>>>   (use "git add <file>..." to include in what will be committed)
> > >>>>
> > >>>> 	pyverbs/__init__.pyc
> > >>>> 	pyverbs/pyverbs_error.pyc
> > >>>> 	tests/__init__.pyc
> > >>>> 	tests/base.pyc
> > >>>> 	tests/test_addr.pyc
> > >>>> 	tests/test_cq.pyc
> > >>>> 	tests/test_device.pyc
> > >>>> 	tests/test_mr.pyc
> > >>>> 	tests/test_odp.pyc
> > >>>> 	tests/test_pd.pyc
> > >>>> 	tests/test_qp.pyc
> > >>> *.pyc will have to be added to the .gitignore
> > >>>> 3. run_tests.py lacks of python3 shebang
> > >>> Originally it was not installed, so this was fine, as the build/bin
> > >>> script does all the required setup, however now that it is to be
> > >>> installed it should have the #! - and it should also work without any
> > >>> trouble from it's example location.
> > >>>
> > >>> Jason
> > >> PR was updated.
> > > I tried it now and got very confusing results.
> > >
> > > On my machine there are no ib_devices, and I expected to see ALL tests
> > > marked as skipped, but got two skipped only, is it expected behaviour?
> >
> > Yes. If you recall, our previous unittests worked differently than the new ones; each
> > test would iterate over an array of all available devices and would run on each device.
> > The array can be of length 0. If no failure was found, they're marked as passed.
> > The new tests skip (the reported 's' you saw) in case a combination of device/port/GID
> > index wasn't found.
>
> array length 0 should return "skipped" and not "passed".

I run over IB device over rdma-next and get very exciting splat.

[leonro@server ~]$
/images/leonro/src/rdma-core/build/bin/run_tests.py
.....EFE..................................ss...............
======================================================================
ERROR: test_create_cq_ex (test_cq.CQEXTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/images/leonro/src/rdma-core/tests/test_cq.py", line 118, in test_create_cq_ex
      with CQEX(ctx, get_attrs_ex(attr, attr_ex)):
  File "cq.pyx", line 264, in pyverbs.cq.CQEX.__cinit__
pyverbs.pyverbs_error.PyverbsRDMAError: Failed to create extended CQ. Errno: 95, Operation not supported

and many more.

>
> Thanks
>
> >
> > Thanks,
> > Noa
> >
> > >
> > > _  rdma-core git:(noaos-pr-tests) ./build/bin/run_tests.py
> > > ..........................................ss...............
> > > ----------------------------------------------------------------------
> > > Ran 59 tests in 0.004s
> > >
> > > OK (skipped=2)
> > >
> > > Thanks
> > >
> > >> Thanks,
> > >>
> > >> Noa
> > >>
Leon Romanovsky Sept. 9, 2019, 11:38 a.m. UTC | #11
On Mon, Sep 09, 2019 at 11:30:07AM +0000, Noa Osherovich wrote:
>
> On 9/9/2019 2:26 PM, Leon Romanovsky wrote:
> > On Mon, Sep 09, 2019 at 10:39:44AM +0000, Noa Osherovich wrote:
> >> On 9/9/2019 1:29 PM, Leon Romanovsky wrote:
> >>> On Sun, Sep 01, 2019 at 01:30:56PM +0000, Noa Osherovich wrote:
> >>>> On 8/22/2019 7:52 PM, Jason Gunthorpe wrote:
> >>>>
> >>>>> On Thu, Aug 22, 2019 at 01:18:24PM -0300, Leon Romanovsky wrote:
> >>>>>> On Tue, Aug 20, 2019 at 01:00:47PM +0000, Noa Osherovich wrote:
> >>>>>>> On 8/19/2019 4:50 PM, Jason Gunthorpe wrote:
> >>>>>>>
> >>>>>>>> I'd prefer run_tests to be in the tests directory..
> >>>>>>>>
> >>>>>>>> Jason
> >>>>>>> PR was updated
> >>>>>> 1.
> >>>>>> IMHO, run_tests.py should be placed inside tests directory too and not
> >>>>>> only installed into tests/.
> >>>>> Yes, this is what I ment. The file should be in tests/ and it should
> >>>>> be built into build/bin, and installed into the examples
> >>>>>> 2.
> >>>>>> Execution of run_tests.py produces a lot of untracked filed
> >>>>>> ➜  rdma-core git:(noaos-pr-tests) ✗ git st
> >>>>>> On branch noaos-pr-tests
> >>>>>> Untracked files:
> >>>>>>   (use "git add <file>..." to include in what will be committed)
> >>>>>>
> >>>>>> 	pyverbs/__init__.pyc
> >>>>>> 	pyverbs/pyverbs_error.pyc
> >>>>>> 	tests/__init__.pyc
> >>>>>> 	tests/base.pyc
> >>>>>> 	tests/test_addr.pyc
> >>>>>> 	tests/test_cq.pyc
> >>>>>> 	tests/test_device.pyc
> >>>>>> 	tests/test_mr.pyc
> >>>>>> 	tests/test_odp.pyc
> >>>>>> 	tests/test_pd.pyc
> >>>>>> 	tests/test_qp.pyc
> >>>>> *.pyc will have to be added to the .gitignore
> >>>>>> 3. run_tests.py lacks of python3 shebang
> >>>>> Originally it was not installed, so this was fine, as the build/bin
> >>>>> script does all the required setup, however now that it is to be
> >>>>> installed it should have the #! - and it should also work without any
> >>>>> trouble from it's example location.
> >>>>>
> >>>>> Jason
> >>>> PR was updated.
> >>> I tried it now and got very confusing results.
> >>>
> >>> On my machine there are no ib_devices, and I expected to see ALL tests
> >>> marked as skipped, but got two skipped only, is it expected behaviour?
> >> Yes. If you recall, our previous unittests worked differently than the new ones; each
> >> test would iterate over an array of all available devices and would run on each device.
> >> The array can be of length 0. If no failure was found, they're marked as passed.
> >> The new tests skip (the reported 's' you saw) in case a combination of device/port/GID
> >> index wasn't found.
> > array length 0 should return "skipped" and not "passed".
> >
> > Thanks
>
> Leon, these are older tests, not related to the current PR.
> I can update their behavior, but let's separate it from the PR.

Great, please update.

Thanks

>
> Thanks,
> Noa
>
> >> Thanks,
> >> Noa
> >>
> >>> _  rdma-core git:(noaos-pr-tests) ./build/bin/run_tests.py
> >>> ..........................................ss...............
> >>> ----------------------------------------------------------------------
> >>> Ran 59 tests in 0.004s
> >>>
> >>> OK (skipped=2)
> >>>
> >>> Thanks
> >>>
> >>>> Thanks,
> >>>>
> >>>> Noa
> >>>>
diff mbox series

Patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fc17ef36cf24..d076ab2c9d3a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -648,6 +648,7 @@  add_subdirectory(infiniband-diags/man)
 
 if (CYTHON_EXECUTABLE)
   add_subdirectory(pyverbs)
+  add_subdirectory(tests)
 endif()
 
 # Binaries
@@ -666,6 +667,16 @@  if (UDEV_FOUND)
 endif()
 add_subdirectory(srp_daemon)
 
+if (CYTHON_EXECUTABLE)
+rdma_python_test(""
+  run_tests.py
+  )
+
+rdma_internal_binary(
+  run_tests.py
+  )
+endif()
+
 ibverbs_finalize()
 rdma_finalize_libs()
 
diff --git a/buildlib/pyverbs_functions.cmake b/buildlib/pyverbs_functions.cmake
index 9d5258617035..8ea5dc0df7de 100644
--- a/buildlib/pyverbs_functions.cmake
+++ b/buildlib/pyverbs_functions.cmake
@@ -35,6 +35,13 @@  function(rdma_python_module PY_MODULE)
   endforeach()
 endfunction()
 
+function(rdma_python_test PY_MODULE)
+  foreach(PY_FILE ${ARGN})
+    install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PY_FILE}
+      DESTINATION ${CMAKE_INSTALL_DOCDIR}/${PY_MODULE})
+  endforeach()
+endfunction()
+
 # Make a python script runnable from the build/bin directory with all the
 # correct paths filled in
 function(rdma_internal_binary)
diff --git a/debian/python3-pyverbs.install b/debian/python3-pyverbs.install
index 20130d8a9a03..10efb97232fd 100644
--- a/debian/python3-pyverbs.install
+++ b/debian/python3-pyverbs.install
@@ -1 +1,3 @@ 
 usr/lib/python3/dist-packages/pyverbs
+usr/share/doc/rdma-core/run_tests.py
+usr/share/doc/rdma-core/tests
diff --git a/pyverbs/CMakeLists.txt b/pyverbs/CMakeLists.txt
index 328263fcc739..da49093c2cf0 100644
--- a/pyverbs/CMakeLists.txt
+++ b/pyverbs/CMakeLists.txt
@@ -16,22 +16,5 @@  rdma_cython_module(pyverbs
 rdma_python_module(pyverbs
   __init__.py
   pyverbs_error.py
-  run_tests.py
   utils.py
   )
-
-rdma_python_module(pyverbs/tests
-  tests/__init__.py
-  tests/addr.py
-  tests/base.py
-  tests/cq.py
-  tests/device.py
-  tests/mr.py
-  tests/pd.py
-  tests/qp.py
-  tests/utils.py
-  )
-
-rdma_internal_binary(
-  run_tests.py
-  )
diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec
index f07919ccecd5..239c56b581e8 100644
--- a/redhat/rdma-core.spec
+++ b/redhat/rdma-core.spec
@@ -650,4 +650,6 @@  rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
 %if %{with_pyverbs}
 %files -n python3-pyverbs
 %{python3_sitearch}/pyverbs
+%{_docdir}/%{name}-%{version}/tests/*.py
+%{_docdir}/%{name}-%{version}/run_tests.py
 %endif
diff --git a/pyverbs/run_tests.py b/run_tests.py
similarity index 100%
rename from pyverbs/run_tests.py
rename to run_tests.py
diff --git a/suse/rdma-core.spec b/suse/rdma-core.spec
index 5a01327c4852..cdb6793e4f75 100644
--- a/suse/rdma-core.spec
+++ b/suse/rdma-core.spec
@@ -852,6 +852,8 @@  rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
 %if %{with_pyverbs}
 %files -n python3-pyverbs
 %{python3_sitearch}/pyverbs
+%{_docdir}/%{name}-%{version}/tests/*.py
+%{_docdir}/%{name}-%{version}/run_tests.py
 %endif
 
 %changelog