Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ issues:
- staticcheck
- typecheck
# Ignore missing parallel tests in existing packages
- path: (agreement|catchup|cmd|config|crypto|daemon|data|gen|ledger|logging|netdeploy|network|node|protocol|rpcs|shared|stateproof|test|tools|util).*_test.go
- path: (agreement|catchup|cmd|config|crypto|daemon|data|gen|ledger|logging|netdeploy|network|node|protocol|rpcs|shared|stateproof|test|tools|util).*_test\.go
linters:
- paralleltest
# Add all linters here -- Comment this block out for testing linters
Expand Down
2 changes: 2 additions & 0 deletions data/transactions/logic/assembler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1623,10 +1623,12 @@ func TestAssembleDisassembleCycle(t *testing.T) {
// catch any suprises.
require.LessOrEqual(t, LogicVersion, len(nonsense)) // Allow nonsense for future versions
for v, source := range nonsense {
v, source := v, source
if v > LogicVersion {
continue // We allow them to be set, but can't test assembly beyond LogicVersion
}
t.Run(fmt.Sprintf("v=%d", v), func(t *testing.T) {
t.Parallel()
ops := testProg(t, source, v)
t2, err := Disassemble(ops.Program)
require.NoError(t, err)
Expand Down
6 changes: 6 additions & 0 deletions data/transactions/logic/backwardCompat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,26 +467,32 @@ func TestBackwardCompatAssemble(t *testing.T) {
source := "int 1; int 1; bnz done; done:"

t.Run("v=default", func(t *testing.T) {
t.Parallel()
testProg(t, source, assemblerNoVersion, Expect{1, "label \"done\" is too far away"})
})

t.Run("v=default", func(t *testing.T) {
t.Parallel()
testProg(t, source, 0, Expect{1, "label \"done\" is too far away"})
})

t.Run("v=default", func(t *testing.T) {
t.Parallel()
testProg(t, source, 1, Expect{1, "label \"done\" is too far away"})
})

for v := uint64(2); v <= AssemblerMaxVersion; v++ {
v := v
t.Run(fmt.Sprintf("v=%d", v), func(t *testing.T) {
t.Parallel()
testLogic(t, source, v, defaultEvalParams())
})
}
}

func TestExplicitConstants(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

require.Equal(t, 4096, maxStringSize, "constant changed, make it version dependent")
require.Equal(t, 64, maxByteMathSize, "constant changed, move it version dependent")
Expand Down
4 changes: 4 additions & 0 deletions data/transactions/logic/blackbox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (

func TestNewAppEvalParams(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

params := []config.ConsensusParams{
{Application: true, MaxAppProgramCost: 700},
Expand Down Expand Up @@ -78,8 +79,11 @@ func TestNewAppEvalParams(t *testing.T) {
}

for i, param := range params {
param := param
for j, testCase := range cases {
i, j, param, testCase := i, j, param, testCase
t.Run(fmt.Sprintf("i=%d,j=%d", i, j), func(t *testing.T) {
t.Parallel()
ep := logic.NewEvalParams(testCase.group, &param, nil)
require.NotNil(t, ep)
require.Equal(t, ep.TxnGroup, testCase.group)
Expand Down
20 changes: 15 additions & 5 deletions data/transactions/logic/box_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ func TestBoxNewDel(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

ep, txn, ledger := logic.MakeSampleEnv()

for _, size := range []int{24, 0} {
size := size
t.Run(fmt.Sprintf("box size=%d", size), func(t *testing.T) {
t.Parallel()

ep, txn, ledger := logic.MakeSampleEnv()

createSelf := fmt.Sprintf(`byte "self"; int %d; box_create;`, size)
createOther := fmt.Sprintf(`byte "other"; int %d; box_create;`, size)

Expand Down Expand Up @@ -218,7 +221,9 @@ func TestBoxUnavailableWithClearState(t *testing.T) {
}

for name, program := range tests {
name, program := name, program
t.Run(name, func(t *testing.T) {
t.Parallel()
ep, _, l := logic.MakeSampleEnv()
l.NewApp(basics.Address{}, 888, basics.AppParams{})
ep.TxnGroup[0].Txn.OnCompletion = transactions.ClearStateOC
Expand Down Expand Up @@ -521,18 +526,23 @@ func TestEarlyPanics(t *testing.T) {
"box_replace": `byte "%s"; int 0; byte "new"; box_replace`,
}

ep, _, l := logic.MakeSampleEnv()
l.NewApp(basics.Address{}, 888, basics.AppParams{})

for name, program := range tests {
name, program := name, program
t.Run(name+"/zero", func(t *testing.T) {
t.Parallel()
ep, _, l := logic.MakeSampleEnv()
l.NewApp(basics.Address{}, 888, basics.AppParams{})
logic.TestApp(t, fmt.Sprintf(program, ""), ep, "zero length")
})
}

big := strings.Repeat("x", 65)
for name, program := range tests {
name, program := name, program
t.Run(name+"/long", func(t *testing.T) {
t.Parallel()
ep, _, l := logic.MakeSampleEnv()
l.NewApp(basics.Address{}, 888, basics.AppParams{})
logic.TestApp(t, fmt.Sprintf(program, big), ep, "name too long")
})
}
Expand Down
6 changes: 6 additions & 0 deletions data/transactions/logic/debugger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ bytec 4

func TestWebDebuggerManual(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

debugURL := os.Getenv("TEAL_DEBUGGER_URL")
if len(debugURL) == 0 {
Expand Down Expand Up @@ -111,6 +112,7 @@ func (d *testDbgHook) Complete(state *DebugState) error {

func TestDebuggerHook(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

testDbg := testDbgHook{}
ep := defaultEvalParams()
Expand All @@ -125,6 +127,7 @@ func TestDebuggerHook(t *testing.T) {

func TestLineToPC(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

dState := DebugState{
Disassembly: "abc\ndef\nghi",
Expand Down Expand Up @@ -162,6 +165,7 @@ func TestLineToPC(t *testing.T) {

func TestValueDeltaToValueDelta(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

vDelta := basics.ValueDelta{
Action: basics.SetUintAction,
Expand All @@ -186,6 +190,7 @@ intc_0

func TestParseCallstack(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

expectedCallFrames := []CallFrame{
{
Expand All @@ -210,6 +215,7 @@ func TestParseCallstack(t *testing.T) {

func TestCallStackUpdate(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

expectedCallFrames := []CallFrame{
{
Expand Down
9 changes: 9 additions & 0 deletions data/transactions/logic/doc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (

func TestOpDocs(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

opsSeen := make(map[string]bool, len(OpSpecs))
for _, op := range OpSpecs {
Expand All @@ -50,6 +51,7 @@ func TestOpDocs(t *testing.T) {
// around for non-existent opcodes, most likely from a rename.
func TestDocStragglers(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

for op := range opDocExtras {
_, ok := opDocByName[op]
Expand All @@ -63,6 +65,7 @@ func TestDocStragglers(t *testing.T) {

func TestOpGroupCoverage(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

opsSeen := make(map[string]bool, len(OpSpecs))
for _, op := range OpSpecs {
Expand All @@ -87,6 +90,7 @@ func TestOpGroupCoverage(t *testing.T) {

func TestOpDoc(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

xd := OpDoc("txn")
require.NotEmpty(t, xd)
Expand All @@ -96,6 +100,7 @@ func TestOpDoc(t *testing.T) {

func TestOpImmediateNote(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

xd := OpImmediateNote("txn")
require.NotEmpty(t, xd)
Expand All @@ -105,6 +110,7 @@ func TestOpImmediateNote(t *testing.T) {

func TestAllImmediatesDocumented(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

for _, op := range OpSpecs {
count := len(op.Immediates)
Expand Down Expand Up @@ -135,6 +141,7 @@ func TestAllImmediatesDocumented(t *testing.T) {

func TestOpDocExtra(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

xd := OpDocExtra("bnz")
require.NotEmpty(t, xd)
Expand All @@ -144,6 +151,7 @@ func TestOpDocExtra(t *testing.T) {

func TestOpAllCosts(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

a := OpAllCosts("+")
require.Len(t, a, 1)
Expand All @@ -158,6 +166,7 @@ func TestOpAllCosts(t *testing.T) {

func TestOnCompletionDescription(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

desc := OnCompletionDescription(0)
require.Equal(t, "Only execute the `ApprovalProgram` associated with this application ID, with no additional effects.", desc)
Expand Down
Loading