Example #1
0
 def test_read_old_after_canceled_ok(self):
     checker = LinearizabilityRegisterChecker()
     checker.init("j3qq4", 0, "42")
     checker.write_started("j3qq4", "h7h2v", 1, "43")
     checker.write_ended("h7h2v")
     checker.write_started("h7h2v", "2hch4", 2, "44")
     checker.write_canceled("2hch4")
     checker.read_started("pid1")
     checker.read_ended("pid1", "h7h2v", "43")
Example #2
0
 def test_read_commits_write2(self):
     checker = LinearizabilityRegisterChecker()
     checker.init("j3qq4", 0, "42")
     checker.read_started("pid1")
     checker.write_started("j3qq4", "h7h2v", 1, "43")
     checker.read_ended("pid1", "h7h2v", "43")
     try:
         checker.write_canceled("h7h2v")
         raise Exception("should be unreachable")
     except Violation as e:
         if e.message != "Can't cancel an already applied write: h7h2v":
             raise e
Example #3
0
 def test_cant_commit_canceled(self):
     checker = LinearizabilityRegisterChecker()
     checker.init("j3qq4", 0, "42")
     checker.write_started("j3qq4", "h7h2v", 1, "43")
     checker.write_started("h7h2v", "2hch4", 2, "44")
     checker.write_canceled("h7h2v")
     try:
         checker.write_ended("2hch4")
         raise Exception("should be unreachable")
     except Violation as e:
         if e.message != "2hch4:2 -> h7h2v doesn't lead to the latest observed state: j3qq4:0":
             raise e
Example #4
0
 def test_read_new_after_canceled_err(self):
     checker = LinearizabilityRegisterChecker()
     checker.init("j3qq4", 0, "42")
     checker.write_started("j3qq4", "h7h2v", 1, "43")
     checker.write_ended("h7h2v")
     checker.write_started("h7h2v", "2hch4", 2, "44")
     checker.write_canceled("2hch4")
     checker.read_started("pid1")
     try:
         checker.read_ended("pid1", "2hch4", "44")
         raise Exception("should be unreachable")
     except Violation as e:
         if e.message != "Stale or phantom read 2hch4":
             raise e