Skip to content

Commit

Permalink
Fix a long-fork checker
Browse files Browse the repository at this point in the history
```
$ java -jar ~/sources/elle-cli/target/elle-cli-0.1.7-standalone.jar --verbose --model long-fork histories/jepsen/long-fork.edn
{"reads-count":2,
 "early-read-count":0,
 "late-read-count":0,
 "valid?":false,
 "forks":
 [[{"index":3,
    "time":-1,
    "type":"ok",
    "process":null,
    "f":"read",
    "value":[["r", 2, 1], ["r", 0, 1], ["r", 1, null]]},
   {"index":1,
    "time":-1,
    "type":"ok",
    "process":null,
    "f":"read",
    "value":[["r", 0, 1], ["r", 1, 1], ["r", 2, null]]}]]}
```

Fixes #43
  • Loading branch information
ligurio committed Nov 5, 2024
1 parent e0fe656 commit ff38f2e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ change log follows the conventions of
### Fixed

- A `set` checker (#44).
- A `long-fork` checker (#43).

### Changed

Expand Down
4 changes: 4 additions & 0 deletions histories/jepsen/long-fork.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[{:type :invoke, :f :read, :value [[:r 0 nil] [:r 1 nil] [:r 2 nil]]},
{:type :ok, :f :read, :value [[:r 0 1] [:r 1 1] [:r 2 nil]]},
{:type :invoke, :f :read, :value [[:r 2 nil] [:r 0 nil] [:r 1 nil]]},
{:type :ok, :f :read, :value [[:r 2 1] [:r 0 1] [:r 1 nil]]}]
8 changes: 6 additions & 2 deletions src/elle_cli/cli.clj
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@
:parse-fn #(Integer/parseInt %)]

; Jepsen-specific options.
; None.
["-g" "--group-size GROUP-SIZE"
"(Jepsen) A group size."
:default 0
:parse-fn #(Integer/parseInt %)]

; Knossos-specific options.
; None.
Expand Down Expand Up @@ -184,7 +187,8 @@
"bank" (jepsen-model/check-safe (checker-fn {:negative-balances? true}) nil history)
"counter" (jepsen-model/check-safe (checker-fn) nil history)
"set" (jepsen-model/check-safe (checker-fn) nil history)
"set-full" (jepsen-model/check-safe (checker-fn) nil history))))
"set-full" (jepsen-model/check-safe (checker-fn) nil history)
"long-fork" (jepsen-model/check-safe (checker-fn (get options :group-size)) nil history))))

(defn read-fn-by-extension
"Take a path to file and returns a function for reading that file."
Expand Down
1 change: 1 addition & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@ run_test 1 "--model bank histories/jepsen/bank.edn"
run_test 1 "--model bank histories/jepsen/bank.json"
run_test 1 "--model bank histories/jepsen/bank-tidb.edn"

run_test 1 "--model long-fork --group-size 3 histories/jepsen/long-fork.edn"

exit $suite_status

0 comments on commit ff38f2e

Please sign in to comment.