node-libgpiod icon indicating copy to clipboard operation
node-libgpiod copied to clipboard

proper chip and lines simulation to integrate on CI/CD

Open sombriks opened this issue 1 year ago • 2 comments

gather here any info related to the simulator.

for the two major versions if possible.

sombriks avatar Feb 25 '24 15:02 sombriks

one partial update on this,

assuming that the kernel has the gpio-sim module, the following commands should create a fake chip for testing purposes:

mount | grep configfs  # provavelmente /sys/kernel/config
sudo su
modprobe gpio-sim
mkdir -p /sys/kernel/config/gpio-sim/fakegpio/gpio-bank0/line0
echo 1 > /sys/kernel/config/gpio-sim/fakegpio/live
chmod a+rw /dev/gpiochip1

then we can manipulate that chip like a real one, using libgpiod, or by /sys/devices/platform/gpio-sim.0/gpiochip1/sim_gpio0

detailed info at

  • https://www.kernel.org/doc/html/v6.7/filesystems/configfs.html?highlight=configfs
  • https://www.kernel.org/doc/html/v6.7/admin-guide/gpio/gpio-sim.html?highlight=gpio+sim

if it works as expected, our test suite will be for real and helps immensely in the implementation of missing feature, so we will be able to do a 1.x release and work into 2.x s well.

image

sombriks avatar Mar 10 '24 21:03 sombriks

ok the thing is gpio-sim isn't available on older fedora (i am using 38 to develop 1.x branch) but gpio-mockup was supposed to be there but it is not.

so i need to compile the kernel module and try it again.

and, if it works, i need to proper document the process so everyone else could do it as well.

and, finally, do this in github actions so i can simulate a chip under my CI

sombriks avatar Apr 06 '24 22:04 sombriks

this is almost solved. https://github.com/sombriks/node-libgpiod/blob/536bc75fc80d3ba78fb33d5f6ad78f150e55c168/test/prepare-gpio-sim.sh

still need to setup the github runner to be able to modprobe gpio-sim but it already allows local development to proceed.

closing this one to create more specific ones.

sombriks avatar Jun 30 '24 16:06 sombriks