Skip to content
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

Fix visualization process #50

Merged
merged 6 commits into from
Mar 31, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions src/ui/reportView/callReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import process = require('process');
import * as vscode from 'vscode';

import { KaniArguments, KaniConstants } from '../../constants';
import { checkCargoExist, getRootDir } from '../../utils';
import { getKaniPath } from '../../model/kaniRunner';
import { CommandArgs, checkCargoExist, getRootDir, splitCommand } from '../../utils';

const { execFile } = require('child_process');
const { promisify } = require('util');
Expand Down Expand Up @@ -66,7 +67,7 @@ export async function callViewerReport(
harnessType,
);
const crateURI: string = getRootDir();
finalCommand = `cd ${crateURI} && ${responseObject.finalCommand}`;
finalCommand = `${responseObject.finalCommand}`;
searchDir = responseObject.searchDir;
}

Expand Down Expand Up @@ -160,17 +161,31 @@ function createCommand(
*/
async function runVisualizeCommand(command: string, harnessName: string): Promise<reportMetadata> {
try {
// Get the full resolved path for the root directory of the crate
const directory = path.resolve(getRootDir());
const commmandSplit: CommandArgs = splitCommand(command);

// Get cargo command and args for the command to be executed
const args = commmandSplit.args;
jaisnan marked this conversation as resolved.
Show resolved Hide resolved

const options = {
shell: false,
cwd: directory,
};

const kaniBinaryPath = await getKaniPath('cargo-kani');
vscode.window.showInformationMessage(`Generating viewer report for ${harnessName}`);
vscode.window.showWarningMessage(warningMessage);
const { stdout, stderr } = await execPromise(command);
const { stdout, stderr } = await execPromise(kaniBinaryPath, args, options);
const parseResult = await parseReportOutput(stdout);
if (parseResult === undefined) {
return { statusCode: 2, result: undefined, error: stderr };
}
console.error(`stderr: ${stderr}`);

return { statusCode: 0, result: parseResult };
} catch (error) {
}
catch (error) {
jaisnan marked this conversation as resolved.
Show resolved Hide resolved
console.error(`exec error: ${error}`);
return { statusCode: 1, result: undefined, error: error as string };
}
Expand Down