adafruit / adafruit-beaglebone-io-python

Adafruit's BeagleBone IO Python Library
http://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black
477 stars 217 forks source link

fix BeagleBone Blue support to pass pytest #283

Open pdp7 opened 6 years ago

pdp7 commented 6 years ago

BeagleBone Blue fails to pass many of the pytest unit tests.

pdp7 commented 6 years ago

for example:

debian@beaglebone:~/ssh/adafruit-beaglebone-io-python/test$ sudo python2 -mpytest test_adc.py
==================================================================== test session starts =====================================================================
platform linux2 -- Python 2.7.13, pytest-3.0.6, py-1.4.32, pluggy-0.4.0
rootdir: /home/debian/ssh/adafruit-beaglebone-io-python, inifile: 
collected 6 items 

test_adc.py ..FFFF

========================================================================== FAILURES ==========================================================================
___________________________________________________________________ TestAdc.test_setup_adc ___________________________________________________________________

self = <test_adc.TestAdc instance at 0xb65e2e40>

    def test_setup_adc(self):

>       ADC.setup()
E       RuntimeError: Unable to setup ADC system. Possible causes are: 
E         - A cape with a conflicting pin mapping is loaded 
E         - A device tree object is loaded that uses the same name for a fragment: helper

test_adc.py:23: RuntimeError
___________________________________________________________________ TestAdc.test_read_adc ____________________________________________________________________

self = <test_adc.TestAdc instance at 0xb6652828>

    def test_read_adc(self):
>       ADC.setup()
E       RuntimeError: Unable to setup ADC system. Possible causes are: 
E         - A cape with a conflicting pin mapping is loaded 
E         - A device tree object is loaded that uses the same name for a fragment: helper

test_adc.py:39: RuntimeError
_________________________________________________________________ TestAdc.test_read_raw_adc __________________________________________________________________

self = <test_adc.TestAdc instance at 0xb65f8030>

    def test_read_raw_adc(self):
>       ADC.setup()
E       RuntimeError: Unable to setup ADC system. Possible causes are: 
E         - A cape with a conflicting pin mapping is loaded 
E         - A device tree object is loaded that uses the same name for a fragment: helper

test_adc.py:46: RuntimeError
_________________________________________________________________ TestAdc.test_many_read_adc _________________________________________________________________

self = <test_adc.TestAdc instance at 0xb66012d8>

    def test_many_read_adc(self):
        import time

>       ADC.setup()
E       RuntimeError: Unable to setup ADC system. Possible causes are: 
E         - A cape with a conflicting pin mapping is loaded 
E         - A device tree object is loaded that uses the same name for a fragment: helper

test_adc.py:55: RuntimeError
============================================================= 4 failed, 2 passed in 0.72 seconds =============================================================
pdp7 commented 6 years ago
debian@beaglebone:~/ssh/adafruit-beaglebone-io-python/test$ grep /sys/ /tmp/a
1686  open("/sys/devices/platform/bone_capemgr/slots", O_RDWR|O_LARGEFILE) = -1 ENOENT (No such file or directory)
1686  open("/sys/devices/platform/bone_capemgr/slots", O_RDWR|O_LARGEFILE) = -1 ENOENT (No such file or directory)
1686  open("/sys/devices/platform/bone_capemgr/slots", O_RDWR|O_LARGEFILE) = -1 ENOENT (No such file or directory)
1686  open("/sys/devices/platform/bone_capemgr/slots", O_RDWR|O_LARGEFILE) = -1 ENOENT (No such file or directory)
debian@beaglebone:~/ssh/adafruit-beaglebone-io-python/test$ sudo strace -o /tmp/a -fF python2 -mpytest test_adc.py
pdp7 commented 6 years ago

I have updated common.c to avoid trying to load overlay (e.g. cape) when running on BeagleBone Blue: https://github.com/adafruit/adafruit-beaglebone-io-python/commit/7affea78fd995b522a49c19df060b1daea404b5f

pdp7 commented 5 years ago

Right now, I think the built-in LEDs and the built-in push buttons are working with this library on the Blue

@fcooper @erikwelsh @MarkAYoder Are there BeagleBone Blue peripherals that you would like to see working with library?

Normally I look at bonescript by @jadon to know access peripherals for a given pin number. But I don't see many clues in there as to how to find the correct peripherals in /sys for a the headers on the Blue.