FakeKernel class

A Syscalls implementation backed by an in-memory model of the GPIO character device.

Enough of the real contract to be worth testing against: line ownership and EBUSY, masked atomic reads and writes, activeLow inversion, initial output values applied at request time, and per-line flag and debounce attributes decoded exactly as the kernel would decode them.

Implemented types

Constructors

FakeKernel(List<FakeChip> chips)
Creates a fake kernel exposing chips.
FakeKernel.single({String name = 'gpiochip0', String label = 'fake-pinctrl', int lineCount = 8, Map<int, String>? lineNames})
A fake with one 8-line chip, which is enough for most tests.
factory

Properties

chips → List<FakeChip>
The chips this kernel exposes.
final
dropNextEvents ↔ int
Drops this many upcoming events instead of delivering them, without reusing their sequence numbers — exactly what the kernel's per-request FIFO does when it overflows.
getter/setter pair
errno → int
The calling thread's errno, valid immediately after a failed call.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
ioctlLog → List<int>
Every ioctl request number issued, in order — so a test can assert that a v1 ioctl was never attempted.
final
openDescriptors → int
Descriptors opened and not yet closed. A leak in the code under test shows up here.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

close(int fd) → int
close(2).
override
ioctl(int fd, int request, Pointer<Void> argp) → int
ioctl(2) with a pointer argument.
override
listGpioChipPaths() → List<String>
Lists the GPIO character devices present, as absolute paths.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open(String path, int flags) → int
open(2). Returns a file descriptor, or -1 with errno set.
override
openEvents(int fd) → Future<GpioEventReader>
Opens a stream of raw edge events for a line-request descriptor.
override
read(int fd, Pointer<Void> buf, int count) → int
read(2). Returns bytes read, or -1 with errno set.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited