@@ -26,6 +26,7 @@ use std::{
26
26
fs,
27
27
path:: { Path , PathBuf } ,
28
28
str:: FromStr ,
29
+ thread,
29
30
} ;
30
31
31
32
// tests all config values that are in use
@@ -1881,41 +1882,29 @@ forgetest_init!(test_exclude_lints_config, |prj, cmd| {
1881
1882
1882
1883
// <https://github.com/foundry-rs/foundry/issues/6529>
1883
1884
forgetest_init ! ( test_fail_fast_config, |prj, cmd| {
1885
+ // Skip if we don't have at least 2 CPUs to run both tests in parallel.
1886
+ if thread:: available_parallelism( ) . map_or( 1 , |n| n. get( ) ) < 2 {
1887
+ return ;
1888
+ }
1889
+
1890
+ prj. wipe_contracts( ) ;
1884
1891
prj. update_config( |config| {
1885
1892
// Set large timeout for fuzzed tests so test campaign won't stop if fail fast not passed.
1886
1893
config. fuzz. timeout = Some ( 3600 ) ;
1887
- config. invariant. timeout = Some ( 3600 ) ;
1888
1894
} ) ;
1889
1895
prj. add_test(
1890
1896
"AnotherCounterTest.sol" ,
1891
1897
r#"
1892
1898
import {Test} from "forge-std/Test.sol";
1893
1899
1894
- contract InvariantHandler is Test {
1895
- function fuzz_selector(uint256 x) public {
1896
- }
1897
- }
1898
-
1899
1900
contract AnotherCounterTest is Test {
1900
- uint256[] public fixtureAmount = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
1901
-
1902
- function setUp() public {
1903
- new InvariantHandler();
1904
- }
1905
1901
// This failure should stop all other tests.
1906
1902
function test_Failure() public pure {
1907
1903
require(false);
1908
1904
}
1909
1905
1910
1906
function testFuzz_SetNumber(uint256 x) public {
1911
1907
}
1912
-
1913
- function invariant_SetNumber() public {
1914
- }
1915
-
1916
- function table_SetNumber(uint256 amount) public {
1917
- require(amount < 100);
1918
- }
1919
1908
}
1920
1909
"# ,
1921
1910
)
0 commit comments