GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: remove common.busyLoop() · nodejs/node@1fa7347

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test
    • common
      • README.md
      • index.js
      • index.mjs
    • parallel
      • test-timers-nested.js
      • test-timers-next-tick.js
    • sequential
      • test-performance-eventloopdelay.js
      • test-timers-block-eventloop.js
      • test-timers-blocking-callback.js
      • test-timers-set-interval-excludes-callback-duration.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/common/README.md‎

Copy file name to clipboardExpand all lines: test/common/README.md
-5Lines changed: 0 additions & 5 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ tasks.
4545

4646
Takes `whitelist` and concats that with predefined `knownGlobals`.
4747

48-
### busyLoop(time)
49-
* `time` [<number>][]
50-
51-
Blocks for `time` amount of time.
52-
5348
### canCreateSymLink()
5449
* return [<boolean>][]
5550

Collapse file

‎test/common/index.js‎

Copy file name to clipboardExpand all lines: test/common/index.js
-7Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,6 @@ function nodeProcessAborted(exitCode, signal) {
464464
}
465465
}
466466

467-
function busyLoop(time) {
468-
const startTime = Date.now();
469-
const stopTime = startTime + time;
470-
while (Date.now() < stopTime) {}
471-
}
472-
473467
function isAlive(pid) {
474468
try {
475469
process.kill(pid, 'SIGCONT');
@@ -727,7 +721,6 @@ function runWithInvalidFD(func) {
727721
module.exports = {
728722
allowGlobals,
729723
buildType,
730-
busyLoop,
731724
canCreateSymLink,
732725
childShouldThrowAndAbort,
733726
createZeroFilledFile,
Collapse file

‎test/common/index.mjs‎

Copy file name to clipboardExpand all lines: test/common/index.mjs
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const {
4040
skip,
4141
ArrayStream,
4242
nodeProcessAborted,
43-
busyLoop,
4443
isAlive,
4544
expectWarning,
4645
expectsError,
@@ -87,7 +86,6 @@ export {
8786
skip,
8887
ArrayStream,
8988
nodeProcessAborted,
90-
busyLoop,
9189
isAlive,
9290
expectWarning,
9391
expectsError,
Collapse file

‎test/parallel/test-timers-nested.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-timers-nested.js
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
// Flags: --expose-internals
12
'use strict';
23

3-
const common = require('../common');
4+
require('../common');
45
const assert = require('assert');
6+
const { sleep } = require('internal/util');
57

68
// Make sure we test 0ms timers, since they would had always wanted to run on
79
// the current tick, and greater than 0ms timers, for scenarios where the
@@ -23,7 +25,7 @@ scenarios.forEach(function(delay) {
2325

2426
// Busy loop for the same timeout used for the nested timer to ensure that
2527
// we are in fact expiring the nested timer.
26-
common.busyLoop(delay);
28+
sleep(delay);
2729

2830
// The purpose of running this assert in nextTick is to make sure it runs
2931
// after A but before the next iteration of the libuv event loop.
Collapse file

‎test/parallel/test-timers-next-tick.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-timers-next-tick.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
// Flags: --expose-internals
12
'use strict';
23

34
const common = require('../common');
5+
const { sleep } = require('internal/util');
46

57
// This test verifies that the next tick queue runs after each
68
// individual Timeout, as well as each individual Immediate.
@@ -16,7 +18,7 @@ const t2 = setTimeout(common.mustNotCall(), 1);
1618
const t3 = setTimeout(common.mustNotCall(), 1);
1719
setTimeout(common.mustCall(), 1);
1820

19-
common.busyLoop(5);
21+
sleep(5);
2022

2123
setImmediate(common.mustCall(() => {
2224
process.nextTick(() => {
Collapse file

‎test/sequential/test-performance-eventloopdelay.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-performance-eventloopdelay.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
// Flags: --expose-gc
1+
// Flags: --expose-gc --expose-internals
22
'use strict';
33

44
const common = require('../common');
55
const assert = require('assert');
66
const {
77
monitorEventLoopDelay
88
} = require('perf_hooks');
9+
const { sleep } = require('internal/util');
910

1011
{
1112
const histogram = monitorEventLoopDelay();
@@ -54,7 +55,7 @@ const {
5455
histogram.enable();
5556
let m = 5;
5657
function spinAWhile() {
57-
common.busyLoop(1000);
58+
sleep(1000);
5859
if (--m > 0) {
5960
setTimeout(spinAWhile, common.platformTimeout(500));
6061
} else {
Collapse file

‎test/sequential/test-timers-block-eventloop.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-timers-block-eventloop.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
// Flags: --expose-internals
12
'use strict';
23

34
const common = require('../common');
45
const assert = require('assert');
6+
const { sleep } = require('internal/util');
57

68
let called = false;
79
const t1 = setInterval(() => {
@@ -14,5 +16,5 @@ const t1 = setInterval(() => {
1416
}, 10);
1517

1618
const t2 = setInterval(() => {
17-
common.busyLoop(20);
19+
sleep(20);
1820
}, 10);
Collapse file

‎test/sequential/test-timers-blocking-callback.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-timers-blocking-callback.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Flags: --expose-internals
12
'use strict';
23

34
/*
@@ -25,6 +26,7 @@
2526

2627
const common = require('../common');
2728
const assert = require('assert');
29+
const { sleep } = require('internal/util');
2830

2931
const TIMEOUT = 100;
3032

@@ -65,7 +67,7 @@ function blockingCallback(retry, callback) {
6567
return callback();
6668
} else {
6769
// Block by busy-looping to trigger the issue
68-
common.busyLoop(TIMEOUT);
70+
sleep(TIMEOUT);
6971

7072
timeCallbackScheduled = Date.now();
7173
setTimeout(blockingCallback.bind(null, retry, callback), TIMEOUT);
Collapse file

‎test/sequential/test-timers-set-interval-excludes-callback-duration.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-timers-set-interval-excludes-callback-duration.js
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
// Flags: --expose-internals
12
'use strict';
2-
const common = require('../common');
3+
require('../common');
34
const assert = require('assert');
5+
const { sleep } = require('internal/util');
46

57
let cntr = 0;
68
let first;
79
const t = setInterval(() => {
810
cntr++;
911
if (cntr === 1) {
10-
common.busyLoop(100);
12+
sleep(100);
1113
// Ensure that the event loop passes before the second interval
1214
setImmediate(() => assert.strictEqual(cntr, 1));
1315
first = Date.now();

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.