Jesse Rosenstock 40a81414b0 taskset: Document and add test for 0 PID
Since util-linux/util-linux@6c87a3ac5e (taskset: Accept 0 pid for current
process), util-linux's taskset has accepted a 0 PID for the taskset
process.

Toybox has always had this behavior, inherited from sched_getaffinity(2)
and sched_setaffinity(2).

https://www.man7.org/linux/man-pages/man2/sched_getaffinity.2.html

Document the zero PID behavior and use it to simplify the tests.

Note that toybox and util-linux show different output.  I'm not sure if
this should be considered a bug or not.

% ./toybox taskset 1 ./toybox taskset -p 0
pid 0's current affinity mask: 1
% ./taskset 1 ./taskset -p 0
pid 2140985's current affinity mask: 1
2025-07-04 15:25:34 -05:00
..
2024-12-03 14:09:20 -06:00
2021-01-07 16:10:47 -06:00
2022-09-13 22:45:33 -05:00
2025-04-28 17:39:27 -05:00
2020-05-13 01:32:21 -05:00
2023-06-15 21:56:27 -05:00
2023-01-09 00:58:45 -06:00
2024-10-25 23:40:19 -05:00
2024-09-05 10:30:35 -05:00
2019-12-06 13:16:23 -06:00
2023-09-07 03:48:54 -05:00
2023-12-15 01:10:15 -06:00
2024-05-15 13:29:06 -05:00
2022-01-10 17:07:49 -06:00
2024-02-21 06:44:59 -06:00
2022-04-25 21:38:02 -05:00
2024-03-22 16:09:45 -05:00
2021-08-27 09:02:40 -05:00
2023-06-08 16:04:51 -05:00
2021-02-06 19:33:13 -06:00
2025-02-06 16:13:42 -06:00
2023-08-08 14:14:30 -05:00
2023-12-15 06:58:26 -06:00
2024-02-21 06:44:59 -06:00
2024-03-04 20:35:18 -06:00
2024-03-04 20:35:18 -06:00
2023-10-02 08:45:14 -05:00
2020-12-06 02:24:12 -06:00
2024-06-02 04:30:27 -05:00
2024-02-08 05:56:37 -06:00
2023-08-30 15:11:43 -05:00

The build infrastructure adds a "make test_NAME" target for each NAME.test
file in this directory, and "make tests" iterates through all of them.

Individual tests boil down to a call to "scripts/test.sh NAME", and
testing all is "scripts/test.sh" with no arguments.

The test infrastructure, including the shell functions each test calls
(mostly "testcmd" and "optional") is described in scripts/test.sh