cyborg/cyborg/tests/unit/accelerator
chenke c9277285a3 Fix method 'test_discover' assertError in test_driver.py
The error info as follows:

testtools.matchers._impl.MismatchError: !=:
reference = {'cpid_info': '0000:5e:00.0', 'cpid_type': 'pci'}
actual    = {'cpid_info': u'0000:be:00.0', 'cpid_type': u'pci'}

The reason for assertError is that 'intel-fpga-dev.2' is found
earilier than 'intel-fpga-dev.1' randomly because of the module
'glob.glob'.

In cyborg/accelerator/drivers/fpga/intel/sysinfo.py Line 81,
method all_pf_fpgas(), it use glob.glob(..) to find fpga dirvers.
However, this glob module does not guarantee that the file name
obtained is ordered.

For convenience, we can sort the fpgas before assert.

Reference docs:
https://docs.python.org/2.7/library/glob.html?highlight=glob#glob.glob
https://docs.python.org/2.7/library/os.html?highlight=listdir#os.listdir
http://landcareweb.com/questions/34393/an-ri-qi-shun-xu-sou-suo-glob

Change-Id: Ie9de5d7ec06064f557620ec4ee21f7bd776c2add
2019-03-20 11:47:02 +08:00
..
drivers Fix method 'test_discover' assertError in test_driver.py 2019-03-20 11:47:02 +08:00
__init__.py add test case for agent resource tracker 2018-02-07 15:43:46 +00:00