for kernel ci on input devices edging closer to the hardware · 2019-10-04 · uinput.ko (well...
TRANSCRIPT
![Page 1: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/1.jpg)
Edging closer to the hardwareEdging closer to the hardwarefor kernel CI on input devicesfor kernel CI on input devices
Benjamin Tissoires
XDC 2019 - Montreal
1
![Page 2: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/2.jpg)
This talk is aboutThis talk is aboutinput...input...
boring...boring...
XDC 2019 - Montreal
... But also about CI... But also about CI totally exciting!totally exciting!
Edging closer to the hardware forEdging closer to the hardware forkernel CI on input deviceskernel CI on input devices
2
![Page 3: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/3.jpg)
Who's that bearded guy?
Why me?Why me?
XDC 2019 - Montreal
Kernel developerinput & HID stacks"the one guy who breaks your keyboard, mouse, or touchscreen"
Now"still that guy, but also the one who delays your HID patches upstream"
That's the input part
That's the CI part
3
![Page 4: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/4.jpg)
The suspect
HIDHID
XDC 2019 - Montreal
- Human Interface Device - plug and play (end of the 90's) - at �rst USB only, now with Bluetooth, I2C, BLE
Easy for mice
Report descriptorX is 8 bits longsY is 8 bits longsbuttons 1, 2, 3 are 1 bits long5 bits of constant to �ll in up to 8 bits
events00 02 0200 00 0200 00 00
X: 0 Y: 2 B2 ↴X: 0 Y: 0 B2 ⇝X: 0 Y: 0 B2 ↱
4 . 1
![Page 5: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/5.jpg)
Report descriptorX is 8 bits longsY is 8 bits longstip switch 1 bits long7 bits of constant to �ll in up to 8 bitsX is 8 bits longsY is 8 bits longstip switch 1 bits long7 bits of constant to �ll in up to 8 bits
events05 02 01 00 00 0000 00 00 02 05 0100 00 00 00 00 00
The suspect
HIDHID
XDC 2019 - Montreal
- Human Interface Device - plug and play (end of the 90's) - at �rst USB only, now with Bluetooth, I2C, BLE
Easy for miceNot so much for multitouch panels
X: 5 Y: 2 X: 0 Y: 0X: 0 Y: 0 X: 2 Y: 5????
4 . 2
![Page 6: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/6.jpg)
The Problems
Do I have an army ofDo I have an army ofmultitouch panels?multitouch panels?
XDC 2019 - Montreal
Do I have a navy ofDo I have a navy ofmice?mice?
Yes, but...
Yes, but...
How to ensure there is no regressions?How to ensure there is no regressions?
Note to self: do not break Linus' touchpad
5
![Page 7: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/7.jpg)
The Problems
Drawbacks of manual testingDrawbacks of manual testing
XDC 2019 - Montreal
- more generic code means more manual tests- time consuming- full testing?- not very compatible with more responsibility
is it really worth it?
6
![Page 8: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/8.jpg)
The Past
First idea (2012-2014)First idea (2012-2014)
XDC 2019 - Montreal
1. get hid-record logs2. replay them locally ( hid-replay )3. see the differences
need to update the DB for each kernelimprecise
takes too much timedoesn't scale
uhid.ko (June 2012)
hid-multitouch only
4. cry
7
![Page 9: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/9.jpg)
The Past (well still today)
Userspace / libinput (2013 +)Userspace / libinput (2013 +)
XDC 2019 - Montreal
- for every commit, write a test- tests are simple (who said unit?)- saves a ton of time
barely no downsidetedious
uinput.ko (well before git, before 2.6.12, before 2005)
evdev to userspace
8
![Page 10: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/10.jpg)
Now what?
hid-tools (end of 2017 +)hid-tools (end of 2017 +)
XDC 2019 - Montreal
True kernel unit tests for HID- rewrite hid-replay / hid-record in python- library to parse report descriptors- library to generate reports from the descriptors- full test suite with unit tests- currently keyboards, some mice, multitouch panels
barely no downsidetedious
uhid.ko
hid protocol only
9
![Page 11: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/11.jpg)
What about CI?What about CI? thanks for thethanks for theattendance BTWattendance BTW
XDC 2019 - Montreal
10
![Page 12: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/12.jpg)
Something totally amazing
GitlabGitlab
XDC 2019 - Montreal
- for every commit or MR, run a test- runners are owned by Freedesktop, but you can add your private one- saves a ton of time
But lots of duplicated pipelines across projects
https://gitlab.freedesktop.org
freedesktop's gitlab
11
![Page 13: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/13.jpg)
The suspects
Duplicated pipeline (classic)Duplicated pipeline (classic)
XDC 2019 - Montreal
- run on some random upstream image- update- install dependencies- run the tests
freedesktop's gitlab
12
![Page 14: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/14.jpg)
The usual suspects
Duplicated pipeline (enhanced)Duplicated pipeline (enhanced)
XDC 2019 - Montreal
setup job:- create a base test image if it does not exist- update it- install dependencies- publish the image in a separate job:- use the test image container- run the tests
freedesktop's gitlab
13
![Page 15: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/15.jpg)
Something even more amazing
Wayland's CI templates (1/3)Wayland's CI templates (1/3)
XDC 2019 - Montreal
Users of ci-templates objectives:- save time- have a reproducible environment to be able to �x the $*?! bug raised duringCI- make sure your project build continuously on $DISTRO
freedesktop's gitlab
https://gitlab.freedesktop.org/wayland/ci-templates
Yes you can
� libinput � mesa � xorg/xserver � weston
14
![Page 16: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/16.jpg)
Something even more amazing
Wayland's CI templates (2/3)Wayland's CI templates (2/3)
XDC 2019 - Montreal
DISTRO_PKGS : tells which RPMs,debs, packages are required in yourtestsDISTRO_EXEC : optional script to runDISTRO_TAG : tag of the image ready
for testing (won't be rebuilt if exists) Forks can also update the image, orpull yours to save power
ready to usefree to re-use (MIT)
quite useful
include: project: 'wayland/citemplates' ref: 955e61e67... file: '/templates/arch.yml'
variables: ARCH_PKGS:'git gcc pkgconfig meson ...'
ARCH_EXEC:'bash .gitlabci/arch_install.sh foo'
ARCH_TAG: '20190807.0'
UPSTREAM_REPO: libinput/libinput ARCH_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/archlinux/rolling:$ARCH_TAG
arch@containerbuild: extends: .arch@containerifnotexists stage: arch_container_build
variables: GIT_STRATEGY: none ARCH_VERSION: rolling
arch@check: image: $ARCH_CONTAINER_IMAGE script: wget https://gitlab.freedesktop.org
15
![Page 17: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/17.jpg)
Something even more amazing
Wayland's CI templates (3/3)Wayland's CI templates (3/3)
XDC 2019 - Montreal
- include the template, and have bene�ts from it- all the images are based on upstream and built locally- CI of the CI- has support for creating Ubuntu, Fedora, Arch and Debian images- has support for creating arm64 images- will have support for running VMs in the containers (wip branch for now)
https://gitlab.freedesktop.org/wayland/ci-templates
freedesktop's gitlab
16
![Page 18: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/18.jpg)
You won't believe it
Kernel HID CIKernel HID CI
XDC 2019 - Montreal
Objective: run CI suite for every commit I push, and every submitted patch Icare for - Use of ci-templates with qemu- .gitlab-ci.yml not in the tested tree
my own gitlab
https://gitlab.banquise.eu/bentiss/linux
Got to patch gitlab to not have .gitlab-ci.yml in the sources(https://gitlab.com/gitlab-org/gitlab-ce/issues/15041)
Got to play with docker podman , qemu and bashGot to play with kubernetes
I'm still the "the one guy by who breaks your keyboard,mouse, or touchscreen, but also the one who delays your
HID patches upstream", and I am so hype17
![Page 19: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/19.jpg)
You won't believe it
Kernel HID CIKernel HID CI
XDC 2019 - Montreal
18
![Page 20: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/20.jpg)
Thanks for coming in on aThanks for coming in on aFriday morningFriday morning
https://gitlab.freedesktop.org/wayland/ci-templates
XDC 2019 - Montreal
19
![Page 21: for kernel CI on input devices Edging closer to the hardware · 2019-10-04 · uinput.ko (well before git, before 2.6.12, before 2005) evdev to userspace 8. Now what? hid-tools (end](https://reader034.vdocuments.net/reader034/viewer/2022042108/5e87a860e94f06178e6a0c27/html5/thumbnails/21.jpg)
20