Go-ethereumソースコード解析の実行go-ethereumソースコードのテストファイル

4396 ワード

Go-ethereumソースコード解析の実行go-ethereumソースコードのテストファイル


本明細書の動作はLinux CentOS 7システムに基づいている.

go-ethereumソースコードのgoディレクトリ構造の構成

[furnace@localhost ethereum]$ cd gethsourcecode/
[furnace@localhost gethsourcecode]$ pwd
/home/furnace/blockchain/ethereum/gethsourcecode
[furnace@localhost gethsourcecode]$ tree -L 5
.
└── src
    └── github.com
        └── ethereum
            └── go-ethereum
                ├── accounts
                ├── appveyor.yml
                ├── AUTHORS
                ├── build
                ├── circle.yml
                ├── cmd
                ├── common
                ├── consensus
                ├── console
                ├── containers
                ├── contracts
                ├── COPYING
                ├── COPYING.LESSER
                ├── core
                ├── crypto
                ├── dashboard
                ├── Dockerfile
                ├── Dockerfile.alltools
                ├── eth
                ├── ethclient
                ├── ethdb
                ├── ethstats
                ├── event
                ├── interfaces.go
                ├── internal
                ├── les
                ├── light
                ├── log
                ├── Makefile
                ├── metrics
                ├── miner
                ├── mobile
                ├── node
                ├── p2p
                ├── params
                ├── README.md
                ├── rlp
                ├── rpc
                ├── signer
                ├── swarm
                ├── tests
                ├── trie
                ├── vendor
                └── whisper

38 directories, 10 files
[furnace@localhost gethsourcecode]$

GOPATHの設定

[furnace@localhost gethsourcecode]$ export GOPATH=/home/furnace/blockchain/ethereum/gethsourcecode
[furnace@localhost gethsourcecode]$ echo $GOPATH
/home/furnace/blockchain/ethereum/gethsourcecode
[furnace@localhost gethsourcecode]$

パッケージ内のすべてのテストを実行

[furnace@localhost gethsourcecode]$ cd src/github.com/ethereum/go-ethereum/core/types
[furnace@localhost types]$ pwd
/home/furnace/blockchain/ethereum/gethsourcecode/src/github.com/ethereum/go-ethereum/core/types
[furnace@localhost types]$ go test -v
=== RUN   TestBlockEncoding
[119 177 155 170 77 230 126 69 167 178 110 74 34 11 204 219 182 115 24 133 170 153 39 6 78 35 156 162 50 2 50 21]
{0 10 50000 [9 94 123 174 166 166 199 196 194 223 235 151 126 250 195 38 175 85 45 135] 10 [] 27 70522460370187956038204948924070039059720810735419926107150428544048091171151 62673035389445833073657395954200172251579639992696796677674670364000792703665 }
[119 177 155 170 77 230 126 69 167 178 110 74 34 11 204 219 182 115 24 133 170 153 39 6 78 35 156 162 50 2 50 21]
--- PASS: TestBlockEncoding (0.00s)
=== RUN   TestBloom
--- PASS: TestBloom (0.00s)
=== RUN   TestUnmarshalLog
--- PASS: TestUnmarshalLog (0.00s)
=== RUN   TestEIP155Signing
--- PASS: TestEIP155Signing (0.00s)
=== RUN   TestEIP155ChainId
--- PASS: TestEIP155ChainId (0.00s)
=== RUN   TestEIP155SigningVitalik
--- PASS: TestEIP155SigningVitalik (0.00s)
=== RUN   TestChainId
--- PASS: TestChainId (0.00s)
=== RUN   TestTransactionSigHash
--- PASS: TestTransactionSigHash (0.00s)
=== RUN   TestTransactionEncode
--- PASS: TestTransactionEncode (0.00s)
=== RUN   TestRecipientEmpty
--- PASS: TestRecipientEmpty (0.00s)
=== RUN   TestRecipientNormal
--- PASS: TestRecipientNormal (0.00s)
=== RUN   TestTransactionPriceNonceSort
--- PASS: TestTransactionPriceNonceSort (0.19s)
=== RUN   TestTransactionJSON
--- PASS: TestTransactionJSON (0.00s)
PASS
ok      github.com/ethereum/go-ethereum/core/types      0.211s
[furnace@localhost types]$


パッケージ内の特定のテストを実行

[furnace@localhost gethsourcecode]$ cd src/github.com/ethereum/go-ethereum/core/types
[furnace@localhost types]$ pwd
/home/furnace/blockchain/ethereum/gethsourcecode/src/github.com/ethereum/go-ethereum/core/types
[furnace@localhost types]$ go test -v -run="TestUnmarshalLog"
=== RUN   TestUnmarshalLog
--- PASS: TestUnmarshalLog (0.00s)
PASS
ok      github.com/ethereum/go-ethereum/core/types      0.015s
[furnace@localhost types]$

Reference

  • https://github.com/ethereum/go-ethereum

  • Contributor

  • Windstamp