From 5aedb44ecdc2679e7a36ed73884c8af5820a1a3a Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Wed, 6 Nov 2024 18:13:29 +0800 Subject: [PATCH 1/3] test: ensure that test priority is not higher than current priority --- test/parallel/test-os.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js index f7059260ce507e..41b3cbdb52d65b 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -83,11 +83,11 @@ assert.ok(hostname.length > 0); // IBMi process priority is different. if (!common.isIBMi) { - const DUMMY_PRIORITY = 10; - os.setPriority(DUMMY_PRIORITY); + const LOWER_PRIORITY = Math.max(os.getPriority() + 5, 19); + os.setPriority(LOWER_PRIORITY); const priority = os.getPriority(); is.number(priority); - assert.strictEqual(priority, DUMMY_PRIORITY); + assert.strictEqual(priority, LOWER_PRIORITY); } // On IBMi, os.uptime() returns 'undefined' From 07bb9199105f7325bc183353f9f314c8a4849437 Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Wed, 6 Nov 2024 18:19:15 +0800 Subject: [PATCH 2/3] squash: fix dumb typo --- test/parallel/test-os.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js index 41b3cbdb52d65b..c1343a202bc555 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -83,7 +83,7 @@ assert.ok(hostname.length > 0); // IBMi process priority is different. if (!common.isIBMi) { - const LOWER_PRIORITY = Math.max(os.getPriority() + 5, 19); + const LOWER_PRIORITY = Math.min(os.getPriority() + 5, 19); os.setPriority(LOWER_PRIORITY); const priority = os.getPriority(); is.number(priority); From 88c836c33ff3f4d0a3f6bac00959555c50a911af Mon Sep 17 00:00:00 2001 From: LiviaMedeiros Date: Thu, 7 Nov 2024 21:36:21 +0800 Subject: [PATCH 3/3] squash: fix on windows --- test/parallel/test-os.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-os.js b/test/parallel/test-os.js index c1343a202bc555..efaec2b3ead385 100644 --- a/test/parallel/test-os.js +++ b/test/parallel/test-os.js @@ -83,7 +83,8 @@ assert.ok(hostname.length > 0); // IBMi process priority is different. if (!common.isIBMi) { - const LOWER_PRIORITY = Math.min(os.getPriority() + 5, 19); + const { PRIORITY_BELOW_NORMAL, PRIORITY_LOW } = os.constants.priority; + const LOWER_PRIORITY = os.getPriority() > PRIORITY_BELOW_NORMAL ? PRIORITY_BELOW_NORMAL : PRIORITY_LOW; os.setPriority(LOWER_PRIORITY); const priority = os.getPriority(); is.number(priority);