Skip to content

Commit f00d450

Browse files
committed
move some testrunner logic to ethereumjs-testing
1 parent b229c95 commit f00d450

File tree

2 files changed

+21
-28
lines changed

2 files changed

+21
-28
lines changed

README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# SYNOPSIS
1+
# SYNOPSIS
22

33
[![NPM Package](https://img.shields.io/npm/v/ethereumjs-vm.svg?style=flat-square)](https://www.npmjs.org/package/ethereumjs-vm)
44
[![Build Status](https://img.shields.io/travis/ethereumjs/ethereumjs-vm.svg?branch=master&style=flat-square)](https://travis-ci.org/ethereumjs/ethereumjs-vm)
55
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode
66

7-
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
7+
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
88

99
Implements Ethereum's VM in JS
1010

@@ -23,7 +23,7 @@ code = new Buffer(code, 'hex')
2323

2424
vm.runCode({
2525
code: code,
26-
gasLimit: new Buffer('ffffffff', 'hex')
26+
gasLimit: new Buffer('ffffffff', 'hex')
2727
}, function(err, results){
2828
console.log('returned: ' + results.return.toString('hex'));
2929
})
@@ -101,7 +101,7 @@ Runs EVM code
101101
- `opts.caller` - The address that ran this code. The address should be a `Buffer` of 20bits. Defaults to `0`
102102
- `cb` - The callback. It is given two arguments, an `error` string containing an error that may have happened or `null` and a `results` object with the following properties
103103
- `gas` - the amount of gas left as a `bignum`
104-
- `gasUsed` - the amount of gas as a `bignum` the code used to run.
104+
- `gasUsed` - the amount of gas as a `bignum` the code used to run.
105105
- `gasRefund` - a `Bignum` containing the amount of gas to refund from deleting storage values
106106
- `suicides` - an `Object` with keys for accounts that have suicided and values for balance transfer recipient accounts.
107107
- `logs` - an `Array` of logs that the contract emitted.
@@ -136,18 +136,18 @@ vm.generateGenesis(genesisData, function(){
136136
### `events`
137137
All events are instances of [async-eventemmiter](https://www.npmjs.com/package/async-eventemitter). If an event handler has an arity of 2 the VM will pause until the callback is called
138138

139-
#### `step`
139+
#### `step`
140140
The `step` event is given an `Object` and callback. The `Object` has the following properties.
141141
- `pc` - a `Number` representing the program counter
142142
- `opcode` - the next opcode to be ran
143143
- `gas` - a `bignum` standing for the amount of gasLeft
144-
- `stack` - an `Array` of `Buffers` containing the stack.
144+
- `stack` - an `Array` of `Buffers` containing the stack.
145145
- `storageTrie` - the storage [trie](https://github.com/wanderer/merkle-patricia-tree) for the account
146146
- `account` - the [`Account`](https://github.com/ethereum/ethereumjs-account) which owns the code running.
147147
- `address` - the address of the `account`
148148
- `depth` - the current number of calls deep the contract is
149149
- `memory` - the memory of the VM as a `buffer`
150-
- `cache` - The account cache. Contains all the accounts loaded from the trie. It is an instance of [functional red black tree](https://www.npmjs.com/package/functional-red-black-tree)
150+
- `cache` - The account cache. Contains all the accounts loaded from the trie. It is an instance of [functional red black tree](https://www.npmjs.com/package/functional-red-black-tree)
151151

152152
#### `beforeBlock`
153153
Emits the block that is about to be processed.
@@ -164,11 +164,17 @@ Emits the result of the transaction.
164164
# TESTING
165165
`npm test`
166166
if you want to just run the Blockchain tests run
167-
`./test/tester -b`
167+
`node ./tests/tester -b`
168168
if you want to just run the VM tests run
169-
`./test/tester -v`
169+
`node ./tests/tester -v`
170170
if you want to just run the State tests run
171-
`./test/tester -s`
171+
`node ./tests/tester -s`
172+
173+
To run the all the tests in a file:
174+
`node ./tests/tester -b --file='randomStatetest303'`
175+
176+
or to run a specific test case:
177+
`node ./tests/tester -v --test='log0_nonEmptyMem_logMemSize1_logMemStart31'``
172178

173179
# Internal Structure
174180
The VM processes state changes at many levels.

tests/tester.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ if (argv.r) {
4848
runAll()
4949
}
5050

51-
function skipTest (testName) {
52-
return skip.map((skipName) => (new RegExp(`^${skipName}`)).test(testName)).some(isMatch => isMatch)
53-
}
54-
5551
// randomized tests
5652
// returns 1 if the tests fails
5753
// returns 0 if the tests succeds
@@ -87,20 +83,11 @@ function randomized (stateTest) {
8783
}
8884

8985
function runTests (name, runnerArgs, cb) {
90-
let testGetterArgs = argv
91-
92-
// setup skip function
93-
if (name === 'BlockchainTests') {
94-
const forkFilter = new RegExp(`${FORK_CONFIG}$`)
95-
testGetterArgs.skipFn = (name) => {
96-
return ((forkFilter.test(name) === false) || skipTest(name))
97-
}
98-
} else {
99-
testGetterArgs.skipFn = (name) => {
100-
return skipTest(name)
101-
}
102-
}
103-
86+
let testGetterArgs = {}
87+
testGetterArgs.skipFiles = skip
88+
testGetterArgs.forkConfig = FORK_CONFIG
89+
testGetterArgs.file = argv.file
90+
testGetterArgs.test = argv.test
10491

10592
runnerArgs.forkConfig = FORK_CONFIG
10693
//runnerArgs.debugging = true; // for BlockchainTests

0 commit comments

Comments
 (0)