-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a test to reach line 42 without locking
- Loading branch information
1 parent
c9b1fa8
commit 5fe2b41
Showing
5 changed files
with
77 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// -*- mode: Bluespec; -*- | ||
|
||
module line42Test { | ||
|
||
import line42run( | ||
validators = Set("v1", "v2", "v3", "v4"), | ||
validatorSet = Set("v1", "v2", "v3", "v4").mapBy(x => 1), | ||
Faulty = Set(), | ||
Values = Set("red", "blue"), | ||
Rounds = Set(0, 1, 2, 3), | ||
Heights = Set(0), // , 1, 2, 3) | ||
testedVal = "v4" | ||
) as N4F0 from "./line42run" | ||
|
||
run line42Test = { | ||
N4F0::runToLine42 | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// -*- mode: Bluespec; -*- | ||
|
||
module line42run { | ||
|
||
import TendermintDSL.* from "./TendermintDSL" | ||
export TendermintDSL.* | ||
|
||
const testedVal : Address_t | ||
val others = validators.exclude(Set(testedVal)) | ||
val othersList = others.fold(List(), (s, x) => s.append(x)) | ||
|
||
run runToLine42 = { | ||
val value = "blue" | ||
init | ||
.then(valStep(testedVal)) | ||
.then(everyoneReceivesProposal(othersList, validatorList, validatorSet, 0, 0, value)) | ||
.then(fromPrevoteToPrecommit(othersList, othersList, validatorList, validatorSet, 0, 0, value)) | ||
// At this point we have set up the environment for "testedVal" to reach line 42 without | ||
// any other process taking any steps | ||
.then(all{ | ||
assert(system.get(testedVal).timeout.contains(("TimeoutPropose", 0, 0))), | ||
valStep(testedVal) | ||
}) | ||
.then(ProcessDeliverAllVotes("Prevote", testedVal, othersList, validatorSet, 0, 0, value)) | ||
.then(othersList.length().reps(_ => valStep(testedVal))) | ||
.then(all{ | ||
assert(system.get(testedVal).timeout.contains(("TimeoutPrevote", 0, 0))), | ||
valStep(testedVal) | ||
}) | ||
.then(all{ | ||
assert(system.get(testedVal).es.cs.step == "Precommit"), | ||
deliverSomeProposal(testedVal) | ||
}) | ||
.then(valStep(testedVal)) // here it executes line 36 with branch 42 | ||
.then(all{ | ||
val cstate = system.get(testedVal).es.cs | ||
assert(all{ | ||
cstate.lockedRound == -1, | ||
cstate.lockedValue == "nil", | ||
cstate.validRound == 0, | ||
cstate.validValue == value | ||
}), | ||
unchangedAll | ||
}) | ||
} | ||
|
||
} | ||
|