Example #1
0
 def test_read_old_after_timeout(self):
     checker = LinearizabilityRegisterChecker()
     checker.init("j3qq4", 0, "42")
     checker.write_started("j3qq4", "h7h2v", 1, "43")
     checker.write_timeouted("h7h2v")
     checker.read_started("pid1")
     checker.read_ended("pid1", "j3qq4", "42")
Example #2
0
 def test_read_commits_write1(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")
     checker.write_ended("h7h2v")
Example #3
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 #4
0
 def test_read_wrong_value_err(self):
     checker = LinearizabilityRegisterChecker()
     checker.init("j3qq4", 0, "42")
     checker.read_started("pid1")
     try:
         checker.read_ended("pid1", "j3qq4", "43")
         raise Exception("should be unreachable")
     except Violation as e:
         if e.message != "Read value 43 doesn't match written value 42":
             raise e
Example #5
0
 def test_read_phantom_err(self):
     checker = LinearizabilityRegisterChecker()
     checker.init("j3qq4", 0, "42")
     checker.read_started("pid1")
     try:
         checker.read_ended("pid1", "h7h2v", "42")
         raise Exception("should be unreachable")
     except Violation as e:
         if e.message != "Stale or phantom read h7h2v":
             raise e
Example #6
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 #7
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
Example #8
0
 def test_read_ok(self):
     checker = LinearizabilityRegisterChecker()
     checker.init("j3qq4", 0, "42")
     checker.read_started("pid1")
     checker.read_ended("pid1", "j3qq4", "42")