Skip to content

Commit 5c975dd

Browse files
committed
Merge branch 'develop' of github.com-obscure:ethereum/go-ethereum into develop
2 parents d8ac267 + 63031f5 commit 5c975dd

File tree

6 files changed

+55
-19
lines changed

6 files changed

+55
-19
lines changed

.travis.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,10 @@ before_install:
66
- sudo apt-get update -qq
77
- sudo apt-get install -yqq libgmp3-dev libreadline6-dev qt54quickcontrols qt54webengine
88
install:
9-
- go get code.google.com/p/go.tools/cmd/goimports
10-
- go get github.com/golang/lint/golint
119
# - go get golang.org/x/tools/cmd/vet
1210
- if ! go get code.google.com/p/go.tools/cmd/cover; then go get golang.org/x/tools/cmd/cover; fi
1311
- go get github.com/mattn/goveralls
14-
- go get gopkg.in/check.v1
15-
- go get github.com/tools/godep
1612
before_script:
17-
- godep restore
18-
- gofmt -l -w .
19-
- goimports -l -w .
20-
- golint .
2113
# - go vet ./...
2214
# - go test -race ./...
2315
script:

accounts/accounts_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
package accounts
22

33
import (
4-
"github.com/ethereum/go-ethereum/crypto"
54
"testing"
5+
6+
"github.com/ethereum/go-ethereum/crypto"
7+
"github.com/ethereum/go-ethereum/crypto/randentropy"
68
)
79

810
func TestAccountManager(t *testing.T) {
911
ks := crypto.NewKeyStorePlain(crypto.DefaultDataDir())
1012
am := NewAccountManager(ks)
1113
pass := "" // not used but required by API
1214
a1, err := am.NewAccount(pass)
13-
toSign := crypto.GetEntropyCSPRNG(32)
15+
toSign := randentropy.GetEntropyCSPRNG(32)
1416
_, err = am.Sign(a1, pass, toSign)
1517
if err != nil {
1618
t.Fatal(err)

gocoverage.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
#!/bin/bash
2-
# The script does automatic checking on a Go package and its sub-packages, including:
3-
# 6. test coverage (http://blog.golang.org/cover)
42

53
set -e
64

7-
# Run test coverage on each subdirectories and merge the coverage profile.
5+
# Add godep workspace to GOPATH. We do it manually instead of using
6+
# 'godep go test' or 'godep restore' so godep doesn't need to be installed.
7+
GOPATH="$PWD/Godeps/_workspace:$GOPATH"
8+
9+
# Install packages before testing. Not doing this would cause
10+
# 'go test' to recompile all package dependencies before testing each package.
11+
go install ./...
812

13+
# Run test coverage on each subdirectories and merge the coverage profile.
914
echo "mode: count" > profile.cov
1015

1116
# Standard go tooling behavior is to ignore dirs with leading underscors
1217
for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d);
1318
do
1419
if ls $dir/*.go &> /dev/null; then
1520
# echo $dir
16-
if [[ $dir != "./tests/vm" ]]
21+
if [[ $dir != "./tests/vm" && $dir != "." ]]
1722
then
1823
go test -covermode=count -coverprofile=$dir/profile.tmp $dir
1924
fi

state/state_test.go

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package state
22

33
import (
4+
"math/big"
5+
46
checker "gopkg.in/check.v1"
57

68
"github.com/ethereum/go-ethereum/ethdb"
@@ -16,11 +18,42 @@ var _ = checker.Suite(&StateSuite{})
1618
// var ZeroHash256 = make([]byte, 32)
1719

1820
func (s *StateSuite) TestDump(c *checker.C) {
19-
key := []byte{0x01}
20-
value := []byte("foo")
21-
s.state.trie.Update(key, value)
22-
dump := s.state.Dump()
23-
c.Assert(dump, checker.NotNil)
21+
// generate a few entries
22+
obj1 := s.state.GetOrNewStateObject([]byte{0x01})
23+
obj1.AddBalance(big.NewInt(22))
24+
obj2 := s.state.GetOrNewStateObject([]byte{0x01, 0x02})
25+
obj2.SetCode([]byte{3, 3, 3, 3, 3, 3, 3})
26+
obj3 := s.state.GetOrNewStateObject([]byte{0x02})
27+
obj3.SetBalance(big.NewInt(44))
28+
29+
// write some of them to the trie
30+
s.state.UpdateStateObject(obj1)
31+
s.state.UpdateStateObject(obj2)
32+
33+
// check that dump contains the state objects that are in trie
34+
got := string(s.state.Dump())
35+
want := `{
36+
"root": "4e3a59299745ba6752247c8b91d0f716dac9ec235861c91f5ac1894a361d87ba",
37+
"accounts": {
38+
"0000000000000000000000000000000000000001": {
39+
"balance": "22",
40+
"nonce": 0,
41+
"root": "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
42+
"codeHash": "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
43+
"storage": {}
44+
},
45+
"0000000000000000000000000000000000000102": {
46+
"balance": "0",
47+
"nonce": 0,
48+
"root": "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
49+
"codeHash": "87874902497a5bb968da31a2998d8f22e949d1ef6214bcdedd8bae24cca4b9e3",
50+
"storage": {}
51+
}
52+
}
53+
}`
54+
if got != want {
55+
c.Errorf("dump mismatch:\ngot: %s\nwant: %s\n", got, want)
56+
}
2457
}
2558

2659
func (s *StateSuite) SetUpTest(c *checker.C) {

tests/vm/nowarn.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// This silences the warning given by 'go install ./...'.
2+
3+
package vm

update-license.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// +build none
2+
23
/*
34
This command generates GPL license headers on top of all source files.
45
You can run it once per month, before cutting a release or just

0 commit comments

Comments
 (0)