Skip to content

Commit

Permalink
test: update test-linux-perf-logger
Browse files Browse the repository at this point in the history
New V8 version includes more information about regular expressions.
  • Loading branch information
targos committed Feb 8, 2025
1 parent c68131c commit dec5890
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions test/v8-updates/test-linux-perf-logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
},
];

Expand Down Expand Up @@ -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}`);
}
Expand Down

0 comments on commit dec5890

Please sign in to comment.