- Implemented --claim=ns3,I switch to filter certain claims.
This commit is contained in:
parent
a6933806f9
commit
ec3be3d55b
@ -2237,9 +2237,6 @@ arachneClaim (Claimlist cl)
|
|||||||
{
|
{
|
||||||
// Skip the dummy claims
|
// Skip the dummy claims
|
||||||
if (!isTermEqual (cl->type, CLAIM_Empty))
|
if (!isTermEqual (cl->type, CLAIM_Empty))
|
||||||
{
|
|
||||||
// Any other claims might be filterered
|
|
||||||
if (switches.filterClaim == NULL || switches.filterClaim == cl->type)
|
|
||||||
{
|
{
|
||||||
// Some claims are always true!
|
// Some claims are always true!
|
||||||
if (!cl->alwaystrue)
|
if (!cl->alwaystrue)
|
||||||
@ -2362,7 +2359,6 @@ arachneClaim (Claimlist cl)
|
|||||||
eprintf ("Proof complete for this claim.\n");
|
eprintf ("Proof complete for this claim.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
claimStatusReport (sys, cl);
|
claimStatusReport (sys, cl);
|
||||||
if (switches.xml)
|
if (switches.xml)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <string.h>
|
||||||
#include "tac.h"
|
#include "tac.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
#include "termlist.h"
|
#include "termlist.h"
|
||||||
@ -431,11 +432,31 @@ claimCreate (const System sys, const Protocol protocol, const Role role,
|
|||||||
Claimlist cl;
|
Claimlist cl;
|
||||||
Term labeltuple;
|
Term labeltuple;
|
||||||
|
|
||||||
/* check for ignored claim types */
|
if (switches.filterProtocol != NULL)
|
||||||
if (switches.filterClaim != NULL && switches.filterClaim != claim)
|
|
||||||
{
|
{
|
||||||
/* abort the construction of the node */
|
// only this protocol
|
||||||
return;
|
if (strcmp
|
||||||
|
(switches.filterProtocol, TermSymb (protocol->nameterm)->text) != 0)
|
||||||
|
{
|
||||||
|
// not this protocol; return
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
// and maybe also a specific label?
|
||||||
|
if (switches.filterLabel != NULL)
|
||||||
|
{
|
||||||
|
Term t;
|
||||||
|
|
||||||
|
t = label;
|
||||||
|
while (isTermTuple (t))
|
||||||
|
{
|
||||||
|
t = TermOp2 (t);
|
||||||
|
}
|
||||||
|
if (strcmp (switches.filterLabel, TermSymb (t)->text) != 0)
|
||||||
|
{
|
||||||
|
// not this label; return
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* generate full unique label */
|
/* generate full unique label */
|
||||||
@ -556,16 +577,15 @@ commEvent (int event, Tac tc)
|
|||||||
/* effectively, labels are bound to the protocol */
|
/* effectively, labels are bound to the protocol */
|
||||||
level--;
|
level--;
|
||||||
/* leaves a garbage tuple. dunnoh what to do with it */
|
/* leaves a garbage tuple. dunnoh what to do with it */
|
||||||
label =
|
label = levelConst (tc->t1.sym);
|
||||||
makeTermTuple (thisProtocol->nameterm, levelConst (tc->t1.sym));
|
|
||||||
level++;
|
level++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* leaves a garbage tuple. dunnoh what to do with it */
|
/* leaves a garbage tuple. dunnoh what to do with it */
|
||||||
|
}
|
||||||
|
}
|
||||||
label = makeTermTuple (thisProtocol->nameterm, label);
|
label = makeTermTuple (thisProtocol->nameterm, label);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the specific event type
|
* Parse the specific event type
|
||||||
@ -1017,7 +1037,17 @@ protocolCompile (Symbol prots, Tac tc, Tac tcroles)
|
|||||||
Protocol pr;
|
Protocol pr;
|
||||||
Term t;
|
Term t;
|
||||||
|
|
||||||
if (levelFind (prots, level) != NULL)
|
/* make new (empty) current protocol with name */
|
||||||
|
pr = protocolCreate (levelConst (prots));
|
||||||
|
thisProtocol = pr;
|
||||||
|
{
|
||||||
|
// check for double name declarations
|
||||||
|
Protocol prold;
|
||||||
|
|
||||||
|
prold = sys->protocols;
|
||||||
|
while (prold != NULL)
|
||||||
|
{
|
||||||
|
if (isTermEqual (pr->nameterm, prold->nameterm))
|
||||||
{
|
{
|
||||||
globalError++;
|
globalError++;
|
||||||
eprintf ("error: Double declaration of protocol ");
|
eprintf ("error: Double declaration of protocol ");
|
||||||
@ -1025,9 +1055,10 @@ protocolCompile (Symbol prots, Tac tc, Tac tcroles)
|
|||||||
eprintf (" ");
|
eprintf (" ");
|
||||||
errorTac (tc->lineno);
|
errorTac (tc->lineno);
|
||||||
}
|
}
|
||||||
/* make new (empty) current protocol with name */
|
prold = prold->next;
|
||||||
pr = protocolCreate (levelConst (prots));
|
}
|
||||||
thisProtocol = pr;
|
}
|
||||||
|
|
||||||
/* add protocol to list */
|
/* add protocol to list */
|
||||||
pr->next = sys->protocols;
|
pr->next = sys->protocols;
|
||||||
sys->protocols = pr;
|
sys->protocols = pr;
|
||||||
|
@ -53,7 +53,8 @@ switchesInit (int argc, char **argv)
|
|||||||
switches.maxproofdepth = INT_MAX;
|
switches.maxproofdepth = INT_MAX;
|
||||||
switches.maxtracelength = INT_MAX;
|
switches.maxtracelength = INT_MAX;
|
||||||
switches.runs = 5; // default is 5 for usability, but -r 0 or --maxruns=0 will set it back to INT_MAX
|
switches.runs = 5; // default is 5 for usability, but -r 0 or --maxruns=0 will set it back to INT_MAX
|
||||||
switches.filterClaim = NULL; // default check all claims
|
switches.filterProtocol = NULL; // default check all claims
|
||||||
|
switches.filterLabel = NULL; // default check all claims
|
||||||
switches.maxAttacks = 0; // no maximum default
|
switches.maxAttacks = 0; // no maximum default
|
||||||
|
|
||||||
// Arachne
|
// Arachne
|
||||||
@ -299,6 +300,20 @@ switcher (const int process, int index, int commandline)
|
|||||||
arg_pointer = argv[index];
|
arg_pointer = argv[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Retrieve a (string) argument
|
||||||
|
char *string_argument (void)
|
||||||
|
{
|
||||||
|
char *result;
|
||||||
|
|
||||||
|
if (arg_pointer == NULL)
|
||||||
|
{
|
||||||
|
error ("Argument expected.");
|
||||||
|
}
|
||||||
|
result = arg_pointer;
|
||||||
|
arg_next ();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//! Parse an argument into an integer
|
//! Parse an argument into an integer
|
||||||
int integer_argument (void)
|
int integer_argument (void)
|
||||||
{
|
{
|
||||||
@ -480,6 +495,30 @@ switcher (const int process, int index, int commandline)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (detect (' ', "claim", 1))
|
||||||
|
{
|
||||||
|
if (!process)
|
||||||
|
{
|
||||||
|
helptext ("--claim=<protocol>[,<label>]",
|
||||||
|
"check only a certain claim");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *second;
|
||||||
|
|
||||||
|
switches.filterProtocol = string_argument ();
|
||||||
|
second = strchr (switches.filterProtocol, ',');
|
||||||
|
if (second != NULL)
|
||||||
|
{
|
||||||
|
// Cut off first part (turn ',' into '\0'; string is disposable) and proceed to next character.
|
||||||
|
second[0] = '\0';
|
||||||
|
second++;
|
||||||
|
switches.filterLabel = second;
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (detect (' ', "remove-claims", 0))
|
if (detect (' ', "remove-claims", 0))
|
||||||
{
|
{
|
||||||
if (!process)
|
if (!process)
|
||||||
|
@ -23,7 +23,8 @@ struct switchdata
|
|||||||
int maxproofdepth; //!< Maximum proof depth
|
int maxproofdepth; //!< Maximum proof depth
|
||||||
int maxtracelength; //!< Maximum trace length allowed
|
int maxtracelength; //!< Maximum trace length allowed
|
||||||
int runs; //!< The number of runs as in the switch
|
int runs; //!< The number of runs as in the switch
|
||||||
Term filterClaim; //!< Which claim should be checked?
|
char *filterProtocol; //!< Which claim should be checked?
|
||||||
|
char *filterLabel; //!< Which claim should be checked?
|
||||||
int maxAttacks; //!< When not 0, maximum number of attacks
|
int maxAttacks; //!< When not 0, maximum number of attacks
|
||||||
|
|
||||||
// Arachne
|
// Arachne
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
- Add --filter-claim and --filter-label switches; parse as symbols, and
|
|
||||||
turn into (global?) terms, add to switches termlists. Later check them
|
|
||||||
using two new term functions:
|
|
||||||
const char *termSymbolString(Term t);
|
|
||||||
int termSymbolEqual(Term t1, Term t2);
|
|
||||||
Iteration through the termlist should be done by hand.
|
|
||||||
- --check is slightly f***ed up because there is no good semantics for
|
- --check is slightly f***ed up because there is no good semantics for
|
||||||
the --disable intruder check. As a result, it is now too strict can
|
the --disable intruder check. As a result, it is now too strict can
|
||||||
cause correct protocols to fail. Fix.
|
cause correct protocols to fail. Fix.
|
||||||
|
Loading…
Reference in New Issue
Block a user