Skip to content

Commit 70a5532

Browse files
authored
add test partitioning based on partition test verifier output (#3859)
1 parent 0146fff commit 70a5532

File tree

11 files changed

+40
-7
lines changed

11 files changed

+40
-7
lines changed

crypto/secp256k1/secp256_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ func compactSigCheck(t *testing.T, sig []byte) {
6363
}
6464

6565
func TestSignatureValidity(t *testing.T) {
66+
partitiontest.PartitionTest(t)
67+
6668
pubkey, seckey := generateKeyPair()
6769
msg := csprngEntropy(32)
6870
sig, err := Sign(msg, seckey)

data/transactions/logic/assembler_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,6 +2381,7 @@ func TestUncoverAsm(t *testing.T) {
23812381
}
23822382

23832383
func TestTxTypes(t *testing.T) {
2384+
partitiontest.PartitionTest(t)
23842385
testProg(t, "itxn_begin; itxn_field Sender", 5, Expect{2, "itxn_field Sender expects 1 stack argument..."})
23852386
testProg(t, "itxn_begin; int 1; itxn_field Sender", 5, Expect{3, "...wanted type []byte got uint64"})
23862387
testProg(t, "itxn_begin; byte 0x56127823; itxn_field Sender", 5)

data/transactions/logic/evalCrypto_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,8 @@ ecdsa_verify Secp256r1`, hex.EncodeToString(r), hex.EncodeToString(s), hex.Encod
480480

481481
// test compatibility with ethereum signatures
482482
func TestEcdsaEthAddress(t *testing.T) {
483+
partitiontest.PartitionTest(t)
484+
483485
/*
484486
pip install eth-keys pycryptodome
485487
from eth_keys import keys
@@ -507,6 +509,8 @@ byte 0x5ce9454909639d2d17a3f753ce7d93fa0b9ab12e // addr
507509
}
508510

509511
func TestEcdsaCostVariation(t *testing.T) {
512+
partitiontest.PartitionTest(t)
513+
510514
// Doesn't matter if it passes or fails. Just confirm the cost depends on curve.
511515
source := `
512516
global ZeroAddress // need 32 bytes

data/transactions/logic/evalStateful_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,6 +2577,8 @@ func appAddr(id int) basics.Address {
25772577
}
25782578

25792579
func TestAppInfo(t *testing.T) {
2580+
partitiontest.PartitionTest(t)
2581+
25802582
ep, tx, ledger := makeSampleEnv()
25812583
require.Equal(t, 888, int(tx.ApplicationID))
25822584
ledger.NewApp(tx.Receiver, 888, basics.AppParams{})
@@ -2595,6 +2597,8 @@ func TestAppInfo(t *testing.T) {
25952597
}
25962598

25972599
func TestBudget(t *testing.T) {
2600+
partitiontest.PartitionTest(t)
2601+
25982602
ep := defaultEvalParams(nil)
25992603
source := `
26002604
global OpcodeBudget
@@ -2609,6 +2613,8 @@ int 695
26092613
}
26102614

26112615
func TestSelfMutate(t *testing.T) {
2616+
partitiontest.PartitionTest(t)
2617+
26122618
ep, _, ledger := makeSampleEnv()
26132619

26142620
/* In order to test the added protection of mutableAccountReference, we're

data/transactions/logic/eval_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,8 @@ int 1
697697
}
698698

699699
func TestMulDiv(t *testing.T) {
700+
partitiontest.PartitionTest(t)
701+
700702
// Demonstrate a "function" that expects three u64s on stack,
701703
// and calculates B*C/A. (Following opcode documentation
702704
// convention, C is top-of-stack, B is below it, and A is

data/transactions/logic/opcodes_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,15 @@ func TestOpcodesByVersionReordered(t *testing.T) {
7777
OpSpecs[1] = OpSpecs[4]
7878
OpSpecs[4] = tmp
7979

80-
t.Run("TestOpcodesByVersion", TestOpcodesByVersion)
80+
t.Run("TestOpcodesByVersion", testOpcodesByVersion)
8181
}
8282

8383
func TestOpcodesByVersion(t *testing.T) {
84-
// partitiontest.PartitionTest(t)
85-
// has partitioning in the TestOpcodesByVersionReordered()
84+
partitiontest.PartitionTest(t)
85+
testOpcodesByVersion(t)
86+
}
8687

88+
func testOpcodesByVersion(t *testing.T) {
8789
// Make a copy of the OpSpecs to check if OpcodesByVersion will change it
8890
OpSpecs2 := make([]OpSpec, len(OpSpecs))
8991
for idx, opspec := range OpSpecs {

ledger/internal/eval_blackbox_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,21 +422,21 @@ ok:
422422
return eval, addrs[0], err
423423
}
424424

425-
// TestEvalAppStateCountsWithTxnGroup ensures txns in a group can't violate app state schema limits
425+
// TestEvalAppStateCountsWithTxnGroupBlackbox ensures txns in a group can't violate app state schema limits
426426
// the test ensures that
427427
// commitToParent -> applyChild copies child's cow state usage counts into parent
428428
// and the usage counts correctly propagated from parent cow to child cow and back
429-
func TestEvalAppStateCountsWithTxnGroup(t *testing.T) {
429+
func TestEvalAppStateCountsWithTxnGroupBlackbox(t *testing.T) {
430430
partitiontest.PartitionTest(t)
431431

432432
_, _, err := testEvalAppGroup(t, basics.StateSchema{NumByteSlice: 1})
433433
require.Error(t, err)
434434
require.Contains(t, err.Error(), "store bytes count 2 exceeds schema bytes count 1")
435435
}
436436

437-
// TestEvalAppAllocStateWithTxnGroup ensures roundCowState.deltas and applyStorageDelta
437+
// TestEvalAppAllocStateWithTxnGroupBlackbox ensures roundCowState.deltas and applyStorageDelta
438438
// produce correct results when a txn group has storage allocate and storage update actions
439-
func TestEvalAppAllocStateWithTxnGroup(t *testing.T) {
439+
func TestEvalAppAllocStateWithTxnGroupBlackbox(t *testing.T) {
440440
partitiontest.PartitionTest(t)
441441

442442
eval, addr, err := testEvalAppGroup(t, basics.StateSchema{NumByteSlice: 2})

test/e2e-go/cli/goal/account_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ import (
2222
"github.com/stretchr/testify/require"
2323

2424
"github.com/algorand/go-algorand/test/framework/fixtures"
25+
"github.com/algorand/go-algorand/test/partitiontest"
2526
)
2627

2728
const statusOffline = "[offline]"
2829
const statusOnline = "[online]"
2930

3031
func TestAccountNew(t *testing.T) {
32+
partitiontest.PartitionTest(t)
33+
3134
defer fixtures.ShutdownSynchronizedTest(t)
3235
defer fixture.SetTestContext(t)()
3336
a := require.New(fixtures.SynchronizedTest(t))
@@ -54,6 +57,8 @@ func TestAccountNew(t *testing.T) {
5457
}
5558

5659
func TestAccountNewDuplicateFails(t *testing.T) {
60+
partitiontest.PartitionTest(t)
61+
5762
defer fixtures.ShutdownSynchronizedTest(t)
5863
defer fixture.SetTestContext(t)()
5964
a := require.New(fixtures.SynchronizedTest(t))
@@ -70,6 +75,8 @@ func TestAccountNewDuplicateFails(t *testing.T) {
7075
}
7176

7277
func TestAccountRename(t *testing.T) {
78+
partitiontest.PartitionTest(t)
79+
7380
defer fixtures.ShutdownSynchronizedTest(t)
7481
defer fixture.SetTestContext(t)()
7582
a := require.New(fixtures.SynchronizedTest(t))
@@ -101,6 +108,8 @@ func TestAccountRename(t *testing.T) {
101108

102109
// Importing an account multiple times should not be considered an error by goal
103110
func TestAccountMultipleImportRootKey(t *testing.T) {
111+
partitiontest.PartitionTest(t)
112+
104113
defer fixtures.ShutdownSynchronizedTest(t)
105114
defer fixture.SetTestContext(t)()
106115
a := require.New(fixtures.SynchronizedTest(t))

test/e2e-go/cli/goal/clerk_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ import (
2424
"github.com/stretchr/testify/require"
2525

2626
"github.com/algorand/go-algorand/test/framework/fixtures"
27+
"github.com/algorand/go-algorand/test/partitiontest"
2728
)
2829

2930
func TestClerkSendNoteEncoding(t *testing.T) {
31+
partitiontest.PartitionTest(t)
32+
3033
defer fixtures.ShutdownSynchronizedTest(t)
3134
defer fixture.SetTestContext(t)()
3235
a := require.New(fixtures.SynchronizedTest(t))

test/e2e-go/cli/goal/node_cleanup_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ import (
2323

2424
"github.com/algorand/go-algorand/nodecontrol"
2525
"github.com/algorand/go-algorand/test/framework/fixtures"
26+
"github.com/algorand/go-algorand/test/partitiontest"
2627
)
2728

2829
func TestGoalNodeCleanup(t *testing.T) {
30+
partitiontest.PartitionTest(t)
31+
2932
defer fixtures.ShutdownSynchronizedTest(t)
3033
defer fixture.SetTestContext(t)()
3134

0 commit comments

Comments
 (0)