Merge branch 'proper-xfail-skip' into testing-strategy

pull/1782/head
alpharush 2 years ago
commit 227d0a96c5
  1. 6
      tests/test_features.py
  2. 25
      tests/test_ssa_generation.py

@ -1,5 +1,7 @@
import inspect import inspect
import shutil
from pathlib import Path from pathlib import Path
import pytest
from crytic_compile import CryticCompile from crytic_compile import CryticCompile
from crytic_compile.platform.solc_standard_json import SolcStandardJson from crytic_compile.platform.solc_standard_json import SolcStandardJson
@ -23,6 +25,10 @@ def _run_all_detectors(slither: Slither) -> None:
slither.run_detectors() slither.run_detectors()
hardhat_available = shutil.which("hardhat") is not None
@pytest.mark.skipif(not hardhat_available, reason="requires Hardhat and project setup")
def test_node() -> None: def test_node() -> None:
# hardhat must have been installed in tests/test_node_modules # hardhat must have been installed in tests/test_node_modules
# For the CI its done through the github action config # For the CI its done through the github action config

@ -375,7 +375,7 @@ def test_basic_loop_phi():
verify_properties_hold(contract) verify_properties_hold(contract)
@pytest.mark.skip(reason="Fails in current slither version. Fix in #1102.") @pytest.mark.xfail(strict=True, reason="Fails in current slither version. Fix in #1102.")
def test_phi_propagation_loop(): def test_phi_propagation_loop():
contract = """ contract = """
pragma solidity ^0.8.11; pragma solidity ^0.8.11;
@ -396,7 +396,7 @@ def test_phi_propagation_loop():
verify_properties_hold(contract) verify_properties_hold(contract)
@pytest.mark.skip(reason="Fails in current slither version. Fix in #1102.") @pytest.mark.xfail(strict=True, reason="Fails in current slither version. Fix in #1102.")
def test_free_function_properties(): def test_free_function_properties():
contract = """ contract = """
pragma solidity ^0.8.11; pragma solidity ^0.8.11;
@ -460,7 +460,7 @@ def test_ssa_inter_transactional():
assert assign2.lvalue in phi.rvalues assert assign2.lvalue in phi.rvalues
@pytest.mark.skip(reason="Fails in current slither version. Fix in #1102.") @pytest.mark.xfail(strict=True, reason="Fails in current slither version. Fix in #1102.")
def test_ssa_phi_callbacks(): def test_ssa_phi_callbacks():
source = """ source = """
pragma solidity ^0.8.11; pragma solidity ^0.8.11;
@ -519,7 +519,7 @@ def test_ssa_phi_callbacks():
assert len(after_call_phi.rvalues) == 2 assert len(after_call_phi.rvalues) == 2
@pytest.mark.skip(reason="Fails in current slither version. Fix in #1102.") @pytest.mark.xfail(strict=True, reason="Fails in current slither version. Fix in #1102.")
def test_storage_refers_to(): def test_storage_refers_to():
"""Test the storage aspects of the SSA IR """Test the storage aspects of the SSA IR
@ -586,7 +586,6 @@ def test_storage_refers_to():
assert phinodes[1].lvalue in entryphi[0].rvalues or entryphi[1].rvalues assert phinodes[1].lvalue in entryphi[0].rvalues or entryphi[1].rvalues
@pytest.mark.skip(reason="Fails in current slither version. Fix in #1102.")
@pytest.mark.skipif( @pytest.mark.skipif(
not valid_version("0.4.0"), reason="Solidity version 0.4.0 not available on this platform" not valid_version("0.4.0"), reason="Solidity version 0.4.0 not available on this platform"
) )
@ -623,7 +622,7 @@ def test_initial_version_exists_for_locals():
assert a_0.non_ssa_version == a_1.non_ssa_version assert a_0.non_ssa_version == a_1.non_ssa_version
@pytest.mark.skip(reason="Fails in current slither version. Fix in #1102.") @pytest.mark.xfail(strict=True, reason="Fails in current slither version. Fix in #1102.")
@pytest.mark.skipif( @pytest.mark.skipif(
not valid_version("0.4.0"), reason="Solidity version 0.4.0 not available on this platform" not valid_version("0.4.0"), reason="Solidity version 0.4.0 not available on this platform"
) )
@ -663,7 +662,7 @@ def test_initial_version_exists_for_state_variables():
assert len(get_ssa_of_type(f, Phi)) == 0 assert len(get_ssa_of_type(f, Phi)) == 0
@pytest.mark.skip(reason="Fails in current slither version. Fix in #1102.") @pytest.mark.xfail(strict=True, reason="Fails in current slither version. Fix in #1102.")
def test_initial_version_exists_for_state_variables_function_assign(): def test_initial_version_exists_for_state_variables_function_assign():
""" """
In solidity you can write statements such as In solidity you can write statements such as
@ -760,7 +759,7 @@ def test_shadow_local():
assert all(map(lambda x: x.lvalue.index == 1, get_ssa_of_type(f, Assignment))) assert all(map(lambda x: x.lvalue.index == 1, get_ssa_of_type(f, Assignment)))
@pytest.mark.skip(reason="Fails in current slither version. Fix in #1102.") @pytest.mark.xfail(strict=True, reason="Fails in current slither version. Fix in #1102.")
def test_multiple_named_args_returns(): def test_multiple_named_args_returns():
"""Verifies that named arguments and return values have correct versions """Verifies that named arguments and return values have correct versions
@ -789,7 +788,7 @@ def test_multiple_named_args_returns():
) )
@pytest.mark.xfail(reason="Tests for wanted state of SSA IR, not current.") @pytest.mark.xfail(reason="Tests for wanted state of SSA IR, not current.", strict=True)
def test_memory_array(): def test_memory_array():
src = """ src = """
contract MemArray { contract MemArray {
@ -855,7 +854,7 @@ def test_memory_array():
assert len(phi_entry_b.rvalues) == len(b_args) + 1 assert len(phi_entry_b.rvalues) == len(b_args) + 1
@pytest.mark.xfail(reason="Tests for wanted state of SSA IR, not current.") @pytest.mark.xfail(reason="Tests for wanted state of SSA IR, not current.", strict=True)
def test_storage_array(): def test_storage_array():
src = """ src = """
contract StorageArray { contract StorageArray {
@ -910,7 +909,7 @@ def test_storage_array():
assert len(phi_entry_b.rvalues) == 3 # See comment in b above assert len(phi_entry_b.rvalues) == 3 # See comment in b above
@pytest.mark.skip(reason="Fails in current slither version. Fix in #1102.") @pytest.mark.xfail(strict=True, reason="Fails in current slither version. Fix in #1102.")
def test_issue_468(): def test_issue_468():
""" """
Ensure issue 468 is corrected as per Ensure issue 468 is corrected as per
@ -964,7 +963,7 @@ def test_issue_468():
assert phi_endif.lvalue in phi_entry.rvalues assert phi_endif.lvalue in phi_entry.rvalues
@pytest.mark.skip(reason="Fails in current slither version. Fix in #1102.") @pytest.mark.xfail(strict=True, reason="Fails in current slither version. Fix in #1102.")
def test_issue_434(): def test_issue_434():
source = """ source = """
contract Contract { contract Contract {
@ -1018,7 +1017,7 @@ def test_issue_434():
assert aftercall_phi.lvalue in (add_f.variable_left, add_f.variable_right) assert aftercall_phi.lvalue in (add_f.variable_left, add_f.variable_right)
@pytest.mark.skip(reason="Fails in current slither version. Fix in #1102.") @pytest.mark.xfail(strict=True, reason="Fails in current slither version. Fix in #1102.")
def test_issue_473(): def test_issue_473():
source = """ source = """
contract Contract { contract Contract {

Loading…
Cancel
Save