Skip to content

Commit

Permalink
chore(tests): fix isolate CI + all targets / features tests (foundry-…
Browse files Browse the repository at this point in the history
…rs#8871)

chore(tests): fix all targets / features tests
  • Loading branch information
grandizzy authored Sep 16, 2024
1 parent f141a43 commit 011dd09
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 34 deletions.
6 changes: 5 additions & 1 deletion crates/forge/tests/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ forgetest!(can_set_gas_price, |prj, cmd| {

// test that we can detect remappings from foundry.toml
forgetest_init!(can_detect_lib_foundry_toml, |prj, cmd| {
std::env::remove_var("DAPP_REMAPPINGS");
let config = cmd.config();
let remappings = config.remappings.iter().cloned().map(Remapping::from).collect::<Vec<_>>();
similar_asserts::assert_eq!(
Expand Down Expand Up @@ -545,6 +546,7 @@ forgetest_init!(can_detect_lib_foundry_toml, |prj, cmd| {
let toml_file = nested.join("foundry.toml");
pretty_err(&toml_file, fs::write(&toml_file, config.to_string_pretty().unwrap()));

std::env::remove_var("DAPP_REMAPPINGS");
let another_config = cmd.config();
let remappings =
another_config.remappings.iter().cloned().map(Remapping::from).collect::<Vec<_>>();
Expand All @@ -564,6 +566,7 @@ forgetest_init!(can_detect_lib_foundry_toml, |prj, cmd| {

config.src = "custom-source-dir".into();
pretty_err(&toml_file, fs::write(&toml_file, config.to_string_pretty().unwrap()));
std::env::remove_var("DAPP_REMAPPINGS");
let config = cmd.config();
let remappings = config.remappings.iter().cloned().map(Remapping::from).collect::<Vec<_>>();
similar_asserts::assert_eq!(
Expand Down Expand Up @@ -689,7 +692,8 @@ forgetest_init!(can_parse_default_fs_permissions, |_prj, cmd| {
let config = cmd.config();

assert_eq!(config.fs_permissions.len(), 1);
let out_permission = config.fs_permissions.find_permission(Path::new("out")).unwrap();
let permissions = config.fs_permissions.joined(Path::new("test"));
let out_permission = permissions.find_permission(Path::new("test/out")).unwrap();
assert_eq!(FsAccessPermission::Read, out_permission);
});

Expand Down
2 changes: 1 addition & 1 deletion crates/forge/tests/cli/ext_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fn lil_web3() {
#[test]
#[cfg_attr(windows, ignore = "Windows cannot find installed programs")]
fn snekmate() {
ExtTester::new("pcaversaccio", "snekmate", "316088761ca7605216b5bfbbecca8d694c61ed98")
ExtTester::new("pcaversaccio", "snekmate", "df226f4a45e86c8f8c3ff1f9fa3443d260002050")
.install_command(&["pnpm", "install", "--prefer-offline"])
// Try npm if pnpm fails / is not installed.
.install_command(&["npm", "install", "--prefer-offline"])
Expand Down
50 changes: 25 additions & 25 deletions crates/forge/tests/cli/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,12 @@ contract DeployScript is Script {
[SOLC_VERSION] [ELAPSED]
Compiler run successful!
Traces:
[81034] DeployScript::run()
[..] DeployScript::run()
├─ [0] VM::startBroadcast()
│ └─ ← [Return]
├─ [45299] → new GasWaster@[..]
├─ [..] → new GasWaster@[..]
│ └─ ← [Return] 226 bytes of code
├─ [226] GasWaster::wasteGas(200000 [2e5])
├─ [..] GasWaster::wasteGas(200000 [2e5])
│ └─ ← [Stop]
└─ ← [Stop]
Expand Down Expand Up @@ -330,12 +330,12 @@ Warning (2018): Function state mutability can be restricted to view
| ^ (Relevant source part starts here and spans across multiple lines).
Traces:
[81034] DeployScript::run()
[..] DeployScript::run()
├─ [0] VM::startBroadcast()
│ └─ ← [Return]
├─ [45299] → new GasWaster@[..]
├─ [..] → new GasWaster@[..]
│ └─ ← [Return] 226 bytes of code
├─ [226] GasWaster::wasteGas(200000 [2e5])
├─ [..] GasWaster::wasteGas(200000 [2e5])
│ └─ ← [Stop]
└─ ← [Stop]
Expand Down Expand Up @@ -515,10 +515,10 @@ contract DeployScript is Script {
[SOLC_VERSION] [ELAPSED]
Compiler run successful!
Traces:
[116040] DeployScript::run()
[..] DeployScript::run()
├─ [0] VM::startBroadcast()
│ └─ ← [Return]
├─ [75723] → new HashChecker@[..]
├─ [..] → new HashChecker@[..]
│ └─ ← [Return] 378 bytes of code
└─ ← [Stop]
Expand Down Expand Up @@ -595,58 +595,58 @@ contract RunScript is Script {
[SOLC_VERSION] [ELAPSED]
Compiler run successful!
Traces:
[51327] RunScript::run()
[..] RunScript::run()
├─ [0] VM::startBroadcast()
│ └─ ← [Return]
├─ [0] VM::roll([..])
│ └─ ← [Return]
├─ [0] VM::roll([..])
│ └─ ← [Return]
├─ [22394] [..]::update()
├─ [..] [..]::update()
│ └─ ← [Stop]
├─ [239] [..]::checkLastHash() [staticcall]
├─ [..] [..]::checkLastHash() [staticcall]
│ └─ ← [Stop]
├─ [0] VM::roll([..])
│ └─ ← [Return]
├─ [494] [..]::update()
├─ [..] [..]::update()
│ └─ ← [Stop]
├─ [239] [..]::checkLastHash() [staticcall]
├─ [..] [..]::checkLastHash() [staticcall]
│ └─ ← [Stop]
├─ [0] VM::roll([..])
│ └─ ← [Return]
├─ [494] [..]::update()
├─ [..] [..]::update()
│ └─ ← [Stop]
├─ [239] [..]::checkLastHash() [staticcall]
├─ [..] [..]::checkLastHash() [staticcall]
│ └─ ← [Stop]
├─ [0] VM::roll([..])
│ └─ ← [Return]
├─ [494] [..]::update()
├─ [..] [..]::update()
│ └─ ← [Stop]
├─ [239] [..]::checkLastHash() [staticcall]
├─ [..] [..]::checkLastHash() [staticcall]
│ └─ ← [Stop]
├─ [0] VM::roll([..])
│ └─ ← [Return]
├─ [494] [..]::update()
├─ [..] [..]::update()
│ └─ ← [Stop]
├─ [239] [..]::checkLastHash() [staticcall]
├─ [..] [..]::checkLastHash() [staticcall]
│ └─ ← [Stop]
├─ [0] VM::roll([..])
│ └─ ← [Return]
├─ [494] [..]::update()
├─ [..] [..]::update()
│ └─ ← [Stop]
├─ [239] [..]::checkLastHash() [staticcall]
├─ [..] [..]::checkLastHash() [staticcall]
│ └─ ← [Stop]
├─ [0] VM::roll([..])
│ └─ ← [Return]
├─ [494] [..]::update()
├─ [..] [..]::update()
│ └─ ← [Stop]
├─ [239] [..]::checkLastHash() [staticcall]
├─ [..] [..]::checkLastHash() [staticcall]
│ └─ ← [Stop]
├─ [0] VM::roll([..])
│ └─ ← [Return]
├─ [494] [..]::update()
├─ [..] [..]::update()
│ └─ ← [Stop]
├─ [239] [..]::checkLastHash() [staticcall]
├─ [..] [..]::checkLastHash() [staticcall]
│ └─ ← [Stop]
└─ ← [Stop]
Expand Down
21 changes: 14 additions & 7 deletions crates/forge/tests/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1453,10 +1453,17 @@ contract ATest is Test {
)
.unwrap();

cmd.args(["test"]).with_no_redact().assert_success().stdout_eq(str![[r#"
...
[PASS] testSelfMeteringRevert() (gas: 3299)
...
cmd.args(["test"]).assert_success().stdout_eq(str![[r#"
[COMPILING_FILES] with [SOLC_VERSION]
[SOLC_VERSION] [ELAPSED]
Compiler run successful!
Ran 1 test for test/ATest.t.sol:ATest
[PASS] testSelfMeteringRevert() ([GAS])
Suite result: ok. 1 passed; 0 failed; 0 skipped; [ELAPSED]
Ran 1 test suite [ELAPSED]: 1 tests passed, 0 failed, 0 skipped (1 total tests)
"#]]);
});

Expand Down Expand Up @@ -1732,12 +1739,12 @@ contract ATest is DSTest {
[PASS] testResetGas() (gas: 40)
[PASS] testResetGas1() (gas: 40)
[PASS] testResetGas2() (gas: 40)
[PASS] testResetGas3() (gas: 134476)
[PASS] testResetGas4() (gas: 56302)
[PASS] testResetGas3() (gas: [..])
[PASS] testResetGas4() (gas: [..])
[PASS] testResetGas5() (gas: 40)
[PASS] testResetGas6() (gas: 40)
[PASS] testResetGas7() (gas: 49)
[PASS] testResetGas8() (gas: 622)
[PASS] testResetGas8() (gas: [..])
[PASS] testResetGas9() (gas: 40)
[PASS] testResetNegativeGas() (gas: 0)
...
Expand Down

0 comments on commit 011dd09

Please sign in to comment.