mirror of
https://github.com/trailofbits/manticore.git
synced 2026-10-12 02:23:44 +00:00
removes travis entirely (#1572)
This commit is contained in:
committed by
Eric Hennenfent
parent
3de18f61c3
commit
fae081d6d6
-66
@@ -1,66 +0,0 @@
|
||||
dist: xenial
|
||||
os:
|
||||
- linux
|
||||
language: python
|
||||
python:
|
||||
- 3.6
|
||||
|
||||
stages:
|
||||
- lint
|
||||
- prepare
|
||||
- test
|
||||
- submit
|
||||
|
||||
env:
|
||||
global:
|
||||
- CC_TEST_REPORTER_ID=db72f1ed59628c16eb0c00cbcd629c4c71f68aa1892ef42d18c7c2b8326f460a
|
||||
- JOB_COUNT=6 # Six jobs generate test coverage: ethereum, ethereum_bench, ethereum_vm, native, wasm, and other
|
||||
- PYTHONWARNINGS="default::ResourceWarning" # Enable ResourceWarnings
|
||||
matrix:
|
||||
- TEST_TYPE=examples
|
||||
- TEST_TYPE=ethereum
|
||||
- TEST_TYPE=ethereum_bench
|
||||
- TEST_TYPE=ethereum_vm
|
||||
- TEST_TYPE=native
|
||||
- TEST_TYPE=wasm
|
||||
- TEST_TYPE=other
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /^(?!wip-).+$/
|
||||
|
||||
cache: pip
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: lint
|
||||
env: TEST_TYPE=lint
|
||||
script:
|
||||
- black --version
|
||||
- git diff --name-only $TRAVIS_COMMIT_RANGE | python3 scripts/pyfile_exists.py | xargs black --diff --check || { echo "Reformat required! Please run 'black <filename>' to reformat changes." ; travis_terminate 1 ; }
|
||||
- mypy --version
|
||||
- mypy manticore || { echo "mypy type-checking error. Please read the error and fix." ; travis_terminate 1 ; }
|
||||
- stage: prepare
|
||||
env: TEST_TYPE=env
|
||||
script:
|
||||
- ./cc-test-reporter before-build
|
||||
after_success:
|
||||
- stage: submit
|
||||
env: TEST_TYPE=env
|
||||
script:
|
||||
- true
|
||||
after_script:
|
||||
- aws s3 sync "s3://manticore-testdata/coverage/$TRAVIS_COMMIT" coverage/
|
||||
- ./cc-test-reporter sum-coverage --output - --parts $JOB_COUNT coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --input -
|
||||
|
||||
install:
|
||||
- scripts/travis_install.sh $TEST_TYPE
|
||||
|
||||
script:
|
||||
- travis_wait 70 scripts/travis_test.sh $TEST_TYPE
|
||||
|
||||
after_success:
|
||||
- ./cc-test-reporter format-coverage -t coverage.py -o "coverage/codeclimate.$TEST_TYPE.json"
|
||||
- aws s3 sync coverage/ "s3://manticore-testdata/coverage/$TRAVIS_COMMIT"
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function install_solc {
|
||||
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
|
||||
}
|
||||
|
||||
function install_mcore {
|
||||
pip install -U pip
|
||||
|
||||
# We only need to install keystone if we're running tests other than ethereum
|
||||
EXTRAS="dev-noks"
|
||||
if [[ "$1" != "ethereum"* ]]; then
|
||||
EXTRAS="dev"
|
||||
fi
|
||||
|
||||
pip install --no-binary keystone-engine -e .[$EXTRAS] # ks can have pip install issues
|
||||
}
|
||||
|
||||
function install_cc_env {
|
||||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
||||
chmod +x ./cc-test-reporter
|
||||
|
||||
pip install awscli
|
||||
}
|
||||
|
||||
# Install tools for initial linting stage
|
||||
if [ "$1" == "lint" ]; then
|
||||
pip install black==19.3b0 mypy==0.740
|
||||
fi
|
||||
|
||||
# Install CodeClimate env
|
||||
if [ "$1" != "lint" ]; then
|
||||
install_cc_env
|
||||
fi
|
||||
|
||||
# Skip Manticore installation setup and teardown
|
||||
if [ "$1" != "env" ]; then
|
||||
if [ "$1" != "lint" ]; then
|
||||
install_solc
|
||||
install_mcore $1
|
||||
fi
|
||||
fi
|
||||
@@ -1,196 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
RV=0
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
# Launches all examples; this assumes PWD is examples/script
|
||||
launch_examples() {
|
||||
# concolic assumes presence of ../linux/simpleassert
|
||||
echo "Running concolic.py..."
|
||||
HW=../linux/helloworld
|
||||
python ./concolic.py
|
||||
if [ $? -ne 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Running count_instructions.py..."
|
||||
python ./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:)
|
||||
python ./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 - <<-EOF
|
||||
#include <stdio.h>
|
||||
int main(){return 0;}
|
||||
EOF
|
||||
python ./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}')
|
||||
python ./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:)
|
||||
python ./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/VMTests/*; do python ./auto_generators/make_VMTests.py $i; done
|
||||
for i in ./vmtests/VMTests/*; do python ./auto_generators/make_VMTests.py $i --symbolic; done
|
||||
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
|
||||
}
|
||||
|
||||
install_truffle(){
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
|
||||
source ~/.nvm/nvm.sh
|
||||
nvm install --lts
|
||||
nvm use --lts
|
||||
|
||||
npm install -g truffle
|
||||
}
|
||||
|
||||
run_truffle_tests(){
|
||||
mkdir truffle_tests
|
||||
cd truffle_tests
|
||||
truffle unbox metacoin
|
||||
manticore . --contract MetaCoin --workspace output
|
||||
### The original comment says we should get 41 states, but after implementing the shift
|
||||
### insructions, we get 31. Was the original comment a typo?
|
||||
|
||||
# The correct answer should be 41
|
||||
# but Manticore fails to explore the paths due to the lack of the 0x1f opcode support
|
||||
# see https://github.com/trailofbits/manticore/issues/1166
|
||||
# if [ "$(ls output/*tx -l | wc -l)" != "41" ]; then
|
||||
if [ "$(ls output/*tx -l | wc -l)" != "13" ]; then
|
||||
echo "Truffle test failed" `ls output/*tx -l | wc -l` "!= 13"
|
||||
return 1
|
||||
fi
|
||||
echo "Truffle test succeded"
|
||||
cd ..
|
||||
return 0
|
||||
}
|
||||
|
||||
run_tests_from_dir() {
|
||||
DIR=$1
|
||||
coverage erase
|
||||
pytest --cov=manticore -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
|
||||
popd
|
||||
return $RESULT
|
||||
}
|
||||
|
||||
# Test type
|
||||
case $1 in
|
||||
ethereum_vm)
|
||||
make_vmtests
|
||||
echo "Running only the tests from 'tests/$1' directory"
|
||||
run_tests_from_dir $1
|
||||
RV=$?
|
||||
echo "Running truffle test"
|
||||
install_truffle
|
||||
run_truffle_tests
|
||||
RV=$(($RV + $?))
|
||||
;;
|
||||
wasm)
|
||||
make_wasm_tests ;& # Fallthrough
|
||||
native) ;& # Fallthrough
|
||||
ethereum) ;& # Fallthrough
|
||||
ethereum_bench) ;& # Fallthrough
|
||||
other)
|
||||
echo "Running only the tests from 'tests/$1' directory"
|
||||
run_tests_from_dir $1
|
||||
RV=$?
|
||||
;;
|
||||
|
||||
examples)
|
||||
run_examples
|
||||
;;
|
||||
|
||||
all)
|
||||
echo "Running all tests registered in travis_test.sh: examples, native, ethereum, ethereum_vm, other";
|
||||
|
||||
# Functions should return 0 on success and 1 on failure
|
||||
RV=0
|
||||
run_tests_from_dir native
|
||||
RV=$(($RV + $?))
|
||||
run_tests_from_dir ethereum
|
||||
RV=$(($RV + $?))
|
||||
make_vmtests; run_tests_from_dir ethereum_vm
|
||||
RV=$(($RV + $?))
|
||||
make_wasm_tests; run_tests_from_dir wasm
|
||||
RV=$(($RV + $?))
|
||||
run_tests_from_dir other
|
||||
RV=$(($RV + $?))
|
||||
run_examples
|
||||
RV=$(($RV + $?))
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 [examples|native|ethereum|ethereum_vm|other|all]"
|
||||
exit 3;
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
exit ${RV}
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
## Tests
|
||||
|
||||
Please DO NOT create directories in tests/ as we run separate directories in separate test jobs **and this is done explicitly in .travis.yml** (unless you change that file too).
|
||||
Please DO NOT create directories in tests/ as we run separate directories in separate test jobs **and this is done explicitly in .github/workflows/ci.yml** (unless you change that file too).
|
||||
|
||||
Reference in New Issue
Block a user