-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* master: (43 commits) Syscall specific hooks (#2389) TUI Support Infrastructure (#1620) Fix coveralls upload (#2387) docs: fix simple typo, straigth -> straight (#2381) Attempt to allow symbolic balances from the start (#1818) Fix state.cpu.PC member (#1825) Bump black and mypy (#1824) Manticore 0.3.5 (#1808) Fix yices timeout argument (#1817) Detect default solver (#1820) Ignore Gas Calculations by Default (#1816) native/cpu/x86: Add support for CPUID EAX=80000000h (#1811) Change types.FunctionType=<class 'function'> (#1803) Fix test regressions (#1804) State Introspection API (#1775) Fix EVM account existence checks for selfdestruct and call (#1801) Add partial implementation of sendto syscall (#1791) crytic-compile: use latest release (#1795) Update gas metering for calls to empty accounts (#1774) Fix BitVec with symbolic offset and fix TranslatorSmtlib.unique thread safety (#1792) ...
- Loading branch information
Showing
95 changed files
with
20,467 additions
and
15,757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,13 @@ jobs: | |
git fetch --depth=1 origin $BASE_SHA | ||
echo "Files Changed:" | ||
git diff --name-only $BASE_SHA... | tee .diff_names.txt | ||
cat .diff_names.txt | python scripts/pyfile_exists.py | xargs black --diff --check | ||
NAMES=$(cat .diff_names.txt | python scripts/pyfile_exists.py) | ||
if test -z $NAMES | ||
then | ||
black --diff --check . | ||
else | ||
echo $NAMES | xargs black --diff --check | ||
fi | ||
mypy --version | ||
mypy | ||
tests: | ||
|
@@ -61,187 +67,45 @@ jobs: | |
# Install solc unconditionally because it only takes a second or two | ||
sudo wget -O /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.4.24/solc-static-linux | ||
sudo chmod +x /usr/bin/solc | ||
pip install coveralls | ||
pip install -e ".[dev-noks]" | ||
- name: Run Tests | ||
env: | ||
TEST_TYPE: ${{ matrix.type }} | ||
run: | | ||
# Launches all examples; this assumes PWD is examples/script | ||
launch_examples() { | ||
COVERAGE_RCFILE=$GITHUB_WORKSPACE/.coveragerc | ||
# concolic assumes presence of ../linux/simpleassert | ||
echo "Running concolic.py..." | ||
HW=../linux/helloworld | ||
coverage run ./concolic.py | ||
if [ $? -ne 0 ]; then | ||
return 1 | ||
fi | ||
echo "Running count_instructions.py..." | ||
coverage run ./count_instructions.py $HW |grep -q Executed | ||
if [ $? -ne 0 ]; then | ||
return 1 | ||
fi | ||
echo "Running introduce_symbolic_bytes.py..." | ||
gcc -static -g src/state_explore.c -o state_explore | ||
ADDRESS=0x$(objdump -S state_explore | grep -A 1 '((value & 0xff) != 0)' | | ||
tail -n 1 | sed 's|^\s*||g' | cut -f1 -d:) | ||
coverage run ./introduce_symbolic_bytes.py state_explore $ADDRESS | ||
if [ $? -ne 0 ]; then | ||
return 1 | ||
fi | ||
echo "Running run_simple.py..." | ||
gcc -x c -static -o hello test_run_simple.c | ||
coverage run ./run_simple.py hello | ||
if [ $? -ne 0 ]; then | ||
return 1 | ||
fi | ||
echo "Running run_hook.py..." | ||
MAIN_ADDR=$(nm $HW|grep 'T main' | awk '{print "0x"$1}') | ||
coverage run ./run_hook.py $HW $MAIN_ADDR | ||
if [ $? -ne 0 ]; then | ||
return 1 | ||
fi | ||
echo "Running state_control.py..." | ||
# Straight from the header of state_control.py | ||
gcc -static -g src/state_explore.c -o state_explore | ||
SE_ADDR=0x$(objdump -S state_explore | grep -A 1 'value == 0x41' | | ||
tail -n 1 | sed 's|^\s*||g' | cut -f1 -d:) | ||
coverage run ./state_control.py state_explore $SE_ADDR | ||
if [ $? -ne 0 ]; then | ||
return 1 | ||
fi | ||
return 0 | ||
} | ||
make_vmtests(){ | ||
DIR=`pwd` | ||
if [ ! -f ethereum_vm/.done ]; then | ||
echo "Automaking VMTests" `pwd` | ||
cd ./tests/ && mkdir -p ethereum_vm/VMTests_concrete && mkdir -p ethereum_vm/VMTests_symbolic | ||
rm -Rf vmtests; git clone https://github.com/ethereum/tests --depth=1 vmtests | ||
for i in ./vmtests/BlockchainTests/ValidBlocks/VMTests/*/*json; do python ./auto_generators/make_VMTests.py -f istanbul -i $i -o ethereum_vm/VMTests_concrete; done | ||
rm ethereum_vm/VMTests_concrete/test_loop*.py #too slow | ||
rm -rf ./vmtests | ||
touch ethereum_vm/.done | ||
fi | ||
cd $DIR | ||
} | ||
make_wasm_tests(){ | ||
DIR=`pwd` | ||
if [ ! -f .wasm_done ]; then | ||
echo "Automaking WASM Tests" `pwd` | ||
cd ./tests/wasm | ||
./generate_tests.sh | ||
touch .wasm_done | ||
fi | ||
cd $DIR | ||
} | ||
make_wasm_sym_tests(){ | ||
DIR=`pwd` | ||
if [ ! -f .wasm_sym_done ]; then | ||
echo "Automaking Symbolic WASM Tests" `pwd` | ||
cd ./tests/wasm_sym | ||
./generate_symbolic_tests.sh | ||
touch .wasm_sym_done | ||
fi | ||
cd $DIR | ||
} | ||
install_truffle(){ | ||
npm install -g truffle | ||
} | ||
run_truffle_tests(){ | ||
COVERAGE_RCFILE=$GITHUB_WORKSPACE/.coveragerc | ||
mkdir truffle_tests | ||
cd truffle_tests | ||
truffle unbox metacoin | ||
coverage run -m manticore . --contract MetaCoin --workspace output --exclude-all --evm.oog ignore --evm.txfail optimistic | ||
# Truffle smoke test. We test if manticore is able to generate states | ||
# from a truffle project. | ||
if [ "$(ls output/*tx -l | wc -l)" != "26" ]; then | ||
echo "Truffle test failed" `ls output/*tx -l | wc -l` "!= 26" | ||
return 1 | ||
fi | ||
echo "Truffle test succeded" | ||
coverage xml | ||
cd .. | ||
cp truffle_tests/coverage.xml . | ||
return 0 | ||
} | ||
run_tests_from_dir() { | ||
DIR=$1 | ||
COVERAGE_RCFILE=$GITHUB_WORKSPACE/.coveragerc | ||
echo "Running only the tests from 'tests/$DIR' directory" | ||
pytest --durations=100 --cov=manticore --cov-config=$GITHUB_WORKSPACE/.coveragerc -n auto "tests/$DIR" | ||
coverage xml | ||
} | ||
run_examples() { | ||
pushd examples/linux | ||
make | ||
for example in $(make list); do | ||
./$example < /dev/zero > /dev/null | ||
done | ||
echo Built and ran Linux examples | ||
popd | ||
pushd examples/script | ||
launch_examples | ||
RESULT=$? | ||
echo Ran example scripts | ||
coverage xml | ||
popd | ||
cp examples/script/coverage.xml . | ||
return $RESULT | ||
} | ||
# Test type | ||
case $TEST_TYPE in | ||
ethereum_vm) | ||
make_vmtests | ||
run_tests_from_dir $TEST_TYPE | ||
;; | ||
ethereum_truffle) | ||
echo "Running truffle test" | ||
install_truffle | ||
run_truffle_tests | ||
;; | ||
wasm) | ||
make_wasm_tests | ||
run_tests_from_dir $TEST_TYPE | ||
;; | ||
wasm_sym) | ||
make_wasm_sym_tests ;& # Fallthrough | ||
native) ;& # Fallthrough | ||
ethereum) ;& # Fallthrough | ||
ethereum_bench) ;& # Fallthrough | ||
other) | ||
run_tests_from_dir $TEST_TYPE | ||
;; | ||
examples) | ||
run_examples | ||
;; | ||
*) | ||
echo "Unknown TEST_TYPE: '$TEST_TYPE'" | ||
exit 3; | ||
;; | ||
esac | ||
- name: Coverage Upload | ||
uses: codecov/codecov-action@v1 | ||
cp scripts/run_tests.sh . | ||
./run_tests.sh | ||
- name: Coveralls Parallel | ||
run: | | ||
coveralls --service=github | ||
env: | ||
COVERALLS_PARALLEL: true | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# Send notification when all tests have finished to combine coverage results | ||
coverage-finish: | ||
needs: tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Coveralls Finished | ||
uses: coverallsapp/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
parallel-finished: true | ||
upload: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'schedule' | ||
needs: tests | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.6 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.6 | ||
- name: Build Dist | ||
run: | | ||
python3 -m pip install wheel | ||
python3 setup.py --dev_release sdist bdist_wheel | ||
- name: Upload to PyPI | ||
uses: pypa/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: ./coverage.xml | ||
yml: ./codecov.yml | ||
# Disabled this line because Codecov has been extra flaky lately, and having to re-run the entire | ||
# test suite until every coverage upload step succeeds is more of a hassle than it's worth. | ||
# fail_ci_if_error: true | ||
password: ${{ secrets.PYPI_UPLOAD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: MacOS Tests | ||
|
||
on: | ||
schedule: | ||
# Run every day at 11 PM. | ||
- cron: '0 23 * * *' | ||
|
||
jobs: | ||
tests: | ||
runs-on: macos-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
type: ["ethereum_truffle", "ethereum_bench", "ethereum", "ethereum_vm", "wasm", "wasm_sym", "other"] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python 3.6 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.6 | ||
- name: Install NPM | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '13.x' | ||
- name: Install dependencies | ||
env: | ||
TEST_TYPE: ${{ matrix.type }} | ||
run: | | ||
EXTRAS="dev-noks" | ||
pip install -e .[$EXTRAS] | ||
- name: Install Mac Dependencies | ||
run: | | ||
brew install bash | ||
brew tap ethereum/ethereum | ||
brew install solidity@4 | ||
brew install wabt | ||
brew install SRI-CSL/sri-csl/yices2 | ||
brew tap cvc4/cvc4 | ||
brew install cvc4/cvc4/cvc4 | ||
- name: Run Tests | ||
env: | ||
TEST_TYPE: ${{ matrix.type }} | ||
run: | | ||
cp scripts/run_tests.sh . | ||
./run_tests.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.