From 435003419455bd153162d8f4b3825e4afd8a2737 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Sat, 24 Feb 2024 03:33:01 +0100 Subject: [PATCH] test: move forge-std test to external tests --- .github/scripts/matrices.py | 6 ----- crates/config/src/lib.rs | 6 ++--- crates/forge/tests/cli/ext_integration.rs | 8 +++++++ crates/forge/tests/cli/test_cmd.rs | 27 +---------------------- 4 files changed, 11 insertions(+), 36 deletions(-) diff --git a/.github/scripts/matrices.py b/.github/scripts/matrices.py index 0a47c96a2195..3fdcea115421 100755 --- a/.github/scripts/matrices.py +++ b/.github/scripts/matrices.py @@ -92,12 +92,6 @@ def __init__( n_partitions=2, pr_cross_platform=False, ), - Case( - name="integration / forge-std", - filter="package(=forge) & test(~forge_std)", - n_partitions=1, - pr_cross_platform=False, - ), Case( name="integration / external", filter="package(=forge) & test(~ext_integration)", diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index 3c7cc1d5e376..0a706060e52f 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -352,10 +352,8 @@ pub struct Config { /// included in solc's output selection, see also /// [OutputSelection](foundry_compilers::artifacts::output_selection::OutputSelection) pub sparse_mode: bool, - /// Whether to emit additional build info files - /// - /// If set to `true`, `ethers-solc` will generate additional build info json files for every - /// new build, containing the `CompilerInput` and `CompilerOutput` + /// Generates additional build info json files for every new build, containing the + /// `CompilerInput` and `CompilerOutput`. pub build_info: bool, /// The path to the `build-info` directory that contains the build info json files. pub build_info_path: Option, diff --git a/crates/forge/tests/cli/ext_integration.rs b/crates/forge/tests/cli/ext_integration.rs index 76c497837be3..3483708f2c37 100644 --- a/crates/forge/tests/cli/ext_integration.rs +++ b/crates/forge/tests/cli/ext_integration.rs @@ -1,5 +1,13 @@ use foundry_test_utils::util::ExtTester; +#[test] +fn forge_std() { + ExtTester::new("foundry-rs", "forge-std", "1d0766bc5d814f117c7b1e643828f7d85024fb51") + // Skip fork tests. + .args(["--nmc", "Fork"]) + .run(); +} + #[test] fn solmate() { ExtTester::new("transmissions11", "solmate", "c892309933b25c03d32b1b0d674df7ae292ba925").run(); diff --git a/crates/forge/tests/cli/test_cmd.rs b/crates/forge/tests/cli/test_cmd.rs index 25a30a1fd040..58b9b1eb85de 100644 --- a/crates/forge/tests/cli/test_cmd.rs +++ b/crates/forge/tests/cli/test_cmd.rs @@ -2,7 +2,7 @@ use foundry_common::rpc; use foundry_config::Config; use foundry_test_utils::util::{OutputExt, OTHER_SOLC_VERSION, SOLC_VERSION}; -use std::{path::PathBuf, process::Command, str::FromStr}; +use std::{path::PathBuf, str::FromStr}; // tests that test filters are handled correctly forgetest!(can_set_filter_values, |prj, cmd| { @@ -259,31 +259,6 @@ contract ContractTest is DSTest { ); }); -// checks that we can test forge std successfully -// `forgetest_init!` will install with `forge-std` under `lib/forge-std` -forgetest_init!( - #[serial_test::serial] - can_test_forge_std, - |prj, cmd| { - let forge_std_dir = prj.root().join("lib/forge-std"); - let status = Command::new("git") - .current_dir(&forge_std_dir) - .args(["pull", "origin", "master"]) - .status() - .unwrap(); - if !status.success() { - panic!("failed to update forge-std"); - } - - // execute in subdir - cmd.cmd().current_dir(forge_std_dir); - cmd.args(["test", "--root", "."]); - let stdout = cmd.stdout_lossy(); - assert!(stdout.contains("[PASS]"), "No tests passed:\n{stdout}"); - assert!(!stdout.contains("[FAIL]"), "Tests failed:\n{stdout}"); - } -); - // tests that libraries are handled correctly in multiforking mode forgetest_init!(can_use_libs_in_multi_fork, |prj, cmd| { prj.wipe_contracts();