From bd85d3d03615bce543475e179c7acaf974863c51 Mon Sep 17 00:00:00 2001 From: Sergey Bronnikov Date: Tue, 5 Nov 2024 11:10:54 +0300 Subject: [PATCH] Introduce an option to control bank model The patch introduces an option `--allow-negative-balances` (short `-n`). The option is suitable for a bank model only. --- CHANGELOG.md | 2 ++ src/elle_cli/cli.clj | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ab2b6a..3f7ace2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ change log follows the conventions of ### Added +- An option `--allow-negative-balances`. + ### Fixed - A `set` checker (#44). diff --git a/src/elle_cli/cli.clj b/src/elle_cli/cli.clj index 0120853..2ce178d 100644 --- a/src/elle_cli/cli.clj +++ b/src/elle_cli/cli.clj @@ -142,6 +142,9 @@ "(Jepsen) A group size." :default 0 :parse-fn #(Integer/parseInt %)] + ["-n" "--allow-negative-balances" + "(Jepsen) Allow negative balances in a bank model." + :default false] ; Knossos-specific options. ; None. @@ -184,7 +187,9 @@ "sequential" ((checker-fn) (history/parse-ops history)) "list-append" (checker-fn options history) "rw-register" (checker-fn options history) - "bank" (jepsen-model/check-safe (checker-fn {:negative-balances? true}) nil history) + "bank" (jepsen-model/check-safe (checker-fn + {:negative-balances? (get options :allow-negative-balances)}) + 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)