1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

tests/leaks.sh: workaround minor variation when run with shcomp

For unknown reasons, the test for a memory leak in 'read -C stat
<<< "$data"' can show an intermittent minor variation in memory
usage when run with shcomp on certain versions of macOS.

The reported variations are 48 bytes or 80 bytes. This is too small
to be the result of an actual memory leak in the tested command;
it is repeated 500 times so that any real leak should show a
difference of at least 500 bytes.

src/cmd/ksh93/tests/leaks.sh:
- Add a tolerance of 128 bytes to get rid of the false failure.

Fixes #70 (hopefully).
This commit is contained in:
Martijn Dekker 2020-07-10 23:01:22 +01:00
parent 778fd6ca2d
commit 84e2f6d92f

View file

@ -99,7 +99,8 @@ for ((i=0; i < 500; i++))
do read -C stat <<< "$data" do read -C stat <<< "$data"
done done
after=$(getmem) after=$(getmem)
(( after > before )) && err_exit "memory leak with read -C when using <<< (leaked $((after - before)) $unit)" # this test can show minor variations in memory usage when run with shcomp: https://github.com/ksh93/ksh/issues/70
(( after > before+128 )) && err_exit "memory leak with read -C when using <<< (leaked $((after - before)) $unit)"
# ====== # ======
# Unsetting an associative array shouldn't cause a memory leak # Unsetting an associative array shouldn't cause a memory leak