test: skip instead of fail when mem constrained
authorMichael Cornacchia <cornacch@ca.ibm.com>
Fri, 6 Nov 2015 17:51:48 +0000 (12:51 -0500)
committerMyles Borins <mborins@us.ibm.com>
Tue, 19 Jan 2016 19:52:13 +0000 (11:52 -0800)
commite2141cb75eb0f645ea64cb25ee6596af8a22eb7e
tree62cf6478eb0e7a5bc53aec2aee11ad32e848a7dc
parent70c95ea0e526016f85b1456a886fd2694ab36cec
test: skip instead of fail when mem constrained

The current implementation of tests for strings with length at or
exceeding kStringMaxLength allocate a temporary buffer inside a try
block to skip the test if there is insufficient memory. This commit adds
an invocation of the garbage collector after the temporary buffer is
allocated so that memory is freed for later allocations.

Change the corresponding catch block to rethrow the original exception
instead of asserting the exception message to provide more information
about the exception.

Add an additional check before trying to allocate memory to immediately
skip the test on machines with insufficient total memory.

PR-URL: https://github.com/nodejs/node/pull/3697
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michaƫl Zasso <mic.besace@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
test/common.js
test/parallel/test-stringbytes-external-at-max.js
test/parallel/test-stringbytes-external-exceed-max-by-1-ascii.js
test/parallel/test-stringbytes-external-exceed-max-by-1-base64.js
test/parallel/test-stringbytes-external-exceed-max-by-1-binary.js
test/parallel/test-stringbytes-external-exceed-max-by-1-hex.js
test/parallel/test-stringbytes-external-exceed-max-by-1-utf8.js
test/parallel/test-stringbytes-external-exceed-max-by-2.js
test/parallel/test-stringbytes-external-exceed-max.js