Go-ethereum 源碼解析之運(yùn)行 go-ethereum 源碼中的測試文件

Go-ethereum 源碼解析之運(yùn)行 go-ethereum 源碼中的測試文件

本文的操作是基于 Linux CentOS 7 系統(tǒng)寺枉。

配置 go-ethereum 源碼的 go 目錄結(jié)構(gòu)

[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]$

設(shè)置 GOPATH

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

運(yùn)行某個包中的所有測試

[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 <nil>}
[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]$

運(yùn)行某個包中某個具體的測試

[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

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

Contributor

  1. Windstamp
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末傀广,一起剝皮案震驚了整個濱河市口柳,隨后出現(xiàn)的幾起案子鳄哭,更是在濱河造成了極大的恐慌呼伸,老刑警劉巖块仆,帶你破解...
    沈念sama閱讀 218,546評論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件脐彩,死亡現(xiàn)場離奇詭異徙歼,居然都是意外死亡犁河,警方通過查閱死者的電腦和手機(jī)鳖枕,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,224評論 3 395
  • 文/潘曉璐 我一進(jìn)店門魄梯,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人宾符,你說我怎么就攤上這事酿秸。” “怎么了魏烫?”我有些...
    開封第一講書人閱讀 164,911評論 0 354
  • 文/不壞的土叔 我叫張陵辣苏,是天一觀的道長肝箱。 經(jīng)常有香客問我,道長稀蟋,這世上最難降的妖魔是什么煌张? 我笑而不...
    開封第一講書人閱讀 58,737評論 1 294
  • 正文 為了忘掉前任,我火速辦了婚禮退客,結(jié)果婚禮上骏融,老公的妹妹穿的比我還像新娘。我一直安慰自己萌狂,他們只是感情好档玻,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,753評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著茫藏,像睡著了一般误趴。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上务傲,一...
    開封第一講書人閱讀 51,598評論 1 305
  • 那天凉当,我揣著相機(jī)與錄音,去河邊找鬼树灶。 笑死纤怒,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的天通。 我是一名探鬼主播泊窘,決...
    沈念sama閱讀 40,338評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼像寒!你這毒婦竟也來了烘豹?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,249評論 0 276
  • 序言:老撾萬榮一對情侶失蹤诺祸,失蹤者是張志新(化名)和其女友劉穎携悯,沒想到半個月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體筷笨,經(jīng)...
    沈念sama閱讀 45,696評論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡憔鬼,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,888評論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了胃夏。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片轴或。...
    茶點(diǎn)故事閱讀 40,013評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖仰禀,靈堂內(nèi)的尸體忽然破棺而出照雁,到底是詐尸還是另有隱情,我是刑警寧澤答恶,帶...
    沈念sama閱讀 35,731評論 5 346
  • 正文 年R本政府宣布饺蚊,位于F島的核電站萍诱,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏污呼。R本人自食惡果不足惜裕坊,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,348評論 3 330
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望燕酷。 院中可真熱鬧碍庵,春花似錦、人聲如沸悟狱。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,929評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽挤渐。三九已至苹享,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間浴麻,已是汗流浹背得问。 一陣腳步聲響...
    開封第一講書人閱讀 33,048評論 1 270
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留软免,地道東北人宫纬。 一個月前我還...
    沈念sama閱讀 48,203評論 3 370
  • 正文 我出身青樓,卻偏偏與公主長得像膏萧,于是被迫代替她去往敵國和親漓骚。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,960評論 2 355