Skip to content

Commit

Permalink
Merge pull request #16184 from MinaProtocol/dkijania/port_decrease_fu…
Browse files Browse the repository at this point in the history
…zzy_zkapps_to_comp

[comp] split Fuzzy zkapp tests into two: quick and long
  • Loading branch information
dkijania authored Oct 4, 2024
2 parents 5e4cd77 + 0b5792b commit 5a5a547
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 67 deletions.
96 changes: 96 additions & 0 deletions buildkite/src/Command/FuzzyZkappTest.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
let S = ../Lib/SelectFiles.dhall

let Pipeline = ../Pipeline/Dsl.dhall

let PipelineMode = ../Pipeline/Mode.dhall

let PipelineTag = ../Pipeline/Tag.dhall

let JobSpec = ../Pipeline/JobSpec.dhall

let Command = ../Command/Base.dhall

let RunInToolchain = ../Command/RunInToolchain.dhall

let Docker = ../Command/Docker/Type.dhall

let Size = ../Command/Size.dhall

let Profiles = ../Constants/Profiles.dhall

let Spec =
{ Type =
{ profile : Profiles.Type
, test_app_path : Text
, timeout : Natural
, individual_test_timeout : Natural
, cmd_target : Size
, job_path : Text
, job_name : Text
, tags : List PipelineTag.Type
, mode : PipelineMode.Type
, additional_dirty_when : List S.Type
}
, default =
{ profile = Profiles.Type.Dev
, test_app_path =
"src/lib/transaction_snark/test/zkapp_fuzzy/zkapp_fuzzy.exe"
, timeout = 1200
, individual_test_timeout = 300
, cmd_target = Size.Small
, additional_dirty_when = [] : List S.Type
}
}

let buildTestCmd
: Spec.Type -> Command.Type
= \(spec : Spec.Type)
-> let timeout = Natural/show spec.timeout

let individual_test_timeout =
Natural/show spec.individual_test_timeout

let key = "fuzzy-zkapp-unit-test-${Profiles.duneProfile spec.profile}"

in Command.build
Command.Config::{
, commands =
RunInToolchain.runInToolchain
[ "DUNE_INSTRUMENT_WITH=bisect_ppx", "COVERALLS_TOKEN" ]
"buildkite/scripts/fuzzy-zkapp-test.sh ${Profiles.duneProfile
spec.profile} ${spec.test_app_path} ${timeout} ${individual_test_timeout} && buildkite/scripts/upload-partial-coverage-data.sh ${key} dev"
, label = "Fuzzy zkapp unit tests"
, key = key
, target = spec.cmd_target
, docker = None Docker.Type
, artifact_paths = [ S.contains "core_dumps/*" ]
, flake_retry_limit = Some 0
}

let pipeline
: Spec.Type -> Pipeline.Config.Type
= \(spec : Spec.Type)
-> Pipeline.Config::{
, spec =
let unitDirtyWhen =
[ S.strictlyStart (S.contains "src/lib")
, S.strictlyStart
( S.contains
"src/lib/transaction_snark/test/zkapp_fuzzy"
)
, S.exactly "buildkite/src/Command/FuzzyZkappTest" "dhall"
, S.exactly "buildkite/scripts/fuzzy-zkapp-test" "sh"
]
# spec.additional_dirty_when

in JobSpec::{
, dirtyWhen = unitDirtyWhen
, path = spec.job_path
, name = spec.job_name
, tags = spec.tags
, mode = spec.mode
}
, steps = [ buildTestCmd spec ]
}

in { pipeline = pipeline, Spec = Spec }
8 changes: 7 additions & 1 deletion buildkite/src/Constants/Profiles.dhall
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let Profile
: Type
= < Standard | Mainnet | Lightnet | Hardfork >
= < Standard | Mainnet | Lightnet | Hardfork | Dev >

let capitalName =
\(profile : Profile)
Expand All @@ -9,6 +9,7 @@ let capitalName =
, Mainnet = "Mainnet"
, Lightnet = "Lightnet"
, Hardfork = "Hardfork"
, Dev = "Dev"
}
profile

Expand All @@ -19,6 +20,7 @@ let lowerName =
, Mainnet = "mainnet"
, Lightnet = "lightnet"
, Hardfork = "hardfork"
, Dev = "dev"
}
profile

Expand All @@ -29,6 +31,7 @@ let duneProfile =
, Mainnet = "mainnet"
, Lightnet = "lightnet"
, Hardfork = "hardfork"
, Dev = "dev"
}
profile

Expand All @@ -39,6 +42,7 @@ let toSuffixUppercase =
, Mainnet = "Mainnet"
, Lightnet = "Lightnet"
, Hardfork = "Hardfork"
, Dev = "Dev"
}
profile

Expand All @@ -49,6 +53,7 @@ let toSuffixLowercase =
, Mainnet = "mainnet"
, Lightnet = "lightnet"
, Hardfork = "hardfork"
, Dev = "dev"
}
profile

Expand All @@ -59,6 +64,7 @@ let toLabelSegment =
, Mainnet = "-mainnet"
, Lightnet = "-lightnet"
, Hardfork = "-hardfork"
, Dev = "-dev"
}
profile

Expand Down
78 changes: 12 additions & 66 deletions buildkite/src/Jobs/Test/FuzzyZkappTest.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -6,71 +6,17 @@ let PipelineMode = ../../Pipeline/Mode.dhall

let PipelineTag = ../../Pipeline/Tag.dhall

let JobSpec = ../../Pipeline/JobSpec.dhall

let Command = ../../Command/Base.dhall

let RunInToolchain = ../../Command/RunInToolchain.dhall

let Docker = ../../Command/Docker/Type.dhall

let Size = ../../Command/Size.dhall

let buildTestCmd
: Text -> Text -> Natural -> Natural -> Size -> Command.Type
= \(profile : Text)
-> \(path : Text)
-> \(timeout : Natural)
-> \(individual_test_timeout : Natural)
-> \(cmd_target : Size)
-> let timeout = Natural/show timeout

let individual_test_timeout = Natural/show individual_test_timeout

let key = "fuzzy-zkapp-unit-test-${profile}"

in Command.build
Command.Config::{
, commands =
RunInToolchain.runInToolchain
[ "DUNE_INSTRUMENT_WITH=bisect_ppx", "COVERALLS_TOKEN" ]
"buildkite/scripts/fuzzy-zkapp-test.sh ${profile} ${path} ${timeout} ${individual_test_timeout} && buildkite/scripts/upload-partial-coverage-data.sh ${key} dev"
, label = "Fuzzy zkapp unit tests"
, key = key
, target = cmd_target
, docker = None Docker.Type
, artifact_paths = [ S.contains "core_dumps/*" ]
, flake_retry_limit = Some 0
}
let Command = ../../Command/FuzzyZkappTest.dhall

in Pipeline.build
Pipeline.Config::{
, spec =
let unitDirtyWhen =
[ S.strictlyStart (S.contains "src/lib")
, S.strictlyStart
(S.contains "src/lib/transaction_snark/test/zkapp_fuzzy")
, S.exactly "buildkite/src/Jobs/Test/FuzzyZkappTest" "dhall"
, S.exactly "buildkite/scripts/fuzzy-zkapp-test" "sh"
]

in JobSpec::{
, dirtyWhen = unitDirtyWhen
, path = "Test"
, name = "FuzzyZkappTest"
, tags =
[ PipelineTag.Type.VeryLong
, PipelineTag.Type.Test
, PipelineTag.Type.Stable
]
, mode = PipelineMode.Type.Stable
}
, steps =
[ buildTestCmd
"dev"
"src/lib/transaction_snark/test/zkapp_fuzzy/zkapp_fuzzy.exe"
4200
150
Size.Small
]
}
( Command.pipeline
Command.Spec::{
, job_path = "Test"
, job_name = "FuzzyZkappTest"
, tags = [ PipelineTag.Type.VeryLong, PipelineTag.Type.Test ]
, mode = PipelineMode.Type.Stable
, additional_dirty_when =
[ S.exactly "buildkite/src/Jobs/Test/FuzzyZkappTest" "dhall" ]
, timeout = 1200
}
)
22 changes: 22 additions & 0 deletions buildkite/src/Jobs/Test/FuzzyZkappTestQuick.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
let S = ../../Lib/SelectFiles.dhall

let Pipeline = ../../Pipeline/Dsl.dhall

let PipelineMode = ../../Pipeline/Mode.dhall

let PipelineTag = ../../Pipeline/Tag.dhall

let Command = ../../Command/FuzzyZkappTest.dhall

in Pipeline.build
( Command.pipeline
Command.Spec::{
, job_path = "Test"
, job_name = "FuzzyZkappTestQuick"
, tags = [ PipelineTag.Type.Fast, PipelineTag.Type.Test ]
, mode = PipelineMode.Type.PullRequest
, additional_dirty_when =
[ S.exactly "buildkite/src/Jobs/Test/FuzzyZkappTestQuick" "dhall" ]
, timeout = 300
}
)

0 comments on commit 5a5a547

Please sign in to comment.