Skip to content

Commit

Permalink
Tests: adapting js_fetch_objects.t for slow machines.
Browse files Browse the repository at this point in the history
The test is too slow to trigger timeout in perl tests
when the following condition are met:
    * ASAN build, with ASAN_OPTIONS=fast_unwind_on_malloc=0
    * -DNJS_DEBUG_MEMORY -DNGX_DEBUG_PALLOC -DNGX_DEBUG_MALLOC in CFLAGS

Previously, invalid header name test produced many JS exception.
While looking for symbol names NJS allocates/deallocates a lot of memory.
In combination with the conditions above this might result in a timeout.

The fix is to simplify invalid header name test.
  • Loading branch information
xeioex committed Oct 15, 2024
1 parent cc45d43 commit 6709fc9
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions nginx/t/js_fetch_objects.t
Original file line number Diff line number Diff line change
Expand Up @@ -139,30 +139,8 @@ $t->write_file('test.js', <<EOF);
return h.get('a');
}, 'X'],
['invalid header name', () => {
const valid = "!#\$\%&'*+-.^_`|~0123456789";
for (var i = 0; i < 128; i++) {
var c = String.fromCodePoint(i);
if (valid.indexOf(c) != -1 || /[a-zA-Z]+/.test(c)) {
continue;
}
try {
new Headers([[c, 'a']]);
throw new Error(
`header with "\${c}" (\${i}) should throw`);
} catch (e) {
if (e.message != 'invalid header name') {
throw e;
}
}
}
return 'OK';
}, 'OK'],
var h = new Headers([[':', 'a']]);
}, 'invalid header name'],
['invalid header value', () => {
var h = new Headers({A: 'aa\x00a'});
}, 'invalid header value'],
Expand Down

0 comments on commit 6709fc9

Please sign in to comment.