log harness output to file
This commit is contained in:
parent
9139a08c4d
commit
e44b86b084
@ -154,8 +154,8 @@ export async function runTests(spec: TestRunSpec) {
|
|||||||
|
|
||||||
process.on("SIGINT", () => handleSignal);
|
process.on("SIGINT", () => handleSignal);
|
||||||
process.on("SIGTERM", () => handleSignal);
|
process.on("SIGTERM", () => handleSignal);
|
||||||
process.on("unhandledRejection", handleSignal);
|
//process.on("unhandledRejection", handleSignal);
|
||||||
process.on("uncaughtException", handleSignal);
|
//process.on("uncaughtException", handleSignal);
|
||||||
|
|
||||||
for (const [n, testCase] of allTests.entries()) {
|
for (const [n, testCase] of allTests.entries()) {
|
||||||
const testName = getTestName(testCase);
|
const testName = getTestName(testCase);
|
||||||
@ -176,9 +176,18 @@ export async function runTests(spec: TestRunSpec) {
|
|||||||
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const testDir = path.join(testRootDir, testName);
|
||||||
|
fs.mkdirSync(testDir, { recursive: true });
|
||||||
|
|
||||||
|
const harnessLogFilename = path.join(testRootDir, testName, "harness.log");
|
||||||
|
const harnessLogStream = fs.createWriteStream(harnessLogFilename);
|
||||||
|
|
||||||
currentChild.stderr?.pipe(process.stderr);
|
currentChild.stderr?.pipe(process.stderr);
|
||||||
currentChild.stdout?.pipe(process.stdout);
|
currentChild.stdout?.pipe(process.stdout);
|
||||||
|
|
||||||
|
currentChild.stdout?.pipe(harnessLogStream);
|
||||||
|
currentChild.stderr?.pipe(harnessLogStream);
|
||||||
|
|
||||||
const result: TestRunResult = await new Promise((resolve, reject) => {
|
const result: TestRunResult = await new Promise((resolve, reject) => {
|
||||||
let msg: TestRunResult | undefined;
|
let msg: TestRunResult | undefined;
|
||||||
currentChild!.on("message", (m) => {
|
currentChild!.on("message", (m) => {
|
||||||
@ -204,6 +213,8 @@ export async function runTests(spec: TestRunSpec) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
harnessLogStream.close();
|
||||||
|
|
||||||
console.log(`parent: got result ${JSON.stringify(result)}`);
|
console.log(`parent: got result ${JSON.stringify(result)}`);
|
||||||
|
|
||||||
testResults.push(result);
|
testResults.push(result);
|
||||||
@ -247,9 +258,16 @@ if (runTestInstrStr) {
|
|||||||
console.log(`running test ${testName} in worker process`);
|
console.log(`running test ${testName} in worker process`);
|
||||||
|
|
||||||
process.on("disconnect", () => {
|
process.on("disconnect", () => {
|
||||||
|
console.log("got disconnect from parent");
|
||||||
process.exit(3);
|
process.exit(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
require("source-map-support").install();
|
||||||
|
} catch (e) {
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
|
||||||
const runTest = async () => {
|
const runTest = async () => {
|
||||||
let testMain: TestMainFunction | undefined;
|
let testMain: TestMainFunction | undefined;
|
||||||
for (const t of allTests) {
|
for (const t of allTests) {
|
||||||
@ -270,7 +288,6 @@ if (runTestInstrStr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const testDir = path.join(testRootDir, testName);
|
const testDir = path.join(testRootDir, testName);
|
||||||
fs.mkdirSync(testDir);
|
|
||||||
console.log(`running test ${testName}`);
|
console.log(`running test ${testName}`);
|
||||||
const gc = new GlobalTestState({
|
const gc = new GlobalTestState({
|
||||||
testDir,
|
testDir,
|
||||||
|
Loading…
Reference in New Issue
Block a user