tests

package
v1.7.3-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2021 License: GPL-3.0 Imports: 21 Imported by: 0

README

How to use Klaytn tests

Klaytn tests is not currently included here due to its relatively large size. It will be added as a git submodule later.

In order to use Klaytn tests, you would need to clone it as testdata; or clone it somewhere and make a symbolic link to it. This document assumes Klaytn tests is cloned outside the klaytn source tree, and the following instructions describe how to use Klaytn tests with go test.

1. Clone Klaytn tests

Clone Klaytn tests in the location where you'd like to have it. Let's say we clone it in $HOME/workspace.

$ cd $HOME/workspace
$ git clone git@github.com:klaytn/klaytn-tests.git

We assume Klaytn source tree is located in $HOME/workspace/go/src/github.com/klaytn/klaytn.

$ cd $HOME/workspace/go/src/github.com/klaytn/klaytn/tests
$ ln -s $HOME/workspace/klaytn-tests testdata

3-1. Run all test cases

Inside tests directory, you can run all test cases simply using go test.

$ go test

3-2. Run a specific test

There are five test sets available in Klaytn tests, which can be put after -run flag.

  • Blockchain
    • NOTE: all test cases in BlockchainTests are skipped at this moment because of the change in block header.
  • State
  • Transition
  • VM
  • RLP
$ go test -run VM

3-3. Run in verbose mode

-v flag can be used to run tests in verbose mode.

$ go test -run VM -v

Documentation

Overview

Package tests implements execution of Klaytn scenario-based tests and JSON tests.

Index

Constants

This section is empty.

Variables

View Source
var Forks = map[string]*params.ChainConfig{
	"Frontier": {
		ChainID: big.NewInt(1),
	},
	"Byzantium": {
		ChainID: big.NewInt(1),
	},
	"Constantinople": {
		ChainID: big.NewInt(1),
	},
}

Forks table defines supported forks and their chain config. TODO-Klaytn-RemoveLater Remove fork configs that are not meaningful for Klaytn

Functions

func MakePreState

func MakePreState(db database.DBManager, accounts blockchain.GenesisAlloc) *state.StateDB

Types

type BlockTest

type BlockTest struct {
	// contains filtered or unexported fields
}

A BlockTest checks handling of entire blocks.

func (*BlockTest) Run

func (t *BlockTest) Run() error

func (*BlockTest) UnmarshalJSON

func (t *BlockTest) UnmarshalJSON(in []byte) error

UnmarshalJSON implements json.Unmarshaler interface.

type RLPTest

type RLPTest struct {
	// If the value of In is "INVALID" or "VALID", the test
	// checks whether Out can be decoded into a value of
	// type interface{}.
	//
	// For other JSON values, In is treated as a driver for
	// calls to rlp.Stream. The test also verifies that encoding
	// In produces the bytes in Out.
	In interface{}

	// Out is a hex-encoded RLP value.
	Out string
}

RLPTest is the JSON structure of a single RLP test.

func (*RLPTest) Run

func (t *RLPTest) Run() error

Run executes the test.

type StateSubtest

type StateSubtest struct {
	Fork  string
	Index int
}

StateSubtest selects a specific configuration of a General State Test.

type StateTest

type StateTest struct {
	// contains filtered or unexported fields
}

StateTest checks transaction processing without block context. See https://github.com/ethereum/EIPs/issues/176 for the test format specification.

func (*StateTest) Run

func (t *StateTest) Run(subtest StateSubtest, vmconfig vm.Config) (*state.StateDB, error)

Run executes a specific subtest.

func (*StateTest) Subtests

func (t *StateTest) Subtests() []StateSubtest

Subtests returns all valid subtests of the test.

func (*StateTest) UnmarshalJSON

func (t *StateTest) UnmarshalJSON(in []byte) error

type TransactionTest

type TransactionTest struct {
	// contains filtered or unexported fields
}

TransactionTest checks RLP decoding and sender derivation of transactions.

func (*TransactionTest) Run

func (tt *TransactionTest) Run(config *params.ChainConfig) error

type UnsupportedForkError

type UnsupportedForkError struct {
	Name string
}

UnsupportedForkError is returned when a test requests a fork that isn't implemented.

func (UnsupportedForkError) Error

func (e UnsupportedForkError) Error() string

type VMTest

type VMTest struct {
	// contains filtered or unexported fields
}

VMTest checks EVM execution without block or transaction context. See https://github.com/ethereum/tests/wiki/VM-Tests for the test format specification.

func (*VMTest) Run

func (t *VMTest) Run(vmconfig vm.Config) error

func (*VMTest) UnmarshalJSON

func (t *VMTest) UnmarshalJSON(data []byte) error

Directories

Path Synopsis
Package benchmarks contains go-benchmark tests to measure performance of Klaytn.
Package benchmarks contains go-benchmark tests to measure performance of Klaytn.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL