Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,18 @@
'use strict';
const common = require('../common');
const { isCPPSymbolsNotMapped } = require('./util');
if (isCPPSymbolsNotMapped) {
common.skip('C++ symbols are not mapped for this os.');
}
const base = require('./tick-processor-base.js');
base.runTest({
pattern: /Builtin_DateNow/,
code: `function f() {
this.ts = Date.now();
setImmediate(function() { new f(); });
};
f();`,
});

View File

@ -0,0 +1,18 @@
'use strict';
const common = require('../common');
const { isCPPSymbolsNotMapped } = require('./util');
if (isCPPSymbolsNotMapped) {
common.skip('C++ symbols are not mapped for this os.');
}
const base = require('./tick-processor-base.js');
base.runTest({
pattern: /MakeContext/,
code: `function f() {
require('vm').createContext({});
setImmediate(function() { f(); });
};
f();`,
});

View File

@ -0,0 +1,59 @@
'use strict';
const common = require('../common');
const { isCPPSymbolsNotMapped } = require('./util');
const tmpdir = require('../common/tmpdir');
tmpdir.refresh();
if (isCPPSymbolsNotMapped) {
common.skip('C++ symbols are not mapped for this OS.');
}
// This test will produce a broken profile log.
// ensure prof-polyfill not stuck in infinite loop
// and success process
const assert = require('assert');
const { spawn, spawnSync } = require('child_process');
const { writeFileSync } = require('fs');
const LOG_FILE = tmpdir.resolve('tick-processor.log');
const RETRY_TIMEOUT = 150;
const BROKEN_PART = 'tick,';
const WARN_REG_EXP = /\(node:\d+\) \[BROKEN_PROFILE_FILE] Warning: Profile file .* is broken/;
const WARN_DETAIL_REG_EXP = /".*tick," at the file end is broken/;
const code = `function f() {
this.ts = Date.now();
setImmediate(function() { new f(); });
};
f();`;
const proc = spawn(process.execPath, [
'--no_logfile_per_isolate',
'--logfile=-',
'--prof',
'-pe', code,
], {
stdio: ['ignore', 'pipe', 'inherit'],
});
let ticks = '';
proc.stdout.on('data', (chunk) => ticks += chunk);
function runPolyfill(content) {
proc.kill();
content += BROKEN_PART;
writeFileSync(LOG_FILE, content);
const child = spawnSync(
`${process.execPath}`,
[
'--prof-process', LOG_FILE,
]);
assert.match(child.stderr.toString(), WARN_REG_EXP);
assert.match(child.stderr.toString(), WARN_DETAIL_REG_EXP);
assert.strictEqual(child.status, 0);
}
setTimeout(() => runPolyfill(ticks), RETRY_TIMEOUT);

View File

@ -0,0 +1,19 @@
'use strict';
const common = require('../common');
const { isCPPSymbolsNotMapped } = require('./util');
if (isCPPSymbolsNotMapped) {
common.skip('C++ symbols are not mapped for this os.');
}
const base = require('./tick-processor-base.js');
base.runTest({
pattern: /^{/,
code: `function f() {
require('vm').createContext({});
setImmediate(function() { f(); });
};
f();`,
profProcessFlags: ['--preprocess'],
});

View File

@ -0,0 +1,25 @@
'use strict';
const common = require('../common');
// TODO(mhdawson) Currently the test-tick-processor functionality in V8
// depends on addresses being smaller than a full 64 bits. AIX supports
// the full 64 bits and the result is that it does not process the
// addresses correctly and runs out of memory
// Disabling until we get a fix upstreamed into V8
if (common.isAIX)
common.skip('AIX address range too big for scripts.');
const base = require('./tick-processor-base.js');
// Unknown checked for to prevent flakiness, if pattern is not found,
// then a large number of unknown ticks should be present
base.runTest({
pattern: /LazyCompile.*\[eval]:1|.*% {2}UNKNOWN/,
code: `function f() {
for (let i = 0; i < 1000000; i++) {
i++;
}
setImmediate(function() { f(); });
};
f();`,
});

View File

@ -0,0 +1,6 @@
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import testpy
def GetConfiguration(context, root):
return testpy.SimpleTestConfiguration(context, root, 'tick-processor')

View File

@ -0,0 +1,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;

View File

@ -0,0 +1,25 @@
'use strict';
// Utilities for the tick-processor tests
const {
isWindows,
isSunOS,
isAIX,
isFreeBSD,
} = require('../common');
const { endianness } = require('os');
function isLinuxPPCBE() {
return (process.platform === 'linux') &&
(process.arch === 'ppc64') &&
(endianness() === 'BE');
}
module.exports = {
isCPPSymbolsNotMapped: isWindows ||
isSunOS ||
isAIX ||
isLinuxPPCBE() ||
isFreeBSD,
};