From 33ad34d722373a671824b627c5ce165f4af984fe Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 25 Sep 2026 14:24:34 +0000 Subject: [PATCH] test: fix OOM in `ndarray/base/quinary-tiling-block-size` dtype sweep The `linux_test` and `macos_test` scheduled workflows on develop have failed every day for at least the past month with `FATAL ERROR: JavaScript heap out of memory` during `make test-javascript-local`. Root cause: the test file calls `cartesianPower( dtypes(), 5 )`, enumerating all 16^5 = 1,048,576 dtype quintuplets now that `dtypes()` returns 16 entries, and asserts on each one in a single `tape` process. This commit replaces the full cartesian sweep with a cyclic rotation of the dtype list (16 quintuplets), which still exercises every dtype in every argument position but no longer exhausts the default V8 heap. The two monotonicity sanity checks are unchanged. Ref: https://github.com/stdlib-js/stdlib/actions/runs/36117442014 Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01UKGSSD6r2kGi83tGeBWnUv --- .../quinary-tiling-block-size/test/test.js | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/ndarray/base/quinary-tiling-block-size/test/test.js b/lib/node_modules/@stdlib/ndarray/base/quinary-tiling-block-size/test/test.js index 0e633be98fbe..00f7ee033e4c 100644 --- a/lib/node_modules/@stdlib/ndarray/base/quinary-tiling-block-size/test/test.js +++ b/lib/node_modules/@stdlib/ndarray/base/quinary-tiling-block-size/test/test.js @@ -23,7 +23,6 @@ var tape = require( 'tape' ); var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive; var dtypes = require( '@stdlib/ndarray/dtypes' ); -var cartesianPower = require( '@stdlib/array/base/cartesian-power' ); var promoteDataTypes = require( '@stdlib/ndarray/base/promote-dtypes' ); var quinaryBlockSize = require( './../lib' ); @@ -37,21 +36,28 @@ tape( 'main export is a function', function test( t ) { }); tape( 'the function returns a block size', function test( t ) { + var combo; var dt; var pt; var v; var i; + var j; // NOTE: we don't test for exact block size values, as we shouldn't need to make guarantees regarding the block size for any particular set of dtypes. This function is meant to be opaque, and we want to reserve the right to silently update/change return values in the future. - // Generate dtype quintuplets: - dt = cartesianPower( dtypes(), 5 ); + // Generate a list of dtypes: + dt = dtypes(); + // NOTE: testing the full cartesian product of dtypes (i.e., `dt.length^5` combinations) is prohibitively expensive and exhausts available memory. Instead, cyclically rotate the dtype list to generate quintuplets, ensuring that every dtype is exercised in every argument position at least once: for ( i = 0; i < dt.length; i++ ) { - pt = promoteDataTypes( dt[ i ] ); - dt[ i ].push( ( pt === null ) ? 'generic' : pt ); - v = quinaryBlockSize( dt[ i ][ 0 ], dt[ i ][ 1 ], dt[ i ][ 2 ], dt[ i ][ 3 ], dt[ i ][ 4 ], dt[ i ][ 5 ] ); // eslint-disable-line max-len - t.strictEqual( isPositiveInteger( v ), true, 'returns a positive integer when provided ('+dt[ i ].join( ', ' )+')' ); + combo = []; + for ( j = 0; j < 5; j++ ) { + combo.push( dt[ ( i+j ) % dt.length ] ); + } + pt = promoteDataTypes( combo ); + combo.push( ( pt === null ) ? 'generic' : pt ); + v = quinaryBlockSize( combo[ 0 ], combo[ 1 ], combo[ 2 ], combo[ 3 ], combo[ 4 ], combo[ 5 ] ); // eslint-disable-line max-len + t.strictEqual( isPositiveInteger( v ), true, 'returns a positive integer when provided ('+combo.join( ', ' )+')' ); } // Sanity check that the block size for dtypes with wider bit widths is smaller than for dtypes with shorter bit widths...