GNUnet  0.20.0
gnunet_testing.Check Class Reference
Inheritance diagram for gnunet_testing.Check:
[legend]
Collaboration diagram for gnunet_testing.Check:
[legend]

Public Member Functions

def __init__ (self, test)
 
def add (self, condition)
 
def run (self)
 
def run_blocking (self, timeout, pos_cont, neg_cont)
 
def run_once (self, pos_cont, neg_cont)
 
def evaluate (self, failed_only)
 
def reset (self)
 

Data Fields

 fulfilled
 
 conditions
 
 test
 

Detailed Description

Definition at line 40 of file gnunet_testing.py.

Constructor & Destructor Documentation

◆ __init__()

def gnunet_testing.Check.__init__ (   self,
  test 
)

Definition at line 41 of file gnunet_testing.py.

41  def __init__(self, test):
42  self.fulfilled = False
43  self.conditions = list()
44  self.test = test
45 
static int list
Set if we should print a list of currently running services.
Definition: gnunet-arm.c:69

Member Function Documentation

◆ add()

def gnunet_testing.Check.add (   self,
  condition 
)

Definition at line 46 of file gnunet_testing.py.

46  def add(self, condition):
47  self.conditions.append(condition)
48 
static int add
Desired action is to add a record.

References gnunet_testing.Check.conditions.

◆ run()

def gnunet_testing.Check.run (   self)

Definition at line 49 of file gnunet_testing.py.

49  def run(self):
50  fulfilled = True
51  pos = 0
52  neg = 0
53  for c in self.conditions:
54  if (False == c.check()):
55  fulfilled = False
56  neg += 1
57  else:
58  pos += 1
59  return fulfilled
60 
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
Main function that will be run.
Definition: gnunet-abd.c:757

References gnunet_testing.Check.conditions.

Referenced by gnunet_testing.Check.run_blocking(), and gnunet_testing.Check.run_once().

Here is the caller graph for this function:

◆ run_blocking()

def gnunet_testing.Check.run_blocking (   self,
  timeout,
  pos_cont,
  neg_cont 
)

Definition at line 61 of file gnunet_testing.py.

61  def run_blocking(self, timeout, pos_cont, neg_cont):
62  execs = 0
63  res = False
64  while ((False == res) and (execs < timeout)):
65  res = self.run()
66  time.sleep(1)
67  execs += 1
68  if ((False == res) and (execs >= timeout)):
69  logger.debug('Check had timeout after %s seconds', str(timeout))
70  neg_cont(self)
71  elif ((False == res) and (execs < timeout)):
72  if (None != neg_cont):
73  neg_cont(self)
74  else:
75  if (None != pos_cont):
76  pos_cont(self)
77  return res
78 

References httpdomain.autohttp.bottle.AutobottleDirective.run(), httpdomain.autohttp.flask.AutoflaskDirective.run(), httpdomain.autohttp.flaskqref.QuickReferenceFlaskDirective.run(), httpdomain.autohttp.tornado.AutoTornadoDirective.run(), typescriptdomain.TypeScriptDefinition.run(), GNUNET_TESTING_Command.run, and gnunet_testing.Check.run().

Here is the call graph for this function:

◆ run_once()

def gnunet_testing.Check.run_once (   self,
  pos_cont,
  neg_cont 
)

Definition at line 79 of file gnunet_testing.py.

79  def run_once(self, pos_cont, neg_cont):
80  execs = 0
81  res = False
82  res = self.run()
83  if ((res == False) and (neg_cont != None)):
84  neg_cont(self)
85  if ((res == True) and (pos_cont != None)):
86  pos_cont(self)
87  return res
88 

References httpdomain.autohttp.bottle.AutobottleDirective.run(), httpdomain.autohttp.flask.AutoflaskDirective.run(), httpdomain.autohttp.flaskqref.QuickReferenceFlaskDirective.run(), httpdomain.autohttp.tornado.AutoTornadoDirective.run(), typescriptdomain.TypeScriptDefinition.run(), GNUNET_TESTING_Command.run, and gnunet_testing.Check.run().

Here is the call graph for this function:

◆ evaluate()

def gnunet_testing.Check.evaluate (   self,
  failed_only 
)

Definition at line 89 of file gnunet_testing.py.

89  def evaluate(self, failed_only):
90  pos = 0
91  neg = 0
92  for c in self.conditions:
93  if (False == c.evaluate(failed_only)):
94  neg += 1
95  else:
96  pos += 1
97  logger.debug(
98  '%s out of %s conditions fulfilled', str(pos), str(pos + neg)
99  )
100  return self.fulfilled
101 
static int evaluate(void)
Write the ids and their according index in the given array to a file Unused.

References gnunet_testing.Check.conditions, gnunet_testing.Check.fulfilled, gnunet_testing.Condition.fulfilled, gnunet_testing.FileExistCondition.fulfilled, gnunet_testing.StatisticsCondition.fulfilled, and gnunet_testing.EqualStatisticsCondition.fulfilled.

◆ reset()

def gnunet_testing.Check.reset (   self)

Definition at line 102 of file gnunet_testing.py.

102  def reset(self):
103  self.fulfilled = False
104  for c in self.conditions:
105  c.fulfilled = False
106 
107 
static int reset
Reset argument.

References gnunet_testing.Check.conditions, gnunet_testing.Check.fulfilled, gnunet_testing.Condition.fulfilled, gnunet_testing.FileExistCondition.fulfilled, gnunet_testing.StatisticsCondition.fulfilled, and gnunet_testing.EqualStatisticsCondition.fulfilled.

Field Documentation

◆ fulfilled

◆ conditions

gnunet_testing.Check.conditions

◆ test

gnunet_testing.Check.test

The documentation for this class was generated from the following file: