FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node/test/tick-processor/tick-processor-base.js at main · fetchapi/node · GitHub
fetchapi
/
node
Public
forked from
nodejs/node
Notifications
You must be signed in to change notification settings
Fork
1
Star
0
Code
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
node
/
test
/
tick-processor
/
tick-processor-base.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
64 lines (51 loc) · 1.41 KB
Breadcrumbs
node
/
test
/
tick-processor
/
tick-processor-base.js
Copy path
File metadata and controls
64 lines (51 loc) · 1.41 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
'use strict'
;
require
(
'../common'
)
;
const
fs
=
require
(
'fs'
)
;
const
cp
=
require
(
'child_process'
)
;
const
tmpdir
=
require
(
'../common/tmpdir'
)
;
tmpdir
.
refresh
(
)
;
const
LOG_FILE
=
tmpdir
.
resolve
(
'tick-processor.log'
)
;
const
RETRY_TIMEOUT
=
150
;
function
runTest
(
test
)
{
const
proc
=
cp
.
spawn
(
process
.
execPath
,
[
'--no_logfile_per_isolate'
,
'--logfile=-'
,
'--prof'
,
'-pe'
,
test
.
code
,
]
,
{
stdio
:
[
'ignore'
,
'pipe'
,
'inherit'
]
,
}
)
;
let
ticks
=
''
;
proc
.
stdout
.
on
(
'data'
,
(
chunk
)
=>
ticks
+=
chunk
)
;
// Try to match after timeout
setTimeout
(
(
)
=>
{
match
(
test
.
pattern
,
proc
,
(
)
=>
ticks
,
test
.
profProcessFlags
)
;
}
,
RETRY_TIMEOUT
)
;
}
function
match
(
pattern
,
parent
,
ticks
,
flags
=
[
]
)
{
// Store current ticks log
fs
.
writeFileSync
(
LOG_FILE
,
ticks
(
)
)
;
const
proc
=
cp
.
spawn
(
process
.
execPath
,
[
'--prof-process'
,
'--call-graph-size=10'
,
...
flags
,
LOG_FILE
,
]
,
{
stdio
:
[
'ignore'
,
'pipe'
,
'inherit'
]
,
}
)
;
let
out
=
''
;
proc
.
stdout
.
on
(
'data'
,
(
chunk
)
=>
out
+=
chunk
)
;
proc
.
stdout
.
once
(
'end'
,
(
)
=>
{
proc
.
once
(
'exit'
,
(
)
=>
{
fs
.
unlinkSync
(
LOG_FILE
)
;
// Retry after timeout
if
(
!
pattern
.
test
(
out
)
)
return
setTimeout
(
(
)
=>
match
(
pattern
,
parent
,
ticks
)
,
RETRY_TIMEOUT
)
;
parent
.
stdout
.
removeAllListeners
(
)
;
parent
.
kill
(
)
;
}
)
;
proc
.
stdout
.
removeAllListeners
(
)
;
proc
.
kill
(
)
;
}
)
;
}
exports
.
runTest
=
runTest
;
Back
|
FazBrowse Home
|
New Git URL