Esempio n. 1
0
  def test_classic_rb( self ) :

    test_id              = "others_classic_rb"
    test_input_file_name = "classic_rb_driver"

    logging.debug( ">> RUNNING TEST '" + test_id + "' <<<" )

    # --------------------------------------------------------------- #
    # specify input file paths

    inputfile = "./dedalus_drivers/" + test_input_file_name + ".ded"

    # --------------------------------------------------------------- #
    # define sys.argv

    argDict = {}
    argDict[ "solver" ]          = "z3"
    argDict[ "file" ]           = inputfile
    argDict[ "EOT" ]            = 4
    argDict[ "EFF" ]            = 0
    argDict[ "nodes" ]          = [ "a", "b", "c" ]
    argDict[ "settings" ]       = "./settings_files/settings_dm_allow_not_clocks.ini"
    argDict[ "evaluator"]       = "c4"
    argDict[ "crashes" ]        = 0
    argDict[ "data_save_path" ] = "./data/" + test_id + "/"

    # --------------------------------------------------------------- #
    # run chaoxis

    # instantiate chaoxis object
    c = Chaoxis.Chaoxis( argDict, test_id )

    # this also works:
    #c = Chaoxis.Chaoxis( argDict, test_id, [ 'clock("a","c",1,2);', \
    #                                         'clock("b","a",2,3);', \
    #                                         'clock("b","c",2,3);'] )

    # run chaoxis
    c.run()
    #c.run_find_all_solns()

    # collect conclusion
    actual_conclusion = c.conclusion

    if argDict[ "EOT" ] == 3 :
      expected_conclusion = '''conclusion : found counterexample : ''' + \
                            '''[\'clock("a","c",1,2);\']'''
    elif argDict[ "EOT" ] == 4 :
      expected_conclusion = '''conclusion : found counterexample : ''' + \
                          '''[\'clock("a","c",1,2);\', ''' + \
                          '''\'clock("b","c",2,3);\']'''
    else :
      expected_conclusion = '''?'''

    self.assertEqual( actual_conclusion, expected_conclusion )

    logging.debug( "  TEST " + test_id + " : actual_conclusion   = " + actual_conclusion )
    logging.debug( "  TEST " + test_id + " : expected_conclusion = " + expected_conclusion )
Esempio n. 2
0
  def test_replog( self ) :

    test_id              = "others_replog"
    test_input_file_name = "replog_driver"

    logging.debug( ">> RUNNING TEST '" + test_id + "' <<<" )

    # --------------------------------------------------------------- #
    # specify input file paths

    inputfile = "./dedalus_drivers/" + test_input_file_name + ".ded"

    # --------------------------------------------------------------- #
    # define sys.argv

    argDict = {}
    argDict[ "solver" ]          = "z3"
    argDict[ "file" ]           = inputfile
    argDict[ "EOT" ]            = 3
    argDict[ "EFF" ]            = 0
    argDict[ "nodes" ]          = [ "a", "b", "c" ]
    argDict[ "settings" ]       = "./settings_files/settings_dm_allow_not_clocks.ini"
    argDict[ "evaluator"]       = "c4"
    argDict[ "crashes" ]        = 0
    argDict[ "data_save_path" ] = "./data/" + test_id + "/"

    # --------------------------------------------------------------- #
    # run chaoxis

    # instantiate chaoxis object
    c = Chaoxis.Chaoxis( argDict, test_id )

    # run chaoxis
    c.run()

    # collect conclusion
    actual_conclusion = c.conclusion

    expected_conclusion_1 = '''conclusion : found counterexample : ''' + \
                            '''[\'clock("a","b",1,2);\', ''' + \
                            '''\'clock("a","c",1,2);\', ''' + \
                            '''\'clock("a","b",2,3);\']'''
    expected_conclusion_2 = '''conclusion : found counterexample : ''' + \
                            '''[\'clock("a","b",1,2);\', ''' + \
                            '''\'clock("a","b",2,3);\', ''' + \
                            '''\'clock("c","b",2,3);\']'''


    if __name__ == "__main__" :
      self.assertEqual( actual_conclusion, expected_conclusion_1 )
      logging.debug( "  TEST " + test_id + " : actual_conclusion   = " + actual_conclusion )
      logging.debug( "  TEST " + test_id + " : expected_conclusion = " + expected_conclusion_1 )
    else :
      self.assertEqual( actual_conclusion, expected_conclusion_2 )
      logging.debug( "  TEST " + test_id + " : actual_conclusion   = " + actual_conclusion )
      logging.debug( "  TEST " + test_id + " : expected_conclusion = " + expected_conclusion_2 )
Esempio n. 3
0
def chaoxis() :

  # --------------------------------------------- #
  # initialize chaoxis object

  c = Chaoxis.Chaoxis()

  # --------------------------------------------- #
  # run LDFI on given spec (in file provided in argDict)

  c.run()

  sys.exit( c.conclusion )
Esempio n. 4
0
  def test_async_1( self ) :

    test_id              = "others_async_1"
    test_input_file_name = "async_1_driver"

    logging.debug( ">> RUNNING TEST '" + test_id + "' <<<" )

    # --------------------------------------------------------------- #
    # specify input file paths

    inputfile = "./dedalus_drivers/" + test_input_file_name + ".ded"

    # --------------------------------------------------------------- #
    # define sys.argv

    argDict = {}
    argDict[ "solver" ]          = "z3"
    argDict[ "file" ]           = inputfile
    argDict[ "solver" ]         = "z3"
    argDict[ "EOT" ]            = 3
    argDict[ "EFF" ]            = 0
    argDict[ "nodes" ]          = [ "Node1", "Node2", "Server" ]
    argDict[ "settings" ]       = "./settings_files/settings_dm_allow_not_clocks.ini"
    argDict[ "evaluator"]       = "c4"
    argDict[ "crashes" ]        = 0
    argDict[ "data_save_path" ] = "./data/" + test_id + "/"

    # --------------------------------------------------------------- #
    # run chaoxis

    # instantiate chaoxis object
    #c = Chaoxis.Chaoxis( argDict, test_id )
    c = Chaoxis.Chaoxis( argDict, test_id, [ '_NOT_clock("Node2","Server",2,1);' ] )

    # run chaoxis
    c.run()

    # collect conclusion
    actual_conclusion = c.conclusion

    expected_conclusion = '''conclusion : found counterexample : ''' + \
                          '''[\'_NOT_clock("Node2","Server",2,1);\']'''

    self.assertEqual( actual_conclusion, expected_conclusion )

    logging.debug( "  TEST " + test_id + " : actual_conclusion   = " + actual_conclusion )
    logging.debug( "  TEST " + test_id + " : expected_conclusion = " + expected_conclusion )
Esempio n. 5
0
  def test_async_2( self ) :

    test_id              = "others_async_2"
    test_input_file_name = "async_2_driver"

    logging.debug( ">> RUNNING TEST '" + test_id + "' <<<" )

    # --------------------------------------------------------------- #
    # specify input file paths

    inputfile = "./dedalus_drivers/" + test_input_file_name + ".ded"

    # --------------------------------------------------------------- #
    # define sys.argv

    argDict = {}
    argDict[ "solver" ]          = "z3"
    argDict[ "file" ]           = inputfile
    argDict[ "EOT" ]            = 3
    argDict[ "EFF" ]            = 0
    argDict[ "nodes" ]          = [ "am", "rm1", "rm2" ]
    argDict[ "settings" ]       = "./settings_files/settings_dm_allow_not_clocks.ini"
    argDict[ "evaluator"]       = "c4"
    argDict[ "crashes" ]        = 0
    argDict[ "data_save_path" ] = "./data/" + test_id + "/"

    # --------------------------------------------------------------- #
    # run chaoxis

    # instantiate chaoxis object
    c = Chaoxis.Chaoxis( argDict, test_id )

    # run chaoxis
    c.run()

    # collect conclusion
    actual_conclusion = c.conclusion

    expected_conclusion = '''conclusion : spec is vacuously correct.'''

    self.assertEqual( actual_conclusion, expected_conclusion )

    logging.debug( "  TEST " + test_id + " : actual_conclusion   = " + actual_conclusion )
    logging.debug( "  TEST " + test_id + " : expected_conclusion = " + expected_conclusion )
Esempio n. 6
0
  def test_simplog_optimize_not( self ) :

    test_id = "simplog_optimize_not"
    logging.debug( ">> RUNNING TEST '" + test_id + "' <<<" )

    # --------------------------------------------------------------- #
    # specify input file paths

    inputfile = "./dedalus_drivers/simplog_driver.ded"

    # --------------------------------------------------------------- #
    # define sys.argv

    argDict = {}
    argDict[ "solver" ]          = "z3"
    argDict[ "file" ]           = inputfile
    argDict[ "EOT" ]            = 3
    argDict[ "EFF" ]            = 0
    argDict[ "nodes" ]          = [ "a", "b", "c" ]
    argDict[ "settings" ]       = "./settings_files/settings_dm_optimize_not.ini"
    argDict[ "evaluator"]       = "c4"
    argDict[ "crashes" ]        = 0
    argDict[ "data_save_path" ] = "./data/" + test_id + "/"

    # --------------------------------------------------------------- #
    # run chaoxis

    # instantiate chaoxis object
    c = Chaoxis.Chaoxis( argDict, test_id )
    #c = Chaoxis.Chaoxis( argDict, test_id, [ 'clock("a","b",1,2);' ] )

    # run chaoxis
    c.run()

    # collect conclusion
    actual_conclusion = c.conclusion

    expected_conclusion = '''conclusion : found counterexample : ''' + \
                          '''[\'clock("a","c",1,2);\']'''

    self.assertEqual( actual_conclusion, expected_conclusion )

    logging.debug( "  TEST " + test_id + " : actual_conclusion   = " + actual_conclusion )
    logging.debug( "  TEST " + test_id + " : expected_conclusion = " + expected_conclusion )
Esempio n. 7
0
  def test_2pc_optimist( self ) :

    test_id = "2pc_optimist"
    logging.debug( ">> RUNNING TEST '" + test_id + "' <<<" )

    # --------------------------------------------------------------- #
    # specify input file paths

    inputfile = "./dedalus_drivers/" + test_id + "_driver.ded"

    # --------------------------------------------------------------- #
    # define sys.argv

    argDict = {}
    argDict[ "solver" ]          = "z3"
    argDict[ "file" ]           = inputfile
    argDict[ "EOT" ]            = 3
    argDict[ "EFF" ]            = 0
    argDict[ "nodes" ]          = [ "a", "b", "C", "d" ]
    argDict[ "settings" ]       = "./settings_files/settings_dm_allow_not_clocks.ini"
    argDict[ "evaluator"]       = "c4"
    argDict[ "crashes" ]        = 0
    argDict[ "data_save_path" ] = "./data/" + test_id + "/"

    # --------------------------------------------------------------- #
    # run chaoxis

    # instantiate chaoxis object
    c = Chaoxis.Chaoxis( argDict, test_id )

    # run chaoxis
    c.run()

    # collect conclusion
    actual_conclusion = c.conclusion

    expected_conclusion = '''?'''

    self.assertEqual( actual_conclusion, expected_conclusion )

    logging.debug( "  TEST " + test_id + " : actual_conclusion   = " + actual_conclusion )
    logging.debug( "  TEST " + test_id + " : expected_conclusion = " + expected_conclusion )