JamesBarwell / rpi-gpio.js

Control Raspberry Pi GPIO pins with node.js
MIT License
657 stars 116 forks source link

Hardware checks #31

Closed julienvincent closed 9 months ago

julienvincent commented 8 years ago

This pull requests adds some basic hardware and platform checks. First check is wether or not to require epoll, and the second check is wether or not the system is running on a raspberry pi.

The reason I added these checks is to improve development experience. With these checks in place, the module doesn't break the application it is being used in if the development environment isn't a raspberry pi.

Some tests are failing and I would appreciate it if you could try get them passing again. I haven't had enough time to do that yet.

Cheers

JamesBarwell commented 8 years ago

Hi, thanks for the patch and I'm happy to help with the tests, but just to warn you it may be a few months before I can spare the time unfortunately, and I have no access to my Raspberry Pis at present. I'm hoping I can at least have a go at the tests before then. Cheers.

julienvincent commented 8 years ago

I'll give a go at the tests sometime tomorrow and see if I can get them passing.

simonmeusel commented 6 years ago

As you can see in the log, the test's are not passing because the Travis CI environment obviously isn't a raspberry pi.

Maybe a easy fix would be to add a option to force requiring epoll and such, even if not on a raspberry pi. Then in the test that option could be used.

JamesBarwell commented 6 years ago

At the moment the tests are written to stub/mock out their dependencies. I want to stick to this approach because it means we can test all of the module code, and assert on how it interacts with those dependencies. I don't want to get into a situation where flags are used to make the module execute a separate code path when it is under test.

The tests do pass on Travis on the master branch so there is no inherent problem with this approach.

I can't remember exactly where we are with this PR but I'm not sure that it's needed now. The tests do run in a non-RPI environment because Epoll does get stubbed out correctly. I do all my dev on non-RPI hardware using the test suite. If anyone is having problems then raise another issue and let's discuss the options

simonmeusel commented 6 years ago

Generally test do past with your approach, but this PR (which is in my opinion very important) add a hardware check. That check obviously detects the travis environment. Thus only that initial check needs to be removed for the tests.