-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removes redundant re-running of kani process #60
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,18 @@ export async function runKaniHarnessInterface(harnessName: string, args?: number | |
harnessCommand = `${KaniConstants.CargoKaniExecutableName} ${KaniArguments.harnessFlag} ${harnessName} ${KaniArguments.unwindFlag} ${args}`; | ||
} | ||
const kaniOutput = await catchOutput(harnessCommand); | ||
return kaniOutput; | ||
if (typeof kaniOutput == 'number') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs a comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can be refactored into another function. |
||
return [kaniOutput, '']; | ||
} else if ( | ||
Array.isArray(kaniOutput) && | ||
kaniOutput.length == 2 && | ||
typeof kaniOutput[0] === 'number' && | ||
typeof kaniOutput[1] === 'object' | ||
) { | ||
return kaniOutput; | ||
} else { | ||
return [5, '']; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ??? |
||
} | ||
} | ||
|
||
/** | ||
|
@@ -97,7 +108,7 @@ export async function runCommandPure(command: string): Promise<void> { | |
} | ||
|
||
// Run a command and capture the command line output into a string | ||
async function catchOutput(command: string, cargoKaniMode: boolean = false): Promise<number> { | ||
async function catchOutput(command: string, cargoKaniMode: boolean = false): Promise<any> { | ||
const process = await runKaniCommand(command); | ||
return process; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -212,20 +212,25 @@ export class TestCase { | |
async run(item: vscode.TestItem, options: vscode.TestRun): Promise<void> { | ||
const start: number = Date.now(); | ||
if (this.proof_boolean) { | ||
const actual: number = await this.evaluate( | ||
const actualResult: any = await this.evaluate( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a verification result? What does |
||
this.file_name, | ||
this.harness_name, | ||
this.harness_unwind_value, | ||
); | ||
|
||
const actual = actualResult[0]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
|
||
const duration: number = Date.now() - start; | ||
if (actual === 0) { | ||
options.passed(item, duration); | ||
} else { | ||
const responseObject: KaniResponse | string = actualResult[1]; | ||
|
||
if (typeof responseObject == 'string') { | ||
return; | ||
} | ||
|
||
const location = new vscode.Location(item.uri!, item.range!); | ||
const responseObject: KaniResponse = await captureFailedChecks( | ||
this.harness_name, | ||
this.harness_unwind_value, | ||
); | ||
const failedChecks: string = responseObject.failedProperty; | ||
const failedMessage: string = responseObject.failedMessages; | ||
const currentCase = new FailedCase( | ||
|
@@ -270,18 +275,22 @@ export class TestCase { | |
} | ||
|
||
// Run kani on the file, crate with given arguments | ||
async evaluate(rsFile: string, harness_name: string, args?: number): Promise<number> { | ||
async evaluate( | ||
rsFile: string, | ||
harness_name: string, | ||
args?: number, | ||
): Promise<[number, KaniResponse | string]> { | ||
if (vscode.workspace.workspaceFolders !== undefined) { | ||
if (args === undefined || NaN) { | ||
const outputKani: number = await runKaniHarnessInterface(harness_name); | ||
const outputKani: any = await runKaniHarnessInterface(harness_name); | ||
return outputKani; | ||
} else { | ||
const outputKani: number = await runKaniHarnessInterface(harness_name, args); | ||
const outputKani: any = await runKaniHarnessInterface(harness_name, args); | ||
return outputKani; | ||
} | ||
} | ||
|
||
return 0; | ||
return [0, '']; | ||
} | ||
|
||
// Run kani on bolero test case, file, crate with given arguments | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't go here.