def test_print_violated_spec_admin_af(self): # Initialize the model ret = cmd.Cmd_SecureCommandExecute("read_model -i " "tests/tools/tlace/admin.smv") self.assertEqual(ret, 0, "cannot read the model") ret = cmd.Cmd_SecureCommandExecute("go") self.assertEqual(ret, 0, "cannot build the model") propDb = glob.prop_database() master = propDb.master fsm = propDb.master.bddFsm self.assertTrue(propDb.get_size() >= 5, "propDb has no properties") prop = propDb.get_prop_at_index(4) spec = prop.exprcore res = check(fsm, spec) self.assertFalse(res[0], "spec should be violated") self.assertIsNotNone(res[1], "TLACE should be given") print(xml_representation(fsm, res[1], spec))
def check_and_explain(allargs): """ Check specs on the given NuSMV model and compute TLACEs when needed. Build the model from a given file, check every CTL spec in it and compute and store TLACEs when needed. allargs -- a sys.args-like arguments list, without script name. """ # Parse arguments parser = argparse.ArgumentParser(description='CTL model checker ' 'with TLACE generation.') # Populate arguments: for now, only the model parser.add_argument('model', help='the NuSMV model with specifications') args = parser.parse_args(allargs) # Initialize the model fsm = BddFsm.from_filename(args.model) propDb = glob.prop_database() # Check all CTL properties for prop in propDb: # Check type if prop.type == propTypes['CTL']: spec = prop.exprcore (satisfied, cntex) = check_ctl_spec(fsm, spec) # Print the result and the TLACE if any print('Specification',str(spec), 'is', str(satisfied), file=sys.stderr) if not satisfied: print(xml_representation(fsm, cntex, spec)) print()