Skip to content

Retesteth commands

winsvega edited this page Dec 2, 2019 · 7 revisions

Retesteth Commands

Setting up the tests

Download the test repo: https://github.com/ethereum/tests
By default retesteth reads path to the test repo from env variable ETHEREUM_TEST_PATH
This could be overwritten with --testpath option:

./retesteth -- --testpath "/path/to/the/test/repo"

Setting up the test client

Check default client config:
~/.retesteth/default
And create a config folder for you client.
https://github.com/ethereum/retesteth/wiki/Add-client-configuration-to-Retesteth

./retesteth -t GeneralStateTests -- --clients "default"

Replace "default" with your newly created client config folder. If you configured the client to work via TCP socket, make sure that specified port is open and listening for connections by the instance of a client.

Running the tests

The basic tests suites to run:
GeneralStateTests - minimum EVM coverage of one transaction call execution testing opcode execution scenarios.

./retesteth -t GeneralStateTests --

BlockchainTests - tests with many blocks each block could have many transactions. including malicious blocks.

./retesteth -t BlockchainTests --

By adding a --testfile option you could run a custom test file from any location

./retesteth  -t GeneralStateTests  -- --testfile /home/wins/Ethereum/tests/GeneralStateTests/stExample/add11.json

Filling the tests

Simply add --filltests option after selecting the test suite.

./retesteth -t GeneralStateTests -- --filltests

In this mode retesteth will ask the post state from the client after transaction execution and write this information as the actual test, replacing the test files in the test folder. The post condition check will also be performed and if the result post state from the client does not match post condition specified in the test source, you will see the error.

Guide to test generation: https://github.com/ethereum/retesteth/wiki/Creating-a-State-Test-with-retesteth

Debugging

Setting up the log level when running the commands [N:1-6]:

--verbosity <N>

Output vm steps in json format for transaction execution

--vmtrace

When a post state is huge, retesteth will put it's hash to the generated test. This could be disabled by --fullstate option. When filling the tests, option --poststate will print result post state for debug.

./retesteth -t GeneralStateTests/stExample -- --filltests --fullstate --poststate