ev3dev sysfs simulation #783
JakubVanek
started this conversation in
General
Replies: 1 comment
-
He have discussed it in the past @JakubVanek If with current model, we can test, we have one model. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
splitting from the main issue (#765) to prevent polluting it
Currently, "standard" filesystems can indeed used for ev3dev /sys emulation. This is intended primarily for unit testing. The way it works is by creating the necessary files & folders using
fake_ev3dev
helper classes and then relying on sensors reading their attributes as regular files from a mock sysfs directory. All sysfs structures should exist underCURRENT_ROOT_PATH
; this is/sys/class
on EV3 and a custom temporary directory when running unit tests.Sysfs and real filesystem sometimes behave differently; this can be observed on
truncate()
/write()
behaviour and more. For now, these differences need to be worked around, as most of the current unit tests likely use the regular files to mock things.The emulation accuracy could theoretically be improved by implementing a custom filesystem through FUSE. That would allow implementing special handling of the individual syscalls to more closely follow the behaviour of real /sys. However, while it looks interesting, I'm not sure there's much to be gained by implementing that.
@dwalend @jabrena
Beta Was this translation helpful? Give feedback.
All reactions