Skip to content

Commit f4ff1ff

Browse files
committed
Run stwo tests serially
1 parent 8349805 commit f4ff1ff

File tree

5 files changed

+164
-104
lines changed

5 files changed

+164
-104
lines changed

.config/nextest.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[test-groups]
2+
stwo-serial = { max-threads = 1 }
3+
4+
[[profile.default.overrides]]
5+
filter = 'test(stwo_serial::)'
6+
test-group = 'stwo-serial'

extensions/scarb-prove/tests/build.rs

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -27,34 +27,6 @@ fn build_executable_project() -> TempDir {
2727
t
2828
}
2929

30-
#[test]
31-
#[cfg(not(windows))]
32-
fn prove_from_execution_output() {
33-
let t = build_executable_project();
34-
35-
Scarb::quick_command()
36-
.arg("execute")
37-
.arg("--target=bootloader")
38-
.current_dir(&t)
39-
.assert()
40-
.success();
41-
42-
Scarb::quick_command()
43-
.arg("prove")
44-
.arg("--execution-id=1")
45-
.current_dir(&t)
46-
.assert()
47-
.success()
48-
.stdout_eq(indoc! {r#"
49-
[..]Proving hello
50-
warn: soundness of proof is not yet guaranteed by Stwo, use at your own risk
51-
Saving proof to: target/execute/hello/execution1/proof/proof.json
52-
"#});
53-
54-
t.child("target/execute/hello/execution1/proof/proof.json")
55-
.assert(predicates::path::exists());
56-
}
57-
5830
#[test]
5931
#[cfg(not(windows))]
6032
fn prove_fails_when_execution_output_not_found() {
@@ -110,31 +82,6 @@ fn prove_fails_when_cairo_pie_output() {
11082
"#});
11183
}
11284

113-
#[test]
114-
#[cfg(not(windows))]
115-
fn prove_with_execute() {
116-
let t = build_executable_project();
117-
118-
Scarb::quick_command()
119-
.arg("prove")
120-
.arg("--execute")
121-
.current_dir(&t)
122-
.assert()
123-
.success()
124-
.stdout_eq(indoc! {r#"
125-
[..]Compiling hello v0.1.0 ([..])
126-
[..]Finished `dev` profile target(s) in [..]
127-
[..]Executing hello
128-
Saving output to: target/execute/hello/execution1
129-
[..]Proving hello
130-
warn: soundness of proof is not yet guaranteed by Stwo, use at your own risk
131-
Saving proof to: target/execute/hello/execution1/proof/proof.json
132-
"#});
133-
134-
t.child("target/execute/hello/execution1/proof/proof.json")
135-
.assert(predicates::path::exists());
136-
}
137-
13885
#[test]
13986
#[cfg(windows)]
14087
fn prove_fails_on_windows() {
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
use assert_fs::TempDir;
2+
use assert_fs::assert::PathAssert;
3+
use assert_fs::prelude::PathChild;
4+
use indoc::indoc;
5+
use scarb_test_support::command::Scarb;
6+
use scarb_test_support::project_builder::ProjectBuilder;
7+
8+
fn build_executable_project() -> TempDir {
9+
let t = TempDir::new().unwrap();
10+
ProjectBuilder::start()
11+
.name("hello")
12+
.version("0.1.0")
13+
.dep_cairo_execute()
14+
.manifest_extra(indoc! {r#"
15+
[executable]
16+
17+
[cairo]
18+
enable-gas = false
19+
"#})
20+
.lib_cairo(indoc! {r#"
21+
#[executable]
22+
fn main() -> felt252 {
23+
42
24+
}
25+
"#})
26+
.build(&t);
27+
t
28+
}
29+
30+
#[test]
31+
#[cfg(not(windows))]
32+
fn prove_with_execute() {
33+
let t = build_executable_project();
34+
35+
Scarb::quick_command()
36+
.arg("prove")
37+
.arg("--execute")
38+
.current_dir(&t)
39+
.assert()
40+
.success()
41+
.stdout_eq(indoc! {r#"
42+
[..]Compiling hello v0.1.0 ([..])
43+
[..]Finished `dev` profile target(s) in [..]
44+
[..]Executing hello
45+
Saving output to: target/execute/hello/execution1
46+
[..]Proving hello
47+
warn: soundness of proof is not yet guaranteed by Stwo, use at your own risk
48+
Saving proof to: target/execute/hello/execution1/proof/proof.json
49+
"#});
50+
51+
t.child("target/execute/hello/execution1/proof/proof.json")
52+
.assert(predicates::path::exists());
53+
}
54+
55+
#[test]
56+
#[cfg(not(windows))]
57+
fn prove_from_execution_output() {
58+
let t = build_executable_project();
59+
60+
Scarb::quick_command()
61+
.arg("execute")
62+
.arg("--target=bootloader")
63+
.current_dir(&t)
64+
.assert()
65+
.success();
66+
67+
Scarb::quick_command()
68+
.arg("prove")
69+
.arg("--execution-id=1")
70+
.current_dir(&t)
71+
.assert()
72+
.success()
73+
.stdout_eq(indoc! {r#"
74+
[..]Proving hello
75+
warn: soundness of proof is not yet guaranteed by Stwo, use at your own risk
76+
Saving proof to: target/execute/hello/execution1/proof/proof.json
77+
"#});
78+
79+
t.child("target/execute/hello/execution1/proof/proof.json")
80+
.assert(predicates::path::exists());
81+
}

extensions/scarb-verify/tests/build.rs

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -25,57 +25,6 @@ fn build_executable_project() -> TempDir {
2525
t
2626
}
2727

28-
// Disabled due to `scarb prove` not being supported on Windows
29-
#[cfg(not(windows))]
30-
#[test]
31-
fn verify_from_execution_output() {
32-
let t = build_executable_project();
33-
34-
Scarb::quick_command()
35-
.arg("prove")
36-
.arg("--execute")
37-
.current_dir(&t)
38-
.assert()
39-
.success();
40-
41-
Scarb::quick_command()
42-
.arg("verify")
43-
.arg("--execution-id=1")
44-
.current_dir(&t)
45-
.assert()
46-
.success()
47-
.stdout_eq(indoc! {r#"
48-
[..]Verifying hello
49-
[..]Verified proof successfully
50-
"#});
51-
}
52-
53-
// Disabled due to `scarb prove` not being supported on Windows
54-
#[cfg(not(windows))]
55-
#[test]
56-
fn verify_from_path() {
57-
let t = build_executable_project();
58-
59-
Scarb::quick_command()
60-
.arg("prove")
61-
.arg("--execute")
62-
.current_dir(&t)
63-
.assert()
64-
.success();
65-
66-
let proof_path = t.join("target/execute/hello/execution1/proof/proof.json");
67-
Scarb::quick_command()
68-
.arg("verify")
69-
.arg("--proof-file")
70-
.arg(proof_path)
71-
.assert()
72-
.success()
73-
.stdout_eq(indoc! {r#"
74-
[..]Verifying proof
75-
[..]Verified proof successfully
76-
"#});
77-
}
78-
7928
#[test]
8029
fn verify_fails_when_execution_output_not_found() {
8130
let t = build_executable_project();
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
use assert_fs::TempDir;
2+
use indoc::indoc;
3+
use scarb_test_support::command::Scarb;
4+
use scarb_test_support::project_builder::ProjectBuilder;
5+
6+
fn build_executable_project() -> TempDir {
7+
let t = TempDir::new().unwrap();
8+
ProjectBuilder::start()
9+
.name("hello")
10+
.version("0.1.0")
11+
.dep_cairo_execute()
12+
.manifest_extra(indoc! {r#"
13+
[executable]
14+
15+
[cairo]
16+
enable-gas = false
17+
"#})
18+
.lib_cairo(indoc! {r#"
19+
#[executable]
20+
fn main() -> felt252 {
21+
42
22+
}
23+
"#})
24+
.build(&t);
25+
t
26+
}
27+
28+
// Disabled due to `scarb prove` not being supported on Windows
29+
#[cfg(not(windows))]
30+
#[test]
31+
fn verify_from_execution_output() {
32+
let t = build_executable_project();
33+
34+
Scarb::quick_command()
35+
.arg("prove")
36+
.arg("--execute")
37+
.current_dir(&t)
38+
.assert()
39+
.success();
40+
41+
Scarb::quick_command()
42+
.arg("verify")
43+
.arg("--execution-id=1")
44+
.current_dir(&t)
45+
.assert()
46+
.success()
47+
.stdout_eq(indoc! {r#"
48+
[..]Verifying hello
49+
[..]Verified proof successfully
50+
"#});
51+
}
52+
53+
// Disabled due to `scarb prove` not being supported on Windows
54+
#[cfg(not(windows))]
55+
#[test]
56+
fn verify_from_path() {
57+
let t = build_executable_project();
58+
59+
Scarb::quick_command()
60+
.arg("prove")
61+
.arg("--execute")
62+
.current_dir(&t)
63+
.assert()
64+
.success();
65+
66+
let proof_path = t.join("target/execute/hello/execution1/proof/proof.json");
67+
Scarb::quick_command()
68+
.arg("verify")
69+
.arg("--proof-file")
70+
.arg(proof_path)
71+
.assert()
72+
.success()
73+
.stdout_eq(indoc! {r#"
74+
[..]Verifying proof
75+
[..]Verified proof successfully
76+
"#});
77+
}

0 commit comments

Comments
 (0)