From 7a2f1b97383d644b0a10f546046b97164bb9541b Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Sat, 27 Jul 2024 13:41:31 +0100 Subject: [PATCH] test: skip sea tests with more accurate available disk space estimation PR-URL: https://github.com/nodejs/node/pull/53996 Reviewed-By: James M Snell Reviewed-By: Yagiz Nizipli Reviewed-By: Luigi Pinca --- test/common/sea.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/common/sea.js b/test/common/sea.js index 6de0ea2e4f8a87..53bfd93d927842 100644 --- a/test/common/sea.js +++ b/test/common/sea.js @@ -5,7 +5,7 @@ const fixtures = require('../common/fixtures'); const tmpdir = require('../common/tmpdir'); const { inspect } = require('util'); -const { readFileSync, copyFileSync } = require('fs'); +const { readFileSync, copyFileSync, statSync } = require('fs'); const { spawnSyncAndExitWithoutError, } = require('../common/child_process'); @@ -61,9 +61,12 @@ function skipIfSingleExecutableIsNotSupported() { tmpdir.refresh(); // The SEA tests involve making a copy of the executable and writing some fixtures - // to the tmpdir. To be safe, ensure that at least 120MB disk space is available. - if (!tmpdir.hasEnoughSpace(120 * 1024 * 1024)) { - common.skip('Available disk space < 120MB'); + // to the tmpdir. To be safe, ensure that the disk space has at least a copy of the + // executable and some extra space for blobs and configs is available. + const stat = statSync(process.execPath); + const expectedSpace = stat.size + 10 * 1024 * 1024; + if (!tmpdir.hasEnoughSpace(expectedSpace)) { + common.skip(`Available disk space < ${Math.floor(expectedSpace / 1024 / 1024)} MB`); } }