mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-14 07:53:47 +00:00
accounts/keystore, consensus/ethash: fix tests when submodule is missing
This commit is contained in:
parent
9af60fa075
commit
79adb97327
3 changed files with 21 additions and 6 deletions
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
@ -140,21 +141,32 @@ func TestV3_PBKDF2_1(t *testing.T) {
|
||||||
testDecryptV3(tests["wikipage_test_vector_pbkdf2"], t)
|
testDecryptV3(tests["wikipage_test_vector_pbkdf2"], t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var testsSubmodule = filepath.Join("..", "..", "tests", "testdata", "KeyStoreTests")
|
||||||
|
|
||||||
|
func skipIfSubmoduleMissing(t *testing.T) {
|
||||||
|
if !common.FileExist(testsSubmodule) {
|
||||||
|
t.Skipf("can't find JSON tests from submodule at %s", testsSubmodule)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestV3_PBKDF2_2(t *testing.T) {
|
func TestV3_PBKDF2_2(t *testing.T) {
|
||||||
|
skipIfSubmoduleMissing(t)
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
tests := loadKeyStoreTestV3("../../tests/testdata/KeyStoreTests/basic_tests.json", t)
|
tests := loadKeyStoreTestV3(filepath.Join(testsSubmodule, "basic_tests.json"), t)
|
||||||
testDecryptV3(tests["test1"], t)
|
testDecryptV3(tests["test1"], t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestV3_PBKDF2_3(t *testing.T) {
|
func TestV3_PBKDF2_3(t *testing.T) {
|
||||||
|
skipIfSubmoduleMissing(t)
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
tests := loadKeyStoreTestV3("../../tests/testdata/KeyStoreTests/basic_tests.json", t)
|
tests := loadKeyStoreTestV3(filepath.Join(testsSubmodule, "basic_tests.json"), t)
|
||||||
testDecryptV3(tests["python_generated_test_with_odd_iv"], t)
|
testDecryptV3(tests["python_generated_test_with_odd_iv"], t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestV3_PBKDF2_4(t *testing.T) {
|
func TestV3_PBKDF2_4(t *testing.T) {
|
||||||
|
skipIfSubmoduleMissing(t)
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
tests := loadKeyStoreTestV3("../../tests/testdata/KeyStoreTests/basic_tests.json", t)
|
tests := loadKeyStoreTestV3(filepath.Join(testsSubmodule, "basic_tests.json"), t)
|
||||||
testDecryptV3(tests["evilnonce"], t)
|
testDecryptV3(tests["evilnonce"], t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -165,8 +177,9 @@ func TestV3_Scrypt_1(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestV3_Scrypt_2(t *testing.T) {
|
func TestV3_Scrypt_2(t *testing.T) {
|
||||||
|
skipIfSubmoduleMissing(t)
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
tests := loadKeyStoreTestV3("../../tests/testdata/KeyStoreTests/basic_tests.json", t)
|
tests := loadKeyStoreTestV3(filepath.Join(testsSubmodule, "basic_tests.json"), t)
|
||||||
testDecryptV3(tests["test2"], t)
|
testDecryptV3(tests["test2"], t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ environment:
|
||||||
PATH: C:\msys64\mingw32\bin\;C:\Program Files (x86)\NSIS\;%PATH%
|
PATH: C:\msys64\mingw32\bin\;C:\Program Files (x86)\NSIS\;%PATH%
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
- git submodule update --init
|
||||||
- rmdir C:\go /s /q
|
- rmdir C:\go /s /q
|
||||||
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.8.3.windows-%GETH_ARCH%.zip
|
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.8.3.windows-%GETH_ARCH%.zip
|
||||||
- 7z x go1.8.3.windows-%GETH_ARCH%.zip -y -oC:\ > NUL
|
- 7z x go1.8.3.windows-%GETH_ARCH%.zip -y -oC:\ > NUL
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common/math"
|
"github.com/ethereum/go-ethereum/common/math"
|
||||||
|
|
@ -57,9 +58,9 @@ func (d *diffTest) UnmarshalJSON(b []byte) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCalcDifficulty(t *testing.T) {
|
func TestCalcDifficulty(t *testing.T) {
|
||||||
file, err := os.Open("../../tests/testdata/BasicTests/difficulty.json")
|
file, err := os.Open(filepath.Join("..", "..", "tests", "testdata", "BasicTests", "difficulty.json"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Skip(err)
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue