2023-09-25 14:43:57

by Juntong Deng

[permalink] [raw]
Subject: [RFC] selftests: Add dependencies information for kselftest

Most of the tests in kselftest rely on external tools and libraries
to run, which means that in order to run the tests effectively we need
to have all the dependencies installed first.

But unfortunately, there is currently no way to know in advance what
tools and libraries the tests in kselftest depend on, and can only be
known when a test run fails.

For example after running the alsa subsystem test I realized I needed
to install the libasound-dev package.

This is inefficient for the test of subsystems that require a long
time to run.

For example, the net subsystem test, which takes more than an hour to
run a complete test.

I can only know that I need to install numactl, libnuma-dev, ethtool,
mausezahn, netsniff-ng, ndisc6, netperf, and other tools after carefully
reviewing the results of the tests.

I think we should add dependencies information to the Makefile for
each subsystem test, either as a comment or as an output target of
the Makefile, it would save a lot of time for the people running
the tests.

I can do this part of the work.

Welcome to discuss!

Juntong Deng


2023-09-25 19:21:57

by Juntong Deng

[permalink] [raw]
Subject: Re: [RFC] selftests: Add dependencies information for kselftest

On 2023/9/25 19:24, Ricardo B. Marliere wrote:
> On 23/09/25 06:25PM, Juntong Deng wrote:
>> Most of the tests in kselftest rely on external tools and libraries
>> to run, which means that in order to run the tests effectively we need
>> to have all the dependencies installed first.
>>
>> But unfortunately, there is currently no way to know in advance what
>> tools and libraries the tests in kselftest depend on, and can only be
>> known when a test run fails.
>
> Hello Juntong,
>
> did you check if tools/testing/selftests/kselftest_deps.sh does what
> you're after? It won't tell you what packages are missing because it's
> distro-independent, but it tells you what libs your system is missing.
>
> e.g.
>
> (...)
> Targets failed build dependency check on system: alsa bpf cachestat
> capabilities clone3 filesystems fpu futex hid intel_pstate kvm landlock
> membarrier memfd mm mqueue net netfilter powerpc ptp rseq rtc safesetid
> sched seccomp timens timers user_events vDSO
> -------------------------------------------------------- Missing
> libraries system -lasound -lcap -lcap-ng -lcrypto -ldl -lelf -lfuse
> -lgcc_s -lm -lmnl -lnuma -lpopt -lpthread -lrt -lz -pthread
>
>
>
> Regards,
> - Ricardo

Hi Ricardo, thanks for your reply.

I checked kselftest_deps.sh and it does find all missing
library dependencies.

But kselftest_deps.sh cannot find missing tool dependencies,
such as ndisc6.

I think we still need to find a way to solve this problem.

Best wishes.

Juntong Deng

2023-09-25 23:24:32

by Ricardo B. Marliere

[permalink] [raw]
Subject: Re: [RFC] selftests: Add dependencies information for kselftest

On 23/09/25 06:25PM, Juntong Deng wrote:
> Most of the tests in kselftest rely on external tools and libraries
> to run, which means that in order to run the tests effectively we need
> to have all the dependencies installed first.
>
> But unfortunately, there is currently no way to know in advance what
> tools and libraries the tests in kselftest depend on, and can only be
> known when a test run fails.

Hello Juntong,

did you check if tools/testing/selftests/kselftest_deps.sh does what
you're after? It won't tell you what packages are missing because it's
distro-independent, but it tells you what libs your system is missing.

e.g.

(...)
Targets failed build dependency check on system: alsa bpf cachestat
capabilities clone3 filesystems fpu futex hid intel_pstate kvm landlock
membarrier memfd mm mqueue net netfilter powerpc ptp rseq rtc safesetid
sched seccomp timens timers user_events vDSO
-------------------------------------------------------- Missing
libraries system -lasound -lcap -lcap-ng -lcrypto -ldl -lelf -lfuse
-lgcc_s -lm -lmnl -lnuma -lpopt -lpthread -lrt -lz -pthread



Regards,
- Ricardo