Spectrum Chain Development Prepare-Debug Test Code And Execute Unit Test On Windows Environment
System Environment: win10
Note: Different versions may differ
Devopment Dependencies:
Go, GCC
Go download address: https://golang.org/dl/
Author download 1.10.2. 64 bit version:
full download address: https://dl.google.com/go/go1.10.2.windows-amd64.msi
install:
I installed directory C:\Go . added C:\Go\bin to system environment.
execute go version, if show the go version number, install successfully.
C:\Users\tangshua>go version
go version go1.10.2 windows/amd64
MinGw download : https://sourceforge.net/projects/mingw-w64/
full download address:
install MinGW:
I installed at D:\mingw-w64, after installation. added D:\mingw-w64\bin to system environment.
Spectrum installation
download sourcecode:
https://github.com/SmartMeshFoundation/Spectrum
go to the tests folder. execute Go test -v
Other point:
solved errors:
1. put the code at go folder.
C:\Go\src\github.com\SmartMeshFoundation\Spectrum
I found that below code definition at block_test_util.go, maybe case error as some library can’t be found.
import ( “bytes” “encoding/hex” “encoding/json” “fmt” “math/big” “github.com/SmartMeshFoundation/Spectrum/common” “github.com/SmartMeshFoundation/Spectrum/common/hexutil” “github.com/SmartMeshFoundation/Spectrum/common/math” “github.com/SmartMeshFoundation/Spectrum/consensus/ethash” “github.com/SmartMeshFoundation/Spectrum/core” “github.com/SmartMeshFoundation/Spectrum/core/state” “github.com/SmartMeshFoundation/Spectrum/core/types” “github.com/SmartMeshFoundation/Spectrum/core/vm” “github.com/SmartMeshFoundation/Spectrum/ethdb” “github.com/SmartMeshFoundation/Spectrum/params” “github.com/SmartMeshFoundation/Spectrum/rlp”)
2. create testdata folder in tests folder. and create below folders in testdata.
BlockchainTests,GeneralStateTests,TransactionTests,VMTests,RLPTests,BasicTests 。
I found below code at init_test.go :
var ( baseDir = filepath.Join(“.”, “testdata”) blockTestDir = filepath.Join(baseDir, “BlockchainTests”) stateTestDir = filepath.Join(baseDir, “GeneralStateTests”) transactionTestDir = filepath.Join(baseDir, “TransactionTests”) vmTestDir = filepath.Join(baseDir, “VMTests”) rlpTestDir = filepath.Join(baseDir, “RLPTests”) difficultyTestDir = filepath.Join(baseDir, “BasicTests”))
but no relation folders found in the source code downloaded from github.
