Fixes failing test and python version

pull/242/head
Josh Asplund 7 years ago
parent d632798abb
commit 11a2bb7430
  1. 35
      .circleci/config.yml
  2. 3
      .coveragerc
  3. 9
      tests/analysis/test_delegatecall.py
  4. 23
      tox.ini

@ -15,13 +15,22 @@ jobs:
# path param in checkout command, and this symlink compenstates for that. # path param in checkout command, and this symlink compenstates for that.
# - run: ln -s /root/project /home/mythril # - run: ln -s /root/project /home/mythril
- restore-cache:
keys:
- tox-env-{{ checksum "/home/mythril/tox.ini" }}-{{ checksum "/home/mythril/setup.py" }}
- run: - run:
name: Installing mythril tools name: Installing mythril tools
command: cd /home && ./install-mythril-tools.sh laser-ethereum command: ./install-mythril-tools.sh laser-ethereum
working_directory: /home
- run: - run:
name: Install dependencies, in case any are missing in Docker image name: Install tox envs
command: pip3 install -r /home/mythril/requirements.txt command: tox -vv --notest
working_directory: /home/mythril
environment:
LC_ALL: C.UTF-8
LANG: C.UTF-8
- run: - run:
background: true background: true
@ -30,7 +39,8 @@ jobs:
- run: - run:
name: Unit-testing name: Unit-testing
command: cd /home/mythril && tox command: tox
working_directory: /home/mythril
environment: environment:
LC_ALL: C.UTF-8 LC_ALL: C.UTF-8
LANG: C.UTF-8 LANG: C.UTF-8
@ -41,9 +51,15 @@ jobs:
- store_artifacts: - store_artifacts:
path: /home/mythril/.tox/output path: /home/mythril/.tox/output
- save_cache:
key: tox-env-{{ checksum "/home/mythril/tox.ini" }}-{{ checksum "/home/mythril/setup.py" }}
paths:
- .tox/py*
- run: - run:
name: Ensuring that setup script is functional name: Ensuring that setup script is functional
command: cd /home/mythril && python3 setup.py install command: python3 setup.py install
working_directory: /home/mythril
- run: - run:
name: Integration tests name: Integration tests
@ -56,13 +72,16 @@ jobs:
path: /home/mythril path: /home/mythril
- run: - run:
name: Verify Git tag vs. version name: Verify Git tag vs. version
command: cd /home/mythril && python3 setup.py verify command: python3 setup.py verify
working_directory: /home/mythril
- run: - run:
name: Build name: Build
command: cd /home/mythril && python3 setup.py sdist command: python3 setup.py sdist
working_directory: /home/mythril
- run: - run:
name: Deploy name: Deploy
command: cd /home/mythril && twine upload dist/* command: twine upload dist/*
working_directory: /home/mythril
workflows: workflows:
version: 2 version: 2

@ -8,6 +8,3 @@ omit =
/usr/* /usr/*
*_test.py *_test.py
setup.py setup.py
[html]
directory = coverage_html_report

@ -3,8 +3,7 @@ from mythril.analysis.ops import Call, Variable, VarType
from mythril.analysis.symbolic import SymExecWrapper from mythril.analysis.symbolic import SymExecWrapper
from laser.ethereum.svm import GlobalState, Node, Environment, Account from laser.ethereum.svm import GlobalState, Node, Environment, Account
import pytest import pytest
import mock from unittest.mock import MagicMock, patch
from mock import patch
import pytest_mock import pytest_mock
@ -185,7 +184,7 @@ def test_delegate_call(sym_mock, concrete_mock, curr_instruction):
to = Variable("storage_1", VarType.SYMBOLIC) to = Variable("storage_1", VarType.SYMBOLIC)
call = Call(node, state, None, "DELEGATECALL", to, None) call = Call(node, state, None, "DELEGATECALL", to, None)
statespace = mock.MagicMock() statespace = MagicMock()
statespace.calls = [call] statespace.calls = [call]
# act # act
@ -211,7 +210,7 @@ def test_delegate_call_not_delegate(sym_mock, concrete_mock):
to = Variable("storage_1", VarType.SYMBOLIC) to = Variable("storage_1", VarType.SYMBOLIC)
call = Call(node, None, None, "NOT_DELEGATECALL", to, None) call = Call(node, None, None, "NOT_DELEGATECALL", to, None)
statespace = mock.MagicMock() statespace = MagicMock()
statespace.calls = [call] statespace.calls = [call]
# act # act
@ -238,7 +237,7 @@ def test_delegate_call_not_fallback(sym_mock, concrete_mock):
to = Variable("storage_1", VarType.SYMBOLIC) to = Variable("storage_1", VarType.SYMBOLIC)
call = Call(node, None, None, "DELEGATECALL", to, None) call = Call(node, None, None, "DELEGATECALL", to, None)
statespace = mock.MagicMock() statespace = MagicMock()
statespace.calls = [call] statespace.calls = [call]
# act # act

@ -1,10 +1,27 @@
[tox] [tox]
envlist = py34,py35,py36 envlist = py35,py36
[testenv] [testenv]
deps=pipenv deps=pipenv
whitelist_externals = mkdir whitelist_externals = mkdir
commands= commands=
pipenv install --dev --ignore-pipfile pipenv install --dev --ignore-pipfile
mkdir -p {toxworkdir}/log/{envname} mkdir -p {toxinidir}/tests/testdata/outputs_current/
pipenv run py.test --junitxml={toxworkdir}/output/pytest/junit-{envname}.xml {posargs} py.test \
--junitxml={toxworkdir}/output/junit-{envname}.xml \
{posargs}
[testenv:coverage]
setenv =
COVERAGE_FILE = .coveragerc
deps = pytest-cov
whitelist_externals = mkdir
commands=
pipenv install --dev --ignore-pipfile
mkdir -p {toxinidir}/tests/testdata/outputs_current/
py.test \
--cov=mythril \
--cov-report=xml:{toxworkdir}/output/cov-{envname}.xml \
--cov-report=html:{toxworkdir}/output/cov-{envname}.html \
--junitxml={toxworkdir}/output/junit-{envname}.xml \
{posargs}

Loading…
Cancel
Save