Skip to content

Commit e821003

Browse files
committed
Fix paths
1 parent a67a155 commit e821003

4 files changed

Lines changed: 61 additions & 45 deletions

File tree

‎tests/block_test.go‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,49 @@
11
package tests
22

33
import (
4+
"path/filepath"
45
"testing"
56
)
67

8+
var baseDir = filepath.Join(".", "files")
9+
var blockTestDir = filepath.Join(baseDir, "BlockTests")
10+
711
// TODO: refactor test setup & execution to better align with vm and tx tests
812
func TestBcValidBlockTests(t *testing.T) {
913
// SimpleTx3 genesis block does not validate against calculated state root
1014
// as of 2015-06-09. unskip once working /Gustav
11-
runBlockTestsInFile("files/BlockTests/bcValidBlockTest.json", []string{"SimpleTx3"}, t)
15+
runBlockTestsInFile(filepath.Join(blockTestDir, "bcValidBlockTest.json"), []string{"SimpleTx3"}, t)
1216
}
1317

1418
func TestBcUncleTests(t *testing.T) {
15-
runBlockTestsInFile("files/BlockTests/bcUncleTest.json", []string{}, t)
16-
runBlockTestsInFile("files/BlockTests/bcBruncleTest.json", []string{}, t)
19+
runBlockTestsInFile(filepath.Join(blockTestDir, "bcUncleTest.json"), []string{}, t)
20+
runBlockTestsInFile(filepath.Join(blockTestDir, "bcBruncleTest.json"), []string{}, t)
1721
}
1822

1923
func TestBcUncleHeaderValidityTests(t *testing.T) {
20-
runBlockTestsInFile("files/BlockTests/bcUncleHeaderValiditiy.json", []string{}, t)
24+
runBlockTestsInFile(filepath.Join(blockTestDir, "bcUncleHeaderValiditiy.json"), []string{}, t)
2125
}
2226

2327
func TestBcInvalidHeaderTests(t *testing.T) {
24-
runBlockTestsInFile("files/BlockTests/bcInvalidHeaderTest.json", []string{}, t)
28+
runBlockTestsInFile(filepath.Join(blockTestDir, "bcInvalidHeaderTest.json"), []string{}, t)
2529
}
2630

2731
func TestBcInvalidRLPTests(t *testing.T) {
28-
runBlockTestsInFile("files/BlockTests/bcInvalidRLPTest.json", []string{}, t)
32+
runBlockTestsInFile(filepath.Join(blockTestDir, "bcInvalidRLPTest.json"), []string{}, t)
2933
}
3034

3135
func TestBcRPCAPITests(t *testing.T) {
32-
runBlockTestsInFile("files/BlockTests/bcRPC_API_Test.json", []string{}, t)
36+
runBlockTestsInFile(filepath.Join(blockTestDir, "bcRPC_API_Test.json"), []string{}, t)
3337
}
3438

3539
func TestBcForkBlockTests(t *testing.T) {
36-
runBlockTestsInFile("files/BlockTests/bcForkBlockTest.json", []string{}, t)
40+
runBlockTestsInFile(filepath.Join(blockTestDir, "bcForkBlockTest.json"), []string{}, t)
3741
}
3842

3943
func TestBcTotalDifficulty(t *testing.T) {
40-
runBlockTestsInFile("files/BlockTests/bcTotalDifficultyTest.json", []string{}, t)
44+
runBlockTestsInFile(filepath.Join(blockTestDir, "bcTotalDifficultyTest.json"), []string{}, t)
4145
}
4246

4347
func TestBcWallet(t *testing.T) {
44-
runBlockTestsInFile("files/BlockTests/bcWalletTest.json", []string{}, t)
48+
runBlockTestsInFile(filepath.Join(blockTestDir, "bcWalletTest.json"), []string{}, t)
4549
}

‎tests/state_test.go‎

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,101 @@
11
package tests
22

3-
import "testing"
3+
import (
4+
"os"
5+
"path/filepath"
6+
"testing"
7+
)
8+
9+
var stateTestDir = filepath.Join(baseDir, "StateTests")
410

511
func TestStateSystemOperations(t *testing.T) {
6-
const fn = "../files/StateTests/stSystemOperationsTest.json"
12+
fn := filepath.Join(stateTestDir, "stSystemOperationsTest.json")
713
RunVmTest(fn, t)
814
}
915

1016
func TestStateExample(t *testing.T) {
11-
const fn = "../files/StateTests/stExample.json"
17+
fn := filepath.Join(stateTestDir, "stExample.json")
1218
RunVmTest(fn, t)
1319
}
1420

1521
func TestStatePreCompiledContracts(t *testing.T) {
16-
const fn = "../files/StateTests/stPreCompiledContracts.json"
22+
fn := filepath.Join(stateTestDir, "stPreCompiledContracts.json")
1723
RunVmTest(fn, t)
1824
}
1925

2026
func TestStateRecursiveCreate(t *testing.T) {
21-
const fn = "../files/StateTests/stRecursiveCreate.json"
27+
fn := filepath.Join(stateTestDir, "stRecursiveCreate.json")
2228
RunVmTest(fn, t)
2329
}
2430

2531
func TestStateSpecial(t *testing.T) {
26-
const fn = "../files/StateTests/stSpecialTest.json"
32+
fn := filepath.Join(stateTestDir, "stSpecialTest.json")
2733
RunVmTest(fn, t)
2834
}
2935

3036
func TestStateRefund(t *testing.T) {
31-
const fn = "../files/StateTests/stRefundTest.json"
37+
fn := filepath.Join(stateTestDir, "stRefundTest.json")
3238
RunVmTest(fn, t)
3339
}
3440

3541
func TestStateBlockHash(t *testing.T) {
36-
const fn = "../files/StateTests/stBlockHashTest.json"
42+
fn := filepath.Join(stateTestDir, "stBlockHashTest.json")
3743
RunVmTest(fn, t)
3844
}
3945

4046
func TestStateInitCode(t *testing.T) {
41-
const fn = "../files/StateTests/stInitCodeTest.json"
47+
fn := filepath.Join(stateTestDir, "stInitCodeTest.json")
4248
RunVmTest(fn, t)
4349
}
4450

4551
func TestStateLog(t *testing.T) {
46-
const fn = "../files/StateTests/stLogTests.json"
52+
fn := filepath.Join(stateTestDir, "stLogTests.json")
4753
RunVmTest(fn, t)
4854
}
4955

5056
func TestStateTransaction(t *testing.T) {
51-
const fn = "../files/StateTests/stTransactionTest.json"
57+
fn := filepath.Join(stateTestDir, "stTransactionTest.json")
5258
RunVmTest(fn, t)
5359
}
5460

5561
func TestCallCreateCallCode(t *testing.T) {
56-
const fn = "../files/StateTests/stCallCreateCallCodeTest.json"
62+
fn := filepath.Join(stateTestDir, "stCallCreateCallCodeTest.json")
5763
RunVmTest(fn, t)
5864
}
5965

6066
func TestMemory(t *testing.T) {
61-
const fn = "../files/StateTests/stMemoryTest.json"
67+
fn := filepath.Join(stateTestDir, "stMemoryTest.json")
6268
RunVmTest(fn, t)
6369
}
6470

6571
func TestMemoryStress(t *testing.T) {
6672
if os.Getenv("TEST_VM_COMPLEX") == "" {
6773
t.Skip()
6874
}
69-
const fn = "../files/StateTests/stMemoryStressTest.json"
75+
fn := filepath.Join(stateTestDir, "stMemoryStressTest.json")
7076
RunVmTest(fn, t)
7177
}
7278

7379
func TestQuadraticComplexity(t *testing.T) {
7480
if os.Getenv("TEST_VM_COMPLEX") == "" {
7581
t.Skip()
7682
}
77-
const fn = "../files/StateTests/stQuadraticComplexityTest.json"
83+
fn := filepath.Join(stateTestDir, "stQuadraticComplexityTest.json")
7884
RunVmTest(fn, t)
7985
}
8086

8187
func TestSolidity(t *testing.T) {
82-
const fn = "../files/StateTests/stSolidityTest.json"
88+
fn := filepath.Join(stateTestDir, "stSolidityTest.json")
8389
RunVmTest(fn, t)
8490
}
8591

8692
func TestWallet(t *testing.T) {
87-
const fn = "../files/StateTests/stWalletTest.json"
93+
fn := filepath.Join(stateTestDir, "stWalletTest.json")
8894
RunVmTest(fn, t)
8995
}
9096

9197
func TestStateTestsRandom(t *testing.T) {
92-
fns, _ := filepath.Glob("../files/StateTests/RandomTests/*")
98+
fns, _ := filepath.Glob("./files/StateTests/RandomTests/*")
9399
for _, fn := range fns {
94100
RunVmTest(fn, t)
95101
}

‎tests/transaction_test.go‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package tests
22

33
import (
4+
"path/filepath"
45
"testing"
56
)
67

8+
var transactionTestDir = filepath.Join(baseDir, "TransactionTests")
9+
710
func TestTransactions(t *testing.T) {
811
notWorking := make(map[string]bool, 100)
912

@@ -17,7 +20,7 @@ func TestTransactions(t *testing.T) {
1720
}
1821

1922
var err error
20-
err = RunTransactionTests("./files/TransactionTests/ttTransactionTest.json",
23+
err = RunTransactionTests(filepath.Join(transactionTestDir, "ttTransactionTest.json"),
2124
notWorking)
2225
if err != nil {
2326
t.Fatal(err)
@@ -27,7 +30,7 @@ func TestTransactions(t *testing.T) {
2730
func TestWrongRLPTransactions(t *testing.T) {
2831
notWorking := make(map[string]bool, 100)
2932
var err error
30-
err = RunTransactionTests("./files/TransactionTests/ttWrongRLPTransaction.json",
33+
err = RunTransactionTests(filepath.Join(transactionTestDir, "ttWrongRLPTransaction.json"),
3134
notWorking)
3235
if err != nil {
3336
t.Fatal(err)
@@ -37,7 +40,7 @@ func TestWrongRLPTransactions(t *testing.T) {
3740
func Test10MBtx(t *testing.T) {
3841
notWorking := make(map[string]bool, 100)
3942
var err error
40-
err = RunTransactionTests("./files/TransactionTests/tt10mbDataField.json",
43+
err = RunTransactionTests(filepath.Join(transactionTestDir, "tt10mbDataField.json"),
4144
notWorking)
4245
if err != nil {
4346
t.Fatal(err)

‎tests/vm_test.go‎

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,80 @@
11
package tests
22

33
import (
4+
"path/filepath"
45
"testing"
56
)
67

8+
var vmTestDir = filepath.Join(baseDir, "VMTests")
9+
710
// I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail.
811
func TestVMArithmetic(t *testing.T) {
9-
const fn = "../files/VMTests/vmArithmeticTest.json"
12+
fn := filepath.Join(vmTestDir, "vmArithmeticTest.json")
1013
RunVmTest(fn, t)
1114
}
1215

1316
func TestBitwiseLogicOperation(t *testing.T) {
14-
const fn = "../files/VMTests/vmBitwiseLogicOperationTest.json"
17+
fn := filepath.Join(vmTestDir, "vmBitwiseLogicOperationTest.json")
1518
RunVmTest(fn, t)
1619
}
1720

1821
func TestBlockInfo(t *testing.T) {
19-
const fn = "../files/VMTests/vmBlockInfoTest.json"
22+
fn := filepath.Join(vmTestDir, "vmBlockInfoTest.json")
2023
RunVmTest(fn, t)
2124
}
2225

2326
func TestEnvironmentalInfo(t *testing.T) {
24-
const fn = "../files/VMTests/vmEnvironmentalInfoTest.json"
27+
fn := filepath.Join(vmTestDir, "vmEnvironmentalInfoTest.json")
2528
RunVmTest(fn, t)
2629
}
2730

2831
func TestFlowOperation(t *testing.T) {
29-
const fn = "../files/VMTests/vmIOandFlowOperationsTest.json"
32+
fn := filepath.Join(vmTestDir, "vmIOandFlowOperationsTest.json")
3033
RunVmTest(fn, t)
3134
}
3235

3336
func TestLogTest(t *testing.T) {
34-
const fn = "../files/VMTests/vmLogTest.json"
37+
fn := filepath.Join(vmTestDir, "vmLogTest.json")
3538
RunVmTest(fn, t)
3639
}
3740

3841
func TestPerformance(t *testing.T) {
39-
const fn = "../files/VMTests/vmPerformanceTest.json"
42+
fn := filepath.Join(vmTestDir, "vmPerformanceTest.json")
4043
RunVmTest(fn, t)
4144
}
4245

4346
func TestPushDupSwap(t *testing.T) {
44-
const fn = "../files/VMTests/vmPushDupSwapTest.json"
47+
fn := filepath.Join(vmTestDir, "vmPushDupSwapTest.json")
4548
RunVmTest(fn, t)
4649
}
4750

4851
func TestVMSha3(t *testing.T) {
49-
const fn = "../files/VMTests/vmSha3Test.json"
52+
fn := filepath.Join(vmTestDir, "vmSha3Test.json")
5053
RunVmTest(fn, t)
5154
}
5255

5356
func TestVm(t *testing.T) {
54-
const fn = "../files/VMTests/vmtests.json"
57+
fn := filepath.Join(vmTestDir, "vmtests.json")
5558
RunVmTest(fn, t)
5659
}
5760

5861
func TestVmLog(t *testing.T) {
59-
const fn = "../files/VMTests/vmLogTest.json"
62+
fn := filepath.Join(vmTestDir, "vmLogTest.json")
6063
RunVmTest(fn, t)
6164
}
6265

6366
func TestInputLimits(t *testing.T) {
64-
const fn = "../files/VMTests/vmInputLimits.json"
67+
fn := filepath.Join(vmTestDir, "vmInputLimits.json")
6568
RunVmTest(fn, t)
6669
}
6770

6871
func TestInputLimitsLight(t *testing.T) {
69-
const fn = "../files/VMTests/vmInputLimitsLight.json"
72+
fn := filepath.Join(vmTestDir, "vmInputLimitsLight.json")
7073
RunVmTest(fn, t)
7174
}
7275

7376
func TestVMRandom(t *testing.T) {
74-
fns, _ := filepath.Glob("../files/VMTests/RandomTests/*")
77+
fns, _ := filepath.Glob(filepath.Join(baseDir, "RandomTests", "*"))
7578
for _, fn := range fns {
7679
RunVmTest(fn, t)
7780
}

0 commit comments

Comments
 (0)