Revert "Skip costly tests" (#35197)

* Revert "Skip costly tests"

* fix package.json format
This commit is contained in:
Nathan Shively-Sanders
2019-11-19 12:59:09 -08:00
committed by GitHub
parent af0d5d33b6
commit 0bbeab6e61
8 changed files with 5 additions and 147 deletions

View File

@@ -11,7 +11,7 @@ namespace Harness.Parallel.Host {
const isatty = tty.isatty(1) && tty.isatty(2);
const path = require("path") as typeof import("path");
const { fork } = require("child_process") as typeof import("child_process");
const { statSync, readFileSync } = require("fs") as typeof import("fs");
const { statSync } = require("fs") as typeof import("fs");
// NOTE: paths for module and types for FailedTestReporter _do not_ line up due to our use of --outFile for run.js
const FailedTestReporter = require(path.resolve(__dirname, "../../scripts/failed-tests")) as typeof import("../../../scripts/failed-tests");
@@ -186,31 +186,6 @@ namespace Harness.Parallel.Host {
return `tsrunner-${runner}://${test}`;
}
function skipCostlyTests(tasks: Task[]) {
if (statSync("tests/.test-cost.json")) {
const costs = JSON.parse(readFileSync("tests/.test-cost.json", "utf8")) as {
totalTime: number,
totalEdits: number,
data: { name: string, time: number, edits: number, costs: number }[]
};
let skippedEdits = 0;
let skippedTime = 0;
const skippedTests = new Set<string>();
let i = 0;
for (; i < costs.data.length && (skippedEdits / costs.totalEdits) < (skipPercent / 100); i++) {
skippedEdits += costs.data[i].edits;
skippedTime += costs.data[i].time;
skippedTests.add(costs.data[i].name);
}
console.log(`Skipped ${i} expensive tests; estimated time savings of ${(skippedTime / costs.totalTime * 100).toFixed(2)}% with --skipPercent=${skipPercent.toFixed(2)} chance of missing a test.`);
return tasks.filter(t => !skippedTests.has(t.file));
}
else {
console.log("No cost analysis discovered.");
return tasks;
}
}
function startDelayed(perfData: { [testHash: string]: number } | undefined, totalCost: number) {
console.log(`Discovered ${tasks.length} unittest suites` + (newTasks.length ? ` and ${newTasks.length} new suites.` : "."));
console.log("Discovering runner-based tests...");
@@ -250,7 +225,6 @@ namespace Harness.Parallel.Host {
}
tasks.sort((a, b) => a.size - b.size);
tasks = tasks.concat(newTasks);
tasks = skipCostlyTests(tasks);
const batchCount = workerCount;
const packfraction = 0.9;
const chunkSize = 1000; // ~1KB or 1s for sending batches near the end of a test

View File

@@ -67,7 +67,6 @@ let runUnitTests: boolean | undefined;
let stackTraceLimit: number | "full" | undefined;
let noColors = false;
let keepFailed = false;
let skipPercent = 5;
interface TestConfig {
light?: boolean;
@@ -81,7 +80,6 @@ interface TestConfig {
noColors?: boolean;
timeout?: number;
keepFailed?: boolean;
skipPercent?: number;
shardId?: number;
shards?: number;
}
@@ -115,9 +113,6 @@ function handleTestConfig() {
if (testConfig.keepFailed) {
keepFailed = true;
}
if (testConfig.skipPercent !== undefined) {
skipPercent = testConfig.skipPercent;
}
if (testConfig.shardId) {
shardId = testConfig.shardId;
}