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

[nanopi, raspi, tinkerboard]: system.WithDigitalPinGpiodAccess() can not be overriden #1109

Open
gen2thomas opened this issue Dec 21, 2024 · 0 comments
Assignees
Labels

Comments

@gen2thomas
Copy link
Collaborator

Because the option "system.WithDigitalPinGpiodAccess()" is set on constructor and there is no "system.WithDigitalPinSysfsAccess()", it is not possible to test (and unit-test) the sysfs behaviour on a board which supports gpiod. Especially all unit tests run OK on server or on machines where the feature is not activated because there is a fallback programmed to use sysfs in this case.

If unit tests of e.g. tinkerboard or nanopi platform are started on a machine with activated gpiod, the test tries to use gpiod, which can be critical for the machine, if the gpiod access rights are configured properly and the used pin is not busy. In any case this tests will fail in raspi_adaptor_test.go, tinkerboard/adaptor_test.go , nanopi/nanopi_adaptor_test.go:

  • TestDigitalIO
  • TestFinalizeErrorAfterGPIO

The fix should include:

  • introduce "system.WithDigitalPinSysfsAccess()" to override the constructors default
  • use gpiod as default in constructor for all those adaptors without the "system.WithDigitalPinGpiodAccess" call
  • change all examples and unit-tests to use "system.WithDigitalPinSysfsAccess()"
  • try to introduce unit-tests for gpiod (-mock, on starting with gpiod there was no simple solution for that)
@gen2thomas gen2thomas self-assigned this Dec 21, 2024
@gen2thomas gen2thomas added the bug label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant