Skip to content

Commit 9572f57

Browse files
committed
vm -> stateless: monorepo transition fixes, tests/tester.js integration, added GitHub actions workflow
1 parent 3809733 commit 9572f57

5 files changed

Lines changed: 50 additions & 258 deletions

File tree

.github/workflows/vm-pr.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,30 @@ jobs:
111111
working-directory: ${{github.workspace}}
112112

113113
- run: npm run test:blockchain -- ${{ matrix.args }} --fork=${{ matrix.fork }}
114+
115+
test-vm-stateless:
116+
runs-on: ubuntu-latest
117+
steps:
118+
- uses: actions/setup-node@v1
119+
with:
120+
node-version: 12.x
121+
- uses: actions/checkout@v1
122+
123+
- name: Dependency cache
124+
uses: actions/cache@v2
125+
id: cache
126+
with:
127+
key: VM-${{ runner.os }}-12-${{ hashFiles('**/package-lock.json') }}
128+
path: '**/node_modules'
129+
130+
# Installs root dependencies, ignoring Bootstrap All script.
131+
# Bootstraps the current package only
132+
- run: npm install --ignore-scripts && npm run bootstrap:vm
133+
if: steps.cache.outputs.cache-hit != 'true'
134+
working-directory: ${{github.workspace}}
135+
136+
# Builds current package and the ones it depends from.
137+
- run: npm run build:vm
138+
working-directory: ${{github.workspace}}
139+
140+
- run: npm run test:stateless

packages/vm/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"test:buildIntegrity": "npm run test:state -- --test='stackOverflow'",
2121
"test:blockchain": "node -r ts-node/register --stack-size=1500 ./tests/tester --blockchain",
2222
"test:blockchain:allForks": "echo 'Homestead TangerineWhistle SpuriousDragon Byzantium Constantinople Petersburg Istanbul MuirGlacier' | xargs -n1 | xargs -I v1 node -r ts-node/register --stack-size=1500 ./tests/tester --blockchain --fork=v1",
23+
"test:stateless": "npm run build && node ./tests/tester --stateless --fork='Petersburg' --dist",
2324
"test:API": "tape -r ts-node/register --stack-size=1500 ./tests/api/**/*.js",
2425
"test:API:browser": "npm run build && karma start karma.conf.js",
2526
"test": "echo \"[INFO] Generic test cmd not used. See package.json for more specific test run cmds.\"",

packages/vm/tests/tester.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ function runTests() {
1212
name = 'GeneralStateTests'
1313
} else if (argv.blockchain) {
1414
name = 'BlockchainTests'
15+
} else if (argv.stateless) {
16+
name = 'Stateless'
1517
}
1618

1719
const FORK_CONFIG = (argv.fork || config.DEFAULT_FORK_CONFIG)
@@ -78,6 +80,7 @@ function runTests() {
7880
console.log(`+${'-'.repeat(width)}+`)
7981
console.log()
8082

83+
// Run a custom state test
8184
if (argv.customStateTest) {
8285
const stateTestRunner = require('./GeneralStateTestsRunner.js')
8386
let fileName = argv.customStateTest
@@ -91,6 +94,25 @@ function runTests() {
9194
t.end()
9295
})
9396
})
97+
// Stateless test execution
98+
} else if (name === 'Stateless') {
99+
tape(name, t => {
100+
const stateTestRunner = require('./StatelessRunner.js')
101+
testing.getTestsFromArgs('GeneralStateTests', async (fileName, testName, test) => {
102+
let runSkipped = testGetterArgs.runSkipped
103+
let inRunSkipped = runSkipped.includes(fileName)
104+
if (runSkipped.length === 0 || inRunSkipped) {
105+
t.comment(`file: ${fileName} test: ${testName}`)
106+
return stateTestRunner(runnerArgs, test, t)
107+
}
108+
}, testGetterArgs).then(() => {
109+
t.end()
110+
}).catch((err) => {
111+
console.log(err)
112+
t.end()
113+
})
114+
})
115+
// Blockchain and State Tests
94116
} else {
95117
tape(name, t => {
96118
const runner = require(`./${name}Runner.js`)

tests/tester.js

Lines changed: 0 additions & 258 deletions
This file was deleted.

0 commit comments

Comments
 (0)