- Better error reporting for local order constraints.

This commit is contained in:
ccremers 2006-02-28 15:33:12 +00:00
parent 4064d8ca65
commit 527bf8baa5
3 changed files with 59 additions and 20 deletions

View File

@ -39,13 +39,14 @@ correctLocalOrder (const System sys)
// t is a term from r2 that occurs in r1 // t is a term from r2 that occurs in r1
r2 = TermRunid (t); r2 = TermRunid (t);
e1 = firstOccurrence (sys, r1, t, READ); e1 = firstOccurrence (sys, r1, t, ANYEVENT);
if (e1 >= 0) if (e1 >= 0)
{
if (roledef_shift (sys->runs[r1].start, e1)->type == READ)
{ {
e2 = firstOccurrence (sys, r2, t, SEND); e2 = firstOccurrence (sys, r2, t, SEND);
if (e2 >= 0) if (e2 >= 0)
{ {
// thus, it should not be the case that e1 occurs before e2 // thus, it should not be the case that e1 occurs before e2
if (isDependEvent (r1, e1, r2, e2)) if (isDependEvent (r1, e1, r2, e2))
{ {
@ -63,11 +64,46 @@ correctLocalOrder (const System sys)
return false; return false;
} }
} }
else
{
globalError++;
eprintf ("Error: term ");
termSubstPrint (t);
eprintf
(" from run %i should occur in run %i, but it doesn't.\n",
r2, r2);
globalError--;
error ("Abort");
} }
} }
else
{
// not a read first?
globalError++;
eprintf ("Error: term ");
termSubstPrint (t);
eprintf
(" from run %i should occur in run %i first in a READ event, but it occurs first in another event.\n",
r2, r1);
globalError--;
error ("Abort");
}
}
else
{
globalError++;
eprintf ("Error: term ");
termSubstPrint (t);
eprintf
(" from run %i should occur in run %i, but it doesn't.\n", r2,
r1);
globalError--;
error ("Abort");
}
return true; return true;
} }
}
return iterateLocalToOther (sys, r1, checkTerm); return iterateLocalToOther (sys, r1, checkTerm);
} }

View File

@ -9,7 +9,7 @@
#include "states.h" #include "states.h"
enum eventtype enum eventtype
{ READ, SEND, CLAIM }; { READ, SEND, CLAIM, ANYEVENT };
//! The container for the claim info list //! The container for the claim info list
/** /**

View File

@ -1576,13 +1576,16 @@ iterateEvents (const System sys, const int run,
} }
// Iterate over event type in a certain run (increasing through role) // Iterate over event type in a certain run (increasing through role)
/**
* If evtype == ANYEVENT then it does not matter.
*/
int int
iterateEventsType (const System sys, const int run, const int evtype, iterateEventsType (const System sys, const int run, const int evtype,
int (*callback) (Roledef rd, int ev)) int (*callback) (Roledef rd, int ev))
{ {
int selectEvent (Roledef rd, int e) int selectEvent (Roledef rd, int e)
{ {
if (rd->type == evtype) if (evtype == ANYEVENT || rd->type == evtype)
{ {
return callback (rd, e); return callback (rd, e);
} }