vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
985 stars 118 forks source link

test(check.rb): add #ulimit instruction #510

Closed tueda closed 1 month ago

tueda commented 1 month ago

This may resolve the problem in https://github.com/vermaseren/form/pull/509#issuecomment-2090771016; "no memory" failures are system-dependent.

For example, in the following test fold:

*--#[ example :
.end
#require linux?
#require wordsize == 4
#pend_if !serial?
#ulimit -v 4_000_000
assert succeeded?
*--#] example :

the maximum virtual memory is limited to 4*1000*1000*1024 ~ 4 GB (at least, bash and fish seem to support ulimit -v). If you decrease the memory size to 2_000_000, then the FORM job fails due to insufficient memory.

With a fixed maximum memory size (and the same word size), it must be easy to reproduce a memory shortage in a certain situation.

@jodavies Can you try this?

coveralls commented 1 month ago

Coverage Status

coverage: 48.729% (+0.01%) from 48.717% when pulling 309c8cbf0e9670f9de07ce2e97420b5daf4a47b7 on tueda:test-ulimit into 8923c77090fcc41e6c5fba0c29564a1c1138f510 on vermaseren:master.

jodavies commented 1 month ago

Yes this looks good. With a 4G limit you can crash with the version of the test in https://github.com/vermaseren/form/issues/508#issuecomment-2092414213 with i running to 5000, in 0.8s. This configuration causes a ~20GB virt.

tueda commented 1 month ago

OK. Thanks. Then, I will merge it.

In fact, ulimit is shell-dependent. POSIX only specifies the -f option. Maybe

#require ENV["SHELL"] =~ /bash|fish/  # or ulimit -v probably works with dash/zsh etc.?

or something like that could be needed.