diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2026-02-05 14:39:47 +0000 |
|---|---|---|
| committer | Colin Percival <cperciva@FreeBSD.org> | 2026-02-11 06:14:23 +0000 |
| commit | 2434f3b279a90f9a47a963d5898eea610a94f6e0 (patch) | |
| tree | 5e71d84d7837ecab9ac775b25db41c715cdcaf99 | |
| parent | 238bf5ebf68429654caea62f00cb307d37c2a6bb (diff) | |
diff: Add test case for pagination resource leak
The pagination code leaks either processes or descriptors or both,
depending on the exact version of the code you have. Add a test case
which exercises this leak to facilitate fixing it.
Approved by: re (cperciva)
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: thj, kevans
Differential Revision: https://reviews.freebsd.org/D55111
(cherry picked from commit 270492602b9bd8b8fce4f021f055804978bf3f23)
(cherry picked from commit 51c2384ce049ec92e07901cf8a84c171e5d72104)
| -rwxr-xr-x | usr.bin/diff/tests/diff_test.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/usr.bin/diff/tests/diff_test.sh b/usr.bin/diff/tests/diff_test.sh index 453d82a4a3f3..2a07535d3d86 100755 --- a/usr.bin/diff/tests/diff_test.sh +++ b/usr.bin/diff/tests/diff_test.sh @@ -403,6 +403,27 @@ bigu_body() diff -U$(((1<<31)-2)) a b } +prleak_head() +{ + atf_set "descr" "Verify that pagination does not leak resources" +} +prleak_body() +{ + local n=32 + mkdir a b + for hi in $(jot -w%02x $n 0) ; do + mkdir a/$hi b/$hi + for lo in $(jot -w%02x $n 0) ; do + echo "$hi$lo" >a/$hi/$lo + echo "$hi$lo" >b/$hi/$lo + done + done + ulimit -n 1000 + ulimit -u 1000 + atf_check diff -rul a b + atf_check diff -Astone -rul a b +} + atf_init_test_cases() { atf_add_test_case simple @@ -432,4 +453,5 @@ atf_init_test_cases() atf_add_test_case dirloop atf_add_test_case bigc atf_add_test_case bigu + atf_add_test_case prleak } |
