bpf/selftests: remove lirc test
Subsystems (3)
PATCH 1/1 bpf/selftests: remove lirc test
test_lirc_mode.sh fails with the following when run from the vmtest VM:
root@(none):/root/bpf# ./test_lirc_mode2.sh Failed to read decoded IR: Resource temporarily unavailable FAIL: lirc_mode2
As part of the ongoing effort to get rid of any standalone test, this script should either be fixed and converted to test_progs or removed.
Remove it.
---
Hi all,
I went back up to v6.13 without finding a working commit. Maybe something's wrong with my setup but comments inside test_lirc_mode2_user.c say that three kernel configurations are needed to have the test working and I ensured they were indeed enabled (with s/BPF_RAWIR_EVENT/BPF_LIRC_MODE2).
If someone disagrees with this removal please speak up and I'll investigate this further.
Best regards,
Bastien
--- tools/testing/selftests/bpf/.gitignore | 1 - tools/testing/selftests/bpf/Makefile | 3 - .../selftests/bpf/progs/test_lirc_mode2_kern.c | 26 --- tools/testing/selftests/bpf/test_lirc_mode2.sh | 41 ----- tools/testing/selftests/bpf/test_lirc_mode2_user.c | 177 --------------------- 5 files changed, 248 deletions(-)
tools/testing/selftests/bpf/.gitignore +0 -1
@@ -17,7 +17,6 @@ test_verifier_log feature urandom_read test_sockmap -test_lirc_mode2_user flow_dissector_load test_tcpnotify_user test_libbpf
tools/testing/selftests/bpf/Makefile +0 -3
@@ -117,7 +117,6 @@ TEST_FILES = xsk_prereqs.sh $(wildcard progs/btf_dump_test_case_*.c) # Order correspond to 'make run_tests' order TEST_PROGS := test_kmod.sh \ - test_lirc_mode2.sh \ test_bpftool_build.sh \ test_doc_build.sh \ test_xsk.sh \
@@ -135,7 +134,6 @@ TEST_GEN_PROGS_EXTENDED = \ bench \ flow_dissector_load \ test_cpp \ - test_lirc_mode2_user \ veristat \ xdp_features \ xdp_hw_metadata \
@@ -325,7 +323,6 @@ $(OUTPUT)/test_sockmap: $(CGROUP_HELPERS) $(TESTING_HELPERS) $(OUTPUT)/test_tcpnotify_user: $(CGROUP_HELPERS) $(TESTING_HELPERS) $(TRACE_HELPERS) $(OUTPUT)/test_sock_fields: $(CGROUP_HELPERS) $(TESTING_HELPERS) $(OUTPUT)/test_tag: $(TESTING_HELPERS) -$(OUTPUT)/test_lirc_mode2_user: $(TESTING_HELPERS) $(OUTPUT)/flow_dissector_load: $(TESTING_HELPERS) $(OUTPUT)/test_maps: $(TESTING_HELPERS) $(OUTPUT)/test_verifier: $(TESTING_HELPERS) $(CAP_HELPERS) $(UNPRIV_HELPERS)
tools/testing/selftests/bpf/progs/test_lirc_mode2_kern.c deleted +0 -26
@@ -1,26 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -// test ir decoder -// -// Copyright (C) 2018 Sean Young <[email protected]> - -#include <linux/bpf.h> -#include <linux/lirc.h> -#include <bpf/bpf_helpers.h> - -SEC("lirc_mode2") -int bpf_decoder (unsigned int *sample) -{ -if (LIRC_IS_PULSE (*sample)) { -unsigned int duration =LIRC_VALUE (*sample); - -if (duration &0x10000 ) -bpf_rc_keydown (sample,0x40 , duration &0xffff ,0 ); -if (duration &0x20000 ) -bpf_rc_pointer_rel (sample, (duration >>8 ) &0xff , - duration &0xff ); - } - -return 0 ; -} - -char _license[] SEC("license") = "GPL";
tools/testing/selftests/bpf/test_lirc_mode2.sh deleted +0 -41
41 lines not on this page · raw message
tools/testing/selftests/bpf/test_lirc_mode2_user.c deleted +0 -177
177 lines not on this page · raw message
---
base-commit: 73f574b0cd0ef87a25afdffe1d907b55f7fcc940
change-id: 20260604-remove-lirc-test-fc8afa634f3a
Best regards,
Signature · 1 line
Bastien Curutchet (eBPF Foundation) <[email protected]>
Quoted 10 lines · Bastien Curutchet (eBPF Foundation)
test_lirc_mode.shfails with the following when run from the vmtest VM:root@(none):/root/bpf# ./test_lirc_mode2.sh Failed to read decoded IR: Resource temporarily unavailable FAIL: lirc_mode2As part of the ongoing effort to get rid of any standalone test, this script should either be fixed and converted to
test_progsor removed.Remove it.
cc Sean
Quoted 334 lines
Signed-off-by Bastien Curutchet (eBPF Foundation) <[email protected]>---
Hi all,I went back up to v6.13 without finding a working commit. Maybe something's wrong with my setup but comments inside
test_lirc_mode2_user.csay that three kernel configurations are needed to have the test working and I ensured they were indeed enabled (with s/BPF_RAWIR_EVENT/BPF_LIRC_MODE2).If someone disagrees with this removal please speak up and I'll investigate this further.
Best regards,
Bastien--- tools/testing/selftests/bpf/.gitignore | 1 - tools/testing/selftests/bpf/Makefile | 3 - .../selftests/bpf/progs/test_lirc_mode2_kern.c | 26 --- tools/testing/selftests/bpf/test_lirc_mode2.sh | 41 ----- tools/testing/selftests/bpf/test_lirc_mode2_user.c | 177 --------------------- 5 files changed, 248 deletions(-)tools/testing/selftests/bpf/.gitignore +0
-1@@ -17,7 +17,6 @@ test_verifier_log feature urandom_read test_sockmap -test_lirc_mode2_user flow_dissector_load test_tcpnotify_user test_libbpftools/testing/selftests/bpf/Makefile +0
-3@@ -117,7 +117,6 @@ TEST_FILES = xsk_prereqs.sh $(wildcard progs/btf_dump_test_case_*.c) # Order correspond to 'make run_tests' order TEST_PROGS := test_kmod.sh \ - test_lirc_mode2.sh \ test_bpftool_build.sh \ test_doc_build.sh \ test_xsk.sh \@@ -135,7 +134,6 @@ TEST_GEN_PROGS_EXTENDED = \ bench \ flow_dissector_load \ test_cpp \ - test_lirc_mode2_user \ veristat \ xdp_features \ xdp_hw_metadata \@@ -325,7 +323,6 @@ $(OUTPUT)/test_sockmap: $(CGROUP_HELPERS) $(TESTING_HELPERS) $(OUTPUT)/test_tcpnotify_user: $(CGROUP_HELPERS) $(TESTING_HELPERS) $(TRACE_HELPERS) $(OUTPUT)/test_sock_fields: $(CGROUP_HELPERS) $(TESTING_HELPERS) $(OUTPUT)/test_tag: $(TESTING_HELPERS) -$(OUTPUT)/test_lirc_mode2_user: $(TESTING_HELPERS) $(OUTPUT)/flow_dissector_load: $(TESTING_HELPERS) $(OUTPUT)/test_maps: $(TESTING_HELPERS) $(OUTPUT)/test_verifier: $(TESTING_HELPERS) $(CAP_HELPERS) $(UNPRIV_HELPERS)tools/testing/selftests/bpf/progs/test_lirc_mode2_kern.c deleted +0
-26@@ -1,26 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -// test ir decoder -// -// Copyright (C) 2018 Sean Young <[email protected]> - -#include <linux/bpf.h> -#include <linux/lirc.h> -#include <bpf/bpf_helpers.h> - -SEC("lirc_mode2") -int bpf_decoder (unsigned int *sample) -{ -if (LIRC_IS_PULSE (*sample)) { -unsigned int duration =LIRC_VALUE (*sample); - -if (duration &0x10000 ) -bpf_rc_keydown (sample,0x40 , duration &0xffff ,0 ); -if (duration &0x20000 ) -bpf_rc_pointer_rel (sample, (duration >>8 ) &0xff , - duration &0xff ); - } - -return 0 ; -} - -char _license[] SEC("license") = "GPL";tools/testing/selftests/bpf/test_lirc_mode2.sh deleted +0
-41@@ -1,41 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 - -# Kselftest framework requirement - SKIP code is 4. -ksft_skip=4 -ret=$ksft_skip - -msg="skip all tests:" -if [ $UID != 0 ]; then - echo $msg please run this as root >&2 - exit $ksft_skip -fi - -GREEN='\033[0;92m' -RED='\033[0;31m' -NC='\033[0m' # No Color - -modprobe rc-loopback - -for i in /sys/class/rc/rc* -do - if grep -q DRV_NAME=rc-loopback $i/uevent - then - LIRCDEV=$(grep DEVNAME= $i/lirc*/uevent | sed sQDEVNAME=Q/dev/Q) - INPUTDEV=$(grep DEVNAME= $i/input*/event*/uevent | sed sQDEVNAME=Q/dev/Q) - fi -done - -if [ -n "$LIRCDEV" ]; -then - TYPE=lirc_mode2 - ./test_lirc_mode2_user $LIRCDEV $INPUTDEV - ret=$? - if [ $ret -ne 0 ]; then - echo -e ${RED}"FAIL: $TYPE"${NC} - else - echo -e ${GREEN}"PASS: $TYPE"${NC} - fi -fi - -exit $rettools/testing/selftests/bpf/test_lirc_mode2_user.c deleted +0
-178@@ -1,177 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -// test ir decoder -// -// Copyright (C) 2018 Sean Young <[email protected]> - -// A lirc chardev is a device representing a consumer IR (cir) device which -// can receive infrared signals from remote control and/or transmit IR. -// -// IR is sent as a series of pulses and space somewhat like morse code. The -// BPF program can decode this into scancodes so that rc-core can translate -// this into input key codes using the rc keymap. -// -// This test works by sending IR over rc-loopback, so the IR is processed by -// BPF and then decoded into scancodes. The lirc chardev must be the one -// associated with rc-loopback, see the output of ir-keytable(1). -// -// The following CONFIG options must be enabled for the test to succeed: -// CONFIG_RC_CORE=y -// CONFIG_BPF_RAWIR_EVENT=y -// CONFIG_RC_LOOPBACK=y - -// Steps: -// 1. Open the /dev/lircN device for rc-loopback (given on command line) -// 2. Attach bpf_lirc_mode2 program which decodes some IR. -// 3. Send some IR to the same IR device; since it is loopback, this will -// end up in the bpf program -// 4. bpf program should decode IR and report keycode -// 5. We can read keycode from same /dev/lirc device - -#include <linux/bpf.h> -#include <linux/input.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <poll.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#include <sys/stat.h> -#include <fcntl.h> - -#include "bpf_util.h" -#include <bpf/bpf.h> -#include <bpf/libbpf.h> - -#include "testing_helpers.h" - -int main (int argc,char **argv) -{ -struct bpf_object *obj; -int ret, lircfd, progfd, inputfd; -int testir1 =0x1dead ; -int testir2 =0x20101 ; -u32 prog_ids[10 ], prog_flags[10 ], prog_cnt; - -if (argc !=3 ) { -printf ("Usage: %s /dev/lircN /dev/input/eventM\n" , argv[0 ]); -return 2 ; - } - - ret =bpf_prog_test_load ("test_lirc_mode2_kern.bpf.o" , -BPF_PROG_TYPE_LIRC_MODE2 , &obj, &progfd); -if (ret) { -printf ("Failed to load bpf program\n" ); -return 1 ; - } - - lircfd =open (argv[1 ],O_RDWR |O_NONBLOCK ); -if (lircfd ==-1 ) { -printf ("failed to open lirc device %s: %m\n" , argv[1 ]); -return 1 ; - } - -/* Let's try detach it before it was ever attached */ - ret =bpf_prog_detach2 (progfd, lircfd,BPF_LIRC_MODE2 ); -if (ret != -ENOENT ) { -printf ("bpf_prog_detach2 not attached should fail: %m\n" ); -return 1 ; - } - - inputfd =open (argv[2 ],O_RDONLY |O_NONBLOCK ); -if (inputfd ==-1 ) { -printf ("failed to open input device %s: %m\n" , argv[1 ]); -return 1 ; - } - - prog_cnt =10 ; - ret =bpf_prog_query (lircfd,BPF_LIRC_MODE2 ,0 , prog_flags, prog_ids, - &prog_cnt); -if (ret) { -printf ("Failed to query bpf programs on lirc device: %m\n" ); -return 1 ; - } - -if (prog_cnt !=0 ) { -printf ("Expected nothing to be attached\n" ); -return 1 ; - } - - ret =bpf_prog_attach (progfd, lircfd,BPF_LIRC_MODE2 ,0 ); -if (ret) { -printf ("Failed to attach bpf to lirc device: %m\n" ); -return 1 ; - } - -/* Write raw IR */ - ret =write (lircfd, &testir1,sizeof (testir1)); -if (ret !=sizeof (testir1)) { -printf ("Failed to send test IR message: %m\n" ); -return 1 ; - } - -struct pollfd pfd = { .fd = inputfd, .events =POLLIN }; -struct input_event event; - -for (;;) { -poll (&pfd,1 ,100 ); - -/* Read decoded IR */ - ret =read (inputfd, &event,sizeof (event)); -if (ret !=sizeof (event)) { -printf ("Failed to read decoded IR: %m\n" ); -return 1 ; - } - -if (event.type ==EV_MSC && event.code ==MSC_SCAN && - event.value ==0xdead ) { -break ; - } - } - -/* Write raw IR */ - ret =write (lircfd, &testir2,sizeof (testir2)); -if (ret !=sizeof (testir2)) { -printf ("Failed to send test IR message: %m\n" ); -return 1 ; - } - -for (;;) { -poll (&pfd,1 ,100 ); - -/* Read decoded IR */ - ret =read (inputfd, &event,sizeof (event)); -if (ret !=sizeof (event)) { -printf ("Failed to read decoded IR: %m\n" ); -return 1 ; - } - -if (event.type ==EV_REL && event.code ==REL_Y && - event.value ==1 ) { -break ; - } - } - - prog_cnt =10 ; - ret =bpf_prog_query (lircfd,BPF_LIRC_MODE2 ,0 , prog_flags, prog_ids, - &prog_cnt); -if (ret) { -printf ("Failed to query bpf programs on lirc device: %m\n" ); -return 1 ; - } - -if (prog_cnt !=1 ) { -printf ("Expected one program to be attached\n" ); -return 1 ; - } - -/* Let's try detaching it now it is actually attached */ - ret =bpf_prog_detach2 (progfd, lircfd,BPF_LIRC_MODE2 ); -if (ret) { -printf ("bpf_prog_detach2: returned %m\n" ); -return 1 ; - } - -return 0 ; -} ---base-commit:
73f574b0cd0ef87a25afdffe1d907b55f7fcc940
change-id: 20260604-remove-lirc-test-fc8afa634f3aBest regards,
--
Bastien Curutchet (eBPF Foundation) <[email protected]>
Quoted 8 lines · Alexei Starovoitov
Quoted 6 lines · Bastien Curutchet (eBPF Foundation)
test_lirc_mode.shfails with the following when run from the vmtest VM:root@(none):/root/bpf# ./test_lirc_mode2.sh Failed to read decoded IR: Resource temporarily unavailable FAIL: lirc_mode2
Quoted 6 lines
Quoted 4 lines
As part of the ongoing effort to get rid of any standalone test, this script should either be fixed and converted to
test_progsor removed.Remove it.
cc Sean
I've sent a fix to for the test in a separate email.
This regressed a long time ago; is anyone running these tests? There is not much point to selftests if they're not run by anyone. I should add them to linux-media CI, but is anyone in bpf running them?
I am not familiar with test_progs, what's that?
Sean
Quoted 334 lines
Quoted 334 lines
Signed-off-by Bastien Curutchet (eBPF Foundation) <[email protected]>---
Hi all,I went back up to v6.13 without finding a working commit. Maybe something's wrong with my setup but comments inside
test_lirc_mode2_user.csay that three kernel configurations are needed to have the test working and I ensured they were indeed enabled (with s/BPF_RAWIR_EVENT/BPF_LIRC_MODE2).If someone disagrees with this removal please speak up and I'll investigate this further.
Best regards,
Bastien--- tools/testing/selftests/bpf/.gitignore | 1 - tools/testing/selftests/bpf/Makefile | 3 - .../selftests/bpf/progs/test_lirc_mode2_kern.c | 26 --- tools/testing/selftests/bpf/test_lirc_mode2.sh | 41 ----- tools/testing/selftests/bpf/test_lirc_mode2_user.c | 177 --------------------- 5 files changed, 248 deletions(-)tools/testing/selftests/bpf/.gitignore +0
-1@@ -17,7 +17,6 @@ test_verifier_log feature urandom_read test_sockmap -test_lirc_mode2_user flow_dissector_load test_tcpnotify_user test_libbpftools/testing/selftests/bpf/Makefile +0
-3@@ -117,7 +117,6 @@ TEST_FILES = xsk_prereqs.sh $(wildcard progs/btf_dump_test_case_*.c) # Order correspond to 'make run_tests' order TEST_PROGS := test_kmod.sh \ - test_lirc_mode2.sh \ test_bpftool_build.sh \ test_doc_build.sh \ test_xsk.sh \@@ -135,7 +134,6 @@ TEST_GEN_PROGS_EXTENDED = \ bench \ flow_dissector_load \ test_cpp \ - test_lirc_mode2_user \ veristat \ xdp_features \ xdp_hw_metadata \@@ -325,7 +323,6 @@ $(OUTPUT)/test_sockmap: $(CGROUP_HELPERS) $(TESTING_HELPERS) $(OUTPUT)/test_tcpnotify_user: $(CGROUP_HELPERS) $(TESTING_HELPERS) $(TRACE_HELPERS) $(OUTPUT)/test_sock_fields: $(CGROUP_HELPERS) $(TESTING_HELPERS) $(OUTPUT)/test_tag: $(TESTING_HELPERS) -$(OUTPUT)/test_lirc_mode2_user: $(TESTING_HELPERS) $(OUTPUT)/flow_dissector_load: $(TESTING_HELPERS) $(OUTPUT)/test_maps: $(TESTING_HELPERS) $(OUTPUT)/test_verifier: $(TESTING_HELPERS) $(CAP_HELPERS) $(UNPRIV_HELPERS)tools/testing/selftests/bpf/progs/test_lirc_mode2_kern.c deleted +0
-26@@ -1,26 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -// test ir decoder -// -// Copyright (C) 2018 Sean Young <[email protected]> - -#include <linux/bpf.h> -#include <linux/lirc.h> -#include <bpf/bpf_helpers.h> - -SEC("lirc_mode2") -int bpf_decoder (unsigned int *sample) -{ -if (LIRC_IS_PULSE (*sample)) { -unsigned int duration =LIRC_VALUE (*sample); - -if (duration &0x10000 ) -bpf_rc_keydown (sample,0x40 , duration &0xffff ,0 ); -if (duration &0x20000 ) -bpf_rc_pointer_rel (sample, (duration >>8 ) &0xff , - duration &0xff ); - } - -return 0 ; -} - -char _license[] SEC("license") = "GPL";tools/testing/selftests/bpf/test_lirc_mode2.sh deleted +0
-41@@ -1,41 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: GPL-2.0 - -# Kselftest framework requirement - SKIP code is 4. -ksft_skip=4 -ret=$ksft_skip - -msg="skip all tests:" -if [ $UID != 0 ]; then - echo $msg please run this as root >&2 - exit $ksft_skip -fi - -GREEN='\033[0;92m' -RED='\033[0;31m' -NC='\033[0m' # No Color - -modprobe rc-loopback - -for i in /sys/class/rc/rc* -do - if grep -q DRV_NAME=rc-loopback $i/uevent - then - LIRCDEV=$(grep DEVNAME= $i/lirc*/uevent | sed sQDEVNAME=Q/dev/Q) - INPUTDEV=$(grep DEVNAME= $i/input*/event*/uevent | sed sQDEVNAME=Q/dev/Q) - fi -done - -if [ -n "$LIRCDEV" ]; -then - TYPE=lirc_mode2 - ./test_lirc_mode2_user $LIRCDEV $INPUTDEV - ret=$? - if [ $ret -ne 0 ]; then - echo -e ${RED}"FAIL: $TYPE"${NC} - else - echo -e ${GREEN}"PASS: $TYPE"${NC} - fi -fi - -exit $rettools/testing/selftests/bpf/test_lirc_mode2_user.c deleted +0
-178@@ -1,177 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -// test ir decoder -// -// Copyright (C) 2018 Sean Young <[email protected]> - -// A lirc chardev is a device representing a consumer IR (cir) device which -// can receive infrared signals from remote control and/or transmit IR. -// -// IR is sent as a series of pulses and space somewhat like morse code. The -// BPF program can decode this into scancodes so that rc-core can translate -// this into input key codes using the rc keymap. -// -// This test works by sending IR over rc-loopback, so the IR is processed by -// BPF and then decoded into scancodes. The lirc chardev must be the one -// associated with rc-loopback, see the output of ir-keytable(1). -// -// The following CONFIG options must be enabled for the test to succeed: -// CONFIG_RC_CORE=y -// CONFIG_BPF_RAWIR_EVENT=y -// CONFIG_RC_LOOPBACK=y - -// Steps: -// 1. Open the /dev/lircN device for rc-loopback (given on command line) -// 2. Attach bpf_lirc_mode2 program which decodes some IR. -// 3. Send some IR to the same IR device; since it is loopback, this will -// end up in the bpf program -// 4. bpf program should decode IR and report keycode -// 5. We can read keycode from same /dev/lirc device - -#include <linux/bpf.h> -#include <linux/input.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <poll.h> -#include <sys/types.h> -#include <sys/ioctl.h> -#include <sys/stat.h> -#include <fcntl.h> - -#include "bpf_util.h" -#include <bpf/bpf.h> -#include <bpf/libbpf.h> - -#include "testing_helpers.h" - -int main (int argc,char **argv) -{ -struct bpf_object *obj; -int ret, lircfd, progfd, inputfd; -int testir1 =0x1dead ; -int testir2 =0x20101 ; -u32 prog_ids[10 ], prog_flags[10 ], prog_cnt; - -if (argc !=3 ) { -printf ("Usage: %s /dev/lircN /dev/input/eventM\n" , argv[0 ]); -return 2 ; - } - - ret =bpf_prog_test_load ("test_lirc_mode2_kern.bpf.o" , -BPF_PROG_TYPE_LIRC_MODE2 , &obj, &progfd); -if (ret) { -printf ("Failed to load bpf program\n" ); -return 1 ; - } - - lircfd =open (argv[1 ],O_RDWR |O_NONBLOCK ); -if (lircfd ==-1 ) { -printf ("failed to open lirc device %s: %m\n" , argv[1 ]); -return 1 ; - } - -/* Let's try detach it before it was ever attached */ - ret =bpf_prog_detach2 (progfd, lircfd,BPF_LIRC_MODE2 ); -if (ret != -ENOENT ) { -printf ("bpf_prog_detach2 not attached should fail: %m\n" ); -return 1 ; - } - - inputfd =open (argv[2 ],O_RDONLY |O_NONBLOCK ); -if (inputfd ==-1 ) { -printf ("failed to open input device %s: %m\n" , argv[1 ]); -return 1 ; - } - - prog_cnt =10 ; - ret =bpf_prog_query (lircfd,BPF_LIRC_MODE2 ,0 , prog_flags, prog_ids, - &prog_cnt); -if (ret) { -printf ("Failed to query bpf programs on lirc device: %m\n" ); -return 1 ; - } - -if (prog_cnt !=0 ) { -printf ("Expected nothing to be attached\n" ); -return 1 ; - } - - ret =bpf_prog_attach (progfd, lircfd,BPF_LIRC_MODE2 ,0 ); -if (ret) { -printf ("Failed to attach bpf to lirc device: %m\n" ); -return 1 ; - } - -/* Write raw IR */ - ret =write (lircfd, &testir1,sizeof (testir1)); -if (ret !=sizeof (testir1)) { -printf ("Failed to send test IR message: %m\n" ); -return 1 ; - } - -struct pollfd pfd = { .fd = inputfd, .events =POLLIN }; -struct input_event event; - -for (;;) { -poll (&pfd,1 ,100 ); - -/* Read decoded IR */ - ret =read (inputfd, &event,sizeof (event)); -if (ret !=sizeof (event)) { -printf ("Failed to read decoded IR: %m\n" ); -return 1 ; - } - -if (event.type ==EV_MSC && event.code ==MSC_SCAN && - event.value ==0xdead ) { -break ; - } - } - -/* Write raw IR */ - ret =write (lircfd, &testir2,sizeof (testir2)); -if (ret !=sizeof (testir2)) { -printf ("Failed to send test IR message: %m\n" ); -return 1 ; - } - -for (;;) { -poll (&pfd,1 ,100 ); - -/* Read decoded IR */ - ret =read (inputfd, &event,sizeof (event)); -if (ret !=sizeof (event)) { -printf ("Failed to read decoded IR: %m\n" ); -return 1 ; - } - -if (event.type ==EV_REL && event.code ==REL_Y && - event.value ==1 ) { -break ; - } - } - - prog_cnt =10 ; - ret =bpf_prog_query (lircfd,BPF_LIRC_MODE2 ,0 , prog_flags, prog_ids, - &prog_cnt); -if (ret) { -printf ("Failed to query bpf programs on lirc device: %m\n" ); -return 1 ; - } - -if (prog_cnt !=1 ) { -printf ("Expected one program to be attached\n" ); -return 1 ; - } - -/* Let's try detaching it now it is actually attached */ - ret =bpf_prog_detach2 (progfd, lircfd,BPF_LIRC_MODE2 ); -if (ret) { -printf ("bpf_prog_detach2: returned %m\n" ); -return 1 ; - } - -return 0 ; -} ---base-commit:
73f574b0cd0ef87a25afdffe1d907b55f7fcc940
change-id: 20260604-remove-lirc-test-fc8afa634f3aBest regards,
--
Bastien Curutchet (eBPF Foundation) <[email protected]>
Hi Sean,
Quoted 16 lines · Sean Young
Quoted 8 lines · Alexei Starovoitov
Quoted 6 lines · Bastien Curutchet (eBPF Foundation)
test_lirc_mode.shfails with the following when run from the vmtest VM:root@(none):/root/bpf# ./test_lirc_mode2.sh Failed to read decoded IR: Resource temporarily unavailable FAIL: lirc_mode2Quoted 6 lines
Quoted 4 lines
As part of the ongoing effort to get rid of any standalone test, this script should either be fixed and converted to
test_progsor removed.Remove it.
cc Sean
Quoted 8 lines
I've sent a fix to for the test in a separate email.
This regressed a long time ago; is anyone running these tests? There is not much point to selftests if they're not run by anyone. I should add them to linux-media CI, but is anyone in bpf running them?
I am not familiar with
test_progs, what's that?
test_progs is the selftest's application run by the BPF CI for every patch series sent to [email protected] (or PR done to the BPF github). It's made out of the C files located in tools/testing/selftests/bpf/prog_tests/.
The shell scripts under tools/testing/selftests/bpf aren't run automatically anywhere (to my knowledge at least). The goal of the 'on-going effort' I mentioned is to get rid of these scripts by either integrating them to the 'test_progs infra' or removing them.
If you're going to add this script to the linux-media CI, maybe we could remove it from here ?
Best regards,
Bastien
Hi Sean,
Quoted 25 lines · Bastien Curutchet
Hi Sean,
Quoted 22 lines · Sean Young
Quoted 8 lines · Alexei Starovoitov
Quoted 6 lines · Bastien Curutchet (eBPF Foundation)
test_lirc_mode.shfails with the following when run from the vmtest VM:root@(none):/root/bpf# ./test_lirc_mode2.sh Failed to read decoded IR: Resource temporarily unavailable FAIL: lirc_mode2Quoted 6 lines
Quoted 4 lines
As part of the ongoing effort to get rid of any standalone test, this script should either be fixed and converted to
test_progsor removed.Remove it.
cc Sean
I've sent a fix to for the test in a separate email.
This regressed a long time ago; is anyone running these tests? There is not much point to selftests if they're not run by anyone. I should add them to linux-media CI, but is anyone in bpf running them?
Quoted 9 lines
Quoted 2 lines
I am not familiar with
test_progs, what's that?
test_progsis the selftest's application run by the BPF CI for every patch series sent to [email protected] (or PR done to the BPF github). It's made out of the C files located intools/testing/selftests/bpf/prog_tests/.The shell scripts under
tools/testing/selftests/bpfaren't run automatically anywhere (to my knowledge at least). The goal of the 'on- going effort' I mentioned is to get rid of these scripts by either integrating them to the 'test_progsinfra' or removing them.If you're going to add this script to the linux-media CI, maybe we could remove it from here ?
Gentle ping: would it be OK for you if we remove the test from here ? I've seen your fix, the bug was introduced in 5.17, which means no one had run it for 4 years. Given that, I'm not sure it's worth the effort of porting it to the test_progs infra.
Best regards,
Bastien
Hi Bastien,
Quoted 36 lines · Bastien Curutchet
Quoted 35 lines · Bastien Curutchet
Quoted 16 lines · Sean Young
Quoted 8 lines · Alexei Starovoitov
Quoted 6 lines · Bastien Curutchet (eBPF Foundation)
test_lirc_mode.shfails with the following when run from the vmtest VM:root@(none):/root/bpf# ./test_lirc_mode2.sh Failed to read decoded IR: Resource temporarily unavailable FAIL: lirc_mode2Quoted 6 lines
Quoted 4 lines
As part of the ongoing effort to get rid of any standalone test, this script should either be fixed and converted to
test_progsor removed.Remove it.
cc Sean
Quoted 8 lines
I've sent a fix to for the test in a separate email.
This regressed a long time ago; is anyone running these tests? There is not much point to selftests if they're not run by anyone. I should add them to linux-media CI, but is anyone in bpf running them?
I am not familiar with
test_progs, what's that?
test_progsis the selftest's application run by the BPF CI for every patch series sent to [email protected] (or PR done to the BPF github). It's made out of the C files located intools/testing/selftests/bpf/prog_tests/.The shell scripts under
tools/testing/selftests/bpfaren't run automatically anywhere (to my knowledge at least). The goal of the 'on- going effort' I mentioned is to get rid of these scripts by either integrating them to the 'test_progsinfra' or removing them.
Quoted 8 lines
Quoted 4 lines
If you're going to add this script to the linux-media CI, maybe we could remove it from here ?
Gentle ping: would it be OK for you if we remove the test from here ? I've seen your fix, the bug was introduced in 5.17, which means no one had run it for 4 years. Given that, I'm not sure it's worth the effort of porting it to the
test_progsinfra.
So the test is useful and should be run regularly. It should be ported to test_progs or moved to media-ci. I haven't decided yet which way I want to go. I'm just a bit busy right now, I'll get round to it soon.
Thanks,
Sean