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

Do not skip tests in run-tests-zkasm.js #306

Merged
merged 4 commits into from
Oct 9, 2023
Merged
Changes from all 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
20 changes: 15 additions & 5 deletions tools/run-tests-zkasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,24 @@ async function main() {
// Get all zkasm files
const pathZkasm = path.join(process.cwd(), process.argv[2]);
const files = await getTestFiles(pathZkasm);


let wasFailed = false;
// Run all zkasm files
// eslint-disable-next-line no-restricted-syntax
console.log(chalk.yellow('--> Start running zkasm files'));
for (const file of files) {
if (file.includes('ignore'))
continue;
await runTest(file, cmPols);
if (await runTest(file, cmPols) == 1) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From this like, it's not really clear what "1" means. We can either document the function runTest to describe which values it returns or rename the function to make it more obvious (e.g. testPasses).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed here

wasFailed = true;
}
}
if (wasFailed) {
process.exit(1);
}
}

// returns true if test succeed and false if test failed
async function runTest(pathTest, cmPols) {
// Compile rom
const configZkasm = {
Expand All @@ -40,15 +47,16 @@ async function runTest(pathTest, cmPols) {
allowOverwriteLabels: true,
};

const rom = await zkasm.compile(pathTest, null, configZkasm);

const config = {
debug: true,
stepsN: 8388608,
assertOutputs: false,
};

let failed = false;
// execute zkasm tests
try {
const rom = await zkasm.compile(pathTest, null, configZkasm);
const result = await smMain.execute(cmPols.Main, emptyInput, rom, config);
console.log(chalk.green(' --> pass'), pathTest);
if (argv.verbose) {
Expand All @@ -62,8 +70,10 @@ async function runTest(pathTest, cmPols) {
}
} catch (e) {
console.log(chalk.red(' --> fail'), pathTest);
throw new Error(e);
console.log(e);
failed = true;
}
return failed;
}

main();