Open-CAS / open-cas-linux

Open CAS Linux
https://open-cas.com
BSD 3-Clause "New" or "Revised" License
223 stars 82 forks source link

Improve test_insufficient_memory_for_cas_module #1541

Open Deixx opened 1 month ago

Deixx commented 1 month ago

Description

Test for insufficient memory could use ulimit as the tool for achieving low memory available when loading module. Examples:

# modprobe -r cas_cache
# ulimit -v 20000 -m 20000
# modprobe cas_cache
modprobe: error while loading shared libraries: libdl.so.2: failed to map segment from shared object
# ulimit -v 30000 -m 30000
# modprobe cas_cache
modprobe: ERROR: could not insert 'cas_cache': Cannot allocate memory
# ulimit -v 60000 -m 60000
# modprobe cas_cache
modprobe: ERROR: could not insert 'cas_cache': Cannot allocate memory
# ulimit -v 70000 -m 70000
# modprobe cas_cache
# echo $?
0

TODO: figure out what values should be used. The values in the examples above don't match values calculated currently by the test.

Reason

Test for insufficient memory is currently unreliable. In the latest runs allocating memory couldn't bring system memory down to required level without crashing the system. System available_memory run out before required level of free_memory could be reached.