Skip to content

Commit 5d06578

Browse files
committed
fix test.sh for newer node versions
1 parent 8b27dff commit 5d06578

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

system-test/system_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cd $(dirname $0)
1414
# official releases. https://nodejs.org/en/about/releases/
1515
if [[ -z "$BINARY_HOST" ]]; then
1616
ADDITIONAL_PACKAGES="python3 g++ make"
17-
NODE_VERSIONS=(14 16 18 20)
17+
NODE_VERSIONS=(14 16 18 20 21 22)
1818
else
1919
# Tested versions for pre-built binaries are limited based on
2020
# what node-pre-gyp can specify as its target version.

system-test/test.sh

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,31 @@ if [[ "$VERIFY_TIME_LINE_NUMBERS" != "true" ]]; then
5555
npm run compile
5656
fi
5757

58+
NODE_VERSION=$(node -v | cut -d. -f1 | tr -d 'v')
5859
node -v
5960
node --trace-warnings "$BENCHPATH" 10 $VERIFY_TIME_LINE_NUMBERS
6061

6162
if [[ "$VERIFY_TIME_LINE_NUMBERS" == "true" ]]; then
62-
pprof -lines -top -nodecount=2 time.pb.gz | tee $tty | \
63-
grep "busyLoop.*src/busybench.js:[2-3][08-9]"
64-
pprof -filefunctions -top -nodecount=2 heap.pb.gz | tee $tty | \
65-
grep "busyLoop.*src/busybench.js"
63+
output=$(pprof -lines -top -nodecount=2 time.pb.gz | tee $tty)
64+
65+
# Due to V8 changes in Node 21, the line numbers are different.
66+
# It also emits "anonymous" and "idle" statuses in the output.
67+
# E.G: 1877ms 74.93% 74.93% 1878ms 74.97% (anonymous) file:/tmp/tmp.xyz/busybench/src/busybench.js:34
68+
if [ "$NODE_VERSION" -ge 21 ]; then
69+
grep "anonymous.*busybench.js:3[0-9]" <<< "$output"
70+
else
71+
grep "busyLoop.*src/busybench.js:[23][0-9]" <<< "$output"
72+
fi
73+
74+
heap_output=$(pprof -filefunctions -top -nodecount=2 heap.pb.gz | tee $tty)
75+
grep "busyLoop.*src/busybench.js" <<< "$heap_output"
6676
else
67-
pprof -filefunctions -top -nodecount=2 time.pb.gz | tee $tty | \
68-
grep "busyLoop.*src/busybench.ts"
77+
output=$(pprof -filefunctions -top -nodecount=2 time.pb.gz | tee $tty)
78+
if [ "$NODE_VERSION" -ge 21 ]; then
79+
grep "anonymous.*busybench.ts" <<< "$output"
80+
else
81+
grep "busyLoop.*src/busybench.ts" <<< "$output"
82+
fi
6983
pprof -filefunctions -top -nodecount=2 heap.pb.gz | tee $tty | \
7084
grep "busyLoop.*src/busybench.ts"
7185
fi

0 commit comments

Comments
 (0)