test: update test-linux-perf-logger

New V8 version includes more information about regular expressions.

PR-URL: https://github.com/nodejs/node/pull/58070
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
Michaël Zasso
2025-02-04 15:15:25 +01:00
parent c4fd37a5f3
commit 4410e2bf82

View File

@@ -44,42 +44,54 @@ const testCases = [
title: '--perf-basic-prof interpreted',
nodeFlags: ['--perf-basic-prof', '--no-turbo-inlining', '--no-opt'],
matches: [
'~functionOne .+/linux-perf-logger.js',
'~functionTwo .+/linux-perf-logger.js',
'test-regex',
'JS:~functionOne .+/linux-perf-logger.js',
'JS:~functionTwo .+/linux-perf-logger.js',
String.raw`RegExp\.> src: 'test-regex' flags: 'gi'`,
],
noMatches: [
String.raw`JS:\*'functionOne`,
String.raw`JS:\*'functionTwo`,
],
noMatches: ['\\*functionOne', '\\*functionTwo'],
},
{
title: '--perf-basic-prof compiled',
nodeFlags: ['--perf-basic-prof', '--no-turbo-inlining', '--always-turbofan',
'--minimum-invocations-before-optimization=0'],
matches: [
'test-regex',
'~functionOne .+/linux-perf-logger.js',
'~functionTwo .+/linux-perf-logger.js',
'\\*functionOne .+/linux-perf-logger.js',
'\\*functionTwo .+/linux-perf-logger.js',
String.raw`RegExp\.> src: 'test-regex' flags: 'gi'`,
'JS:~functionOne .+/linux-perf-logger.js',
'JS:~functionTwo .+/linux-perf-logger.js',
String.raw`JS:\*'functionOne .+/linux-perf-logger.js`,
String.raw`JS:\*'functionTwo .+/linux-perf-logger.js`,
],
noMatches: [],
},
{
title: '--perf-basic-prof-only-functions interpreted',
nodeFlags: ['--perf-basic-prof-only-functions', '--no-turbo-inlining', '--no-opt'],
matches: ['~functionOne .+/linux-perf-logger.js', '~functionTwo .+/linux-perf-logger.js'],
noMatches: ['\\*functionOne', '\\*functionTwo', 'test-regex'],
matches: [
'JS:~functionOne .+/linux-perf-logger.js',
'JS:~functionTwo .+/linux-perf-logger.js',
],
noMatches: [
String.raw`JS:\*'functionOne`,
String.raw`JS:\*'functionTwo`,
'test-regex',
],
},
{
title: '--perf-basic-prof-only-functions compiled',
nodeFlags: ['--perf-basic-prof-only-functions', '--no-turbo-inlining', '--always-turbofan',
'--minimum-invocations-before-optimization=0'],
matches: [
'~functionOne .+/linux-perf-logger.js',
'~functionTwo .+/linux-perf-logger.js',
'\\*functionOne .+/linux-perf-logger.js',
'\\*functionTwo .+/linux-perf-logger.js',
'JS:~functionOne .+/linux-perf-logger.js',
'JS:~functionTwo .+/linux-perf-logger.js',
String.raw`JS:\*'functionOne .+/linux-perf-logger.js`,
String.raw`JS:\*'functionTwo .+/linux-perf-logger.js`,
],
noMatches: [
'test-regex',
],
noMatches: ['test-regex'],
},
];
@@ -110,7 +122,7 @@ function runTest(test) {
const hexRegex = '[a-fA-F0-9]+';
for (const testRegex of test.matches) {
const lineRegex = new RegExp(`${hexRegex} ${hexRegex}.*:${testRegex}`);
const lineRegex = new RegExp(`${hexRegex} ${hexRegex}.* ${testRegex}`);
if (!lineRegex.test(report.perfMap)) {
report.errors.push(`Expected to match ${lineRegex}`);
}