Don't check invariants when running RWC tests. It adds too much running time.

This commit is contained in:
Cyrus Najmabadi 2015-02-12 17:25:57 -08:00
parent 3e8babedcf
commit be40cac7fd
2 changed files with 11 additions and 7 deletions

View File

@ -795,9 +795,12 @@ module Harness {
}
}
export function createSourceFileAndAssertInvariants(fileName: string, sourceText: string, languageVersion: ts.ScriptTarget) {
var result = ts.createSourceFile(fileName, sourceText, languageVersion, /*setParentNodes:*/ true);
Utils.assertInvariants(result, /*parent:*/ undefined);
export function createSourceFileAndAssertInvariants(fileName: string, sourceText: string, languageVersion: ts.ScriptTarget, assertInvariants = true) {
// Only set the parent nodes if we're asserting invariants. We don't need them otherwise.
var result = ts.createSourceFile(fileName, sourceText, languageVersion, /*setParentNodes:*/ assertInvariants);
if (assertInvariants) {
Utils.assertInvariants(result, /*parent:*/ undefined);
}
return result;
}
@ -805,7 +808,6 @@ module Harness {
export var defaultLibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest);
export var defaultES6LibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.es6.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest);
// Cache these between executions so we don't have to re-parse them for every test
export var fourslashFileName = 'fourslash.ts';
export var fourslashSourceFile: ts.SourceFile;
@ -926,7 +928,8 @@ module Harness {
settingsCallback?: (settings: ts.CompilerOptions) => void,
options?: ts.CompilerOptions,
// Current directory is needed for rwcRunner to be able to use currentDirectory defined in json file
currentDirectory?: string) {
currentDirectory?: string,
assertInvariants = true) {
options = options || { noResolve: false };
options.target = options.target || ts.ScriptTarget.ES3;
@ -1074,7 +1077,7 @@ module Harness {
var register = (file: { unitName: string; content: string; }) => {
if (file.content !== undefined) {
var fileName = ts.normalizeSlashes(file.unitName);
filemap[getCanonicalFileName(fileName)] = createSourceFileAndAssertInvariants(fileName, file.content, options.target);
filemap[getCanonicalFileName(fileName)] = createSourceFileAndAssertInvariants(fileName, file.content, options.target, assertInvariants);
}
};
inputFiles.forEach(register);

View File

@ -90,7 +90,8 @@ module RWC {
/*settingsCallback*/ undefined, opts.options,
// Since all Rwc json file specified current directory in its json file, we need to pass this information to compilerHost
// so that when the host is asked for current directory, it should give the value from json rather than from process
currentDirectory);
currentDirectory,
/*assertInvariants:*/ false);
});
function getHarnessCompilerInputUnit(fileName: string) {