美文网首页SmartMesh Developer Community
Spectrum链开发准备篇-Windows环境下调通测试代码,

Spectrum链开发准备篇-Windows环境下调通测试代码,

作者: dcf799a1964b | 来源:发表于2018-09-08 11:09 被阅读4次

    系统环境 win10

    注:不同windows发布版本安装过程可能略有不同

    环境依赖:

    Go, GCC

    Go下载地址: https://golang.org/dl/

    笔者下载的是1.10.2.   64位版本:

    完整下载地址: https://dl.google.com/go/go1.10.2.windows-amd64.msi

    安装:

    笔者安装的路径为 C:\Go目录下. 添加   C:\Go\bin到环境变量中.

    任意目录下执行go version,显示版本号则安装配置成功.

    C:\Users\tangshua>go version

    go version go1.10.2 windows/amd64

    MinGw下载地址 : https://sourceforge.net/projects/mingw-w64/

    笔者下载的GW完整下载地址: https://jaist.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe

    安装MinGW:

    笔者安装在D:\mingw-w64,安装完成后如下. 添加D:\mingw-w64\bin到环境变量中.

    Spectrum安装

    下载源文件

    https://github.com/SmartMeshFoundation/Spectrum

    笔者放在了D盘.切换到tests目录.  执行Go test -v

    其它点:

    执行报错解决办法:

    1.   将代码放在Go目录下.

    C:\Go\src\github.com\SmartMeshFoundation\Spectrum

    笔者在block_test_util.go代码中发现如下定义,可能导致相应类库无法找到而报错.

    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.   在tests目录下创建testdata目录,同时在testdata目录下分别创建

    BlockchainTests,GeneralStateTests,TransactionTests,VMTests,RLPTests,BasicTests目录。

    笔者在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") )

    但是并未在文件夹中发现,因此手动创建了改文件夹.

    相关文章

      网友评论

        本文标题:Spectrum链开发准备篇-Windows环境下调通测试代码,

        本文链接:https://www.haomeiwen.com/subject/czskgftx.html