20 Commits

Author SHA1 Message Date
Daniel Hofstetter f8737149f0 tests: remove unused imports 2025-09-07 13:47:28 +02:00
Sylvestre Ledru e9ea7a5dc0 use uutests 2025-04-11 23:59:07 +02:00
Tuomas Tynkkynen e8f49f5558 pidof: Support --check-root option 2025-04-02 22:41:08 +03:00
Tuomas Tynkkynen 191b10a95e pidof: Implement '-x' flag 2025-03-27 20:12:40 +02:00
Tuomas Tynkkynen 9fb6aa3be5 pidof: Implement --with-workers
Lots of tests rely on finding kthreadd thus -w flag needs to be added
to them.
2025-03-24 18:46:17 +02:00
Daniel Hofstetter 5ca17df66a pidof: rename test & remove target_os cfg 2025-03-21 10:58:07 +01:00
Daniel Hofstetter 05fcfdcaef pidof: don't require program name as arg 2025-03-21 10:55:59 +01:00
Daniel Hofstetter 92d674b3b2 pidof: disable "test_find_init", as it fails in CI 2025-03-20 09:31:42 +01:00
Tuomas Tynkkynen 967d288d8b pidof: Support '-t' flag
This flag makes pidof print thread ids of threads belonging to the
matching processes.
2025-02-17 18:38:52 +02:00
Daniel Hofstetter f29258751f tests: compile regexes outside of loop
fix warnings from regex_creation_in_loops lint
2025-01-10 10:42:23 +01:00
Daniel Hofstetter c260f754b9 pidof: use -S/--separator in addition to -d 2024-08-29 10:32:08 +02:00
Daniel Hofstetter e601096eeb pidof: allow --omit-pid as long of -o 2024-08-28 17:27:27 +02:00
Daniel Hofstetter 9d03aada47 pidof: allow --single-shot as long of -s 2024-08-28 16:10:39 +02:00
Krysztal Huang 07e2c35b1d pidof: Assert number for PIDs 2024-07-16 17:31:40 +08:00
Krysztal Huang 19ac43b0ef pidof: Return multiple PIDs while multiple program
This commit fixed `-s` flag only output one result.

Before this commit:

```shell
❯ cargo run pidof -s zsh zsh zsh
218159
```

After:

```shell
❯ cargo run pidof -s zsh zsh zsh
218159 218159 218159
```

The behavior of uutils' implementation are as same as GNU's implementation now.
2024-07-16 17:31:33 +08:00
Krysztal Huang ed35512f8a pidof: Implemented -o (#123)
* pidof: Implemented `-o`

This commit implemented two usage of `-o` which are already implemented in GNU's implementation, but not in ours.

```shell
❯ cargo run pidof zsh
116473 116472 116401 116391

❯ cargo run pidof -o116473,116472 zsh
116401 116391

❯ cargo run pidof -o116473 -o116472 zsh
116401 116391
```

And the GNU's implementation:

```shell
❯ pidof zsh
116473 116472 116401 116391

❯ pidof -o116473,116472 zsh
116401 116391

❯ pidof -o116473 -o116472 zsh
116401 116391
```

* pidof: Add test for `-q` flag.

* pidof: Simplify tests.
2024-07-16 07:52:46 +02:00
Krysztal Huang a69de2dcd2 pidof: Add test for no name and no pid found case. 2024-07-10 16:00:26 +08:00
Krysztal Huang de3ffd0595 pidof: Fix lint and fmt 2024-07-09 22:40:28 +08:00
Krysztal Huang cc1ea0253d pidof: Fix match logic 2024-07-09 22:31:03 +08:00
Krysztal Huang 40199f249f pidof: Add test file 2024-07-08 16:35:44 +08:00