GNUnet  0.11.x
Public Member Functions | Data Fields
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 
def __init__(self, test, cfg_file)
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.

References gnunet_testing.Check.conditions.

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

◆ run()

def gnunet_testing.Check.run (   self)

Definition at line 49 of file gnunet_testing.py.

References gnunet_testing.Check.conditions.

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

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:747
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.

References gnunet_testing.Check.run(), and GNUNET_TESTING_Command.run.

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 
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.

References gnunet_testing.Check.run(), and GNUNET_TESTING_Command.run.

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 
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.

References gnunet_testing.Check.conditions, and gnunet_testing.Check.fulfilled.

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 void evaluate(struct GNUNET_TIME_Relative duration_total)

◆ reset()

def gnunet_testing.Check.reset (   self)

Definition at line 102 of file gnunet_testing.py.

References gnunet_testing.Check.conditions, and gnunet_testing.Check.fulfilled.

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

Field Documentation

◆ fulfilled

gnunet_testing.Check.fulfilled

◆ conditions

gnunet_testing.Check.conditions

◆ test

gnunet_testing.Check.test

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