Skip to content

Commit

Permalink
chore: add debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
kobyhallx committed Sep 21, 2023
1 parent c381361 commit 4fb0d87
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
3 changes: 2 additions & 1 deletion compiler/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@web/test-runner": "^0.15.3",
"@web/test-runner-webdriver": "^0.7.0",
"fflate": "^0.8.0",
"smol-toml": "^1.1.2"
"smol-toml": "^1.1.2",
"tslog": "^4.9.2"
}
}
1 change: 1 addition & 0 deletions compiler/integration-tests/test/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const TEST_LOG_LEVEL = 5; // 0: silly, 1: trace, 2: debug, 3: info, 4: warn, 5: error, 6: fatal
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { expect } from "@esm-bundle/chai";
import { TEST_LOG_LEVEL } from "../../environment.js";
import { Logger } from "tslog";
import { initializeResolver } from "@noir-lang/source-resolver";
import newCompiler, {
compile,
Expand All @@ -18,6 +20,8 @@ import { Barretenberg, RawBuffer, Crs } from "@aztec/bb.js";

import * as TOML from "smol-toml";

const logger = new Logger({ name: "test", minLevel: TEST_LOG_LEVEL });

await newCompiler();
await newABICoder();
await initACVM();
Expand Down Expand Up @@ -155,6 +159,8 @@ describe("It compiles noir program code, receiving circuit bytes and abi object.
optimizeMainProofForRecursion
);

logger.debug("main_verification", main_verification);

expect(main_verification).to.be.true;

const numPublicInputs = 1;
Expand All @@ -180,6 +186,8 @@ describe("It compiles noir program code, receiving circuit bytes and abi object.
input_aggregation_object: ["0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0"]
};

logger.debug("recursion_inputs", recursion_inputs);

const { circuit: recursion_circuit, abi: recursion_abi } = await getCircuit(
circuit_recursion_source
);
Expand Down Expand Up @@ -207,8 +215,22 @@ describe("It compiles noir program code, receiving circuit bytes and abi object.
optimizeRecursionProofForRecursion
);

const recursion_numPublicInputs = 1;

const recursion_proofAsFields = (
await api.acirSerializeProofIntoFields(
acirComposer,
recursion_proof,
recursion_numPublicInputs
)
).map((p) => p.toString());

logger.debug("recursion_proofAsFields", recursion_proofAsFields);

const recursion_verification = await verifyProof(recursion_proof, false);

logger.debug("recursion_verification", recursion_verification);

expect(recursion_verification).to.be.true;
}).timeout(60 * 20e3);
});
15 changes: 14 additions & 1 deletion compiler/integration-tests/web-test-runner.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@ import { fileURLToPath } from "url";
import { esbuildPlugin } from "@web/dev-server-esbuild";
import { webdriverLauncher } from "@web/test-runner-webdriver";

let reporter = summaryReporter();
const debugPlugins = [];
// eslint-disable-next-line no-undef
const reporter = process.env.CI ? summaryReporter() : defaultReporter();
if (process.env.CI !== "true" || process.env.RUNNER_DEBUG === "1") {
reporter = defaultReporter();
debugPlugins.push({
name: "environment",
serve(context) {
if (context.path === "/compiler/integration-tests/test/environment.js") {
return "export const TEST_LOG_LEVEL = 2;";
}
},
});
}

export default {
browsers: [
Expand All @@ -23,6 +35,7 @@ export default {
esbuildPlugin({
ts: true,
}),
...debugPlugins,
],
files: ["test/integration/browser/recursion.test.ts"],
nodeResolve: { browser: true },
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4290,6 +4290,7 @@ __metadata:
"@web/test-runner-webdriver": ^0.7.0
fflate: ^0.8.0
smol-toml: ^1.1.2
tslog: ^4.9.2
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -7014,6 +7015,13 @@ __metadata:
languageName: node
linkType: hard

"tslog@npm:^4.9.2":
version: 4.9.2
resolution: "tslog@npm:4.9.2"
checksum: 702e45647a68b127d63c5eb63a0f322af8d01f17b689127d32238d6ca2ef76889648a00b88c040430e3126acedef070022b20ebd81823879ba3766cf5188c868
languageName: node
linkType: hard

"tsscmp@npm:1.0.6":
version: 1.0.6
resolution: "tsscmp@npm:1.0.6"
Expand Down

0 comments on commit 4fb0d87

Please sign in to comment.