aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-02-16 17:32:44 +0000
committerng0 <ng0@n0.is>2019-02-16 17:32:44 +0000
commit795f98a989cc349cc9e60c330eaf02bf69cb936b (patch)
tree37909026d5ec743f198af671c12b964f6e16488b
parent743ea291bd4cf84ee78adfc1fe0e35cedcff41a9 (diff)
downloadgnunet-795f98a989cc349cc9e60c330eaf02bf69cb936b.tar.gz
gnunet-795f98a989cc349cc9e60c330eaf02bf69cb936b.zip
gnunet_testing.py.in: first set of logging
-rw-r--r--src/integration-tests/gnunet_testing.py.in42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/integration-tests/gnunet_testing.py.in b/src/integration-tests/gnunet_testing.py.in
index 1470c3d38..cbc3e5a45 100644
--- a/src/integration-tests/gnunet_testing.py.in
+++ b/src/integration-tests/gnunet_testing.py.in
@@ -28,7 +28,15 @@ import sys
28import shutil 28import shutil
29import time 29import time
30from gnunet_pyexpect import pexpect 30from gnunet_pyexpect import pexpect
31import logging
31 32
33logger = logging.getLogger()
34handler = logging.StreamHandler()
35formatter = logging.Formatter(
36 '%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
37handler.setFormatter(formatter)
38logger.addHandler(handler)
39logger.setLevel(logging.DEBUG)
32 40
33class Check(object): 41class Check(object):
34 def __init__(self, test): 42 def __init__(self, test):
@@ -59,7 +67,8 @@ class Check(object):
59 time.sleep(1) 67 time.sleep(1)
60 execs += 1 68 execs += 1
61 if ((False == res) and (execs >= timeout)): 69 if ((False == res) and (execs >= timeout)):
62 print(('Check had timeout after ' + str(timeout) + ' seconds')) 70 logger.debug('Check had timeout after %s seconds', str(timeout))
71 # print(('Check had timeout after ' + str(timeout) + ' seconds'))
63 neg_cont(self) 72 neg_cont(self)
64 elif ((False == res) and (execs < timeout)): 73 elif ((False == res) and (execs < timeout)):
65 if (None != neg_cont): 74 if (None != neg_cont):
@@ -87,7 +96,8 @@ class Check(object):
87 neg += 1 96 neg += 1
88 else: 97 else:
89 pos += 1 98 pos += 1
90 print((str(pos) + ' out of ' + str(pos+neg) + ' conditions fulfilled')) 99 # print((str(pos) + ' out of ' + str(pos+neg) + ' conditions fulfilled'))
100 logger.debug('%s out of %s conditions fulfilled', str(pos), str(pos+neg))
91 return self.fulfilled 101 return self.fulfilled
92 102
93 def reset(self): 103 def reset(self):
@@ -110,9 +120,11 @@ class Condition(object):
110 120
111 def evaluate(self, failed_only): 121 def evaluate(self, failed_only):
112 if ((self.fulfilled == False) and (failed_only == True)): 122 if ((self.fulfilled == False) and (failed_only == True)):
113 print(str(self.type) + 'condition for was ' + str(self.fulfilled)) 123 # print(str(self.type) + 'condition for was ' + str(self.fulfilled))
124 logger.debug('%s condition for was %s', str(self.type), str(self.fulfilled))
114 elif (failed_only == False): 125 elif (failed_only == False):
115 print(str(self.type) + 'condition for was ' + str(self.fulfilled)) 126 # print(str(self.type) + 'condition for was ' + str(self.fulfilled))
127 logger.debug('%s condition for was %s', str(self.type), str(self.fulfilled))
116 return self.fulfilled 128 return self.fulfilled
117 129
118 130
@@ -135,17 +147,19 @@ class FileExistCondition(Condition):
135 147
136 def evaluate(self, failed_only): 148 def evaluate(self, failed_only):
137 if ((self.fulfilled == False) and (failed_only == True)): 149 if ((self.fulfilled == False) and (failed_only == True)):
138 print(str(self.type) + 150 # print(str(self.type) +
139 'condition for file ' + 151 # 'condition for file ' +
140 self.file + 152 # self.file +
141 ' was ' + 153 # ' was ' +
142 str(self.fulfilled)) 154 # str(self.fulfilled))
155 logger.debug('%s confition for file %s was %s', str(self.type), self.file, str(self.fulfilled))
143 elif (failed_only == False): 156 elif (failed_only == False):
144 print(str(self.type) + 157 # print(str(self.type) +
145 'condition for file ' + 158 # 'condition for file ' +
146 self.file + 159 # self.file +
147 ' was ' + 160 # ' was ' +
148 str(self.fulfilled)) 161 # str(self.fulfilled))
162 logger.debug('%s confition for file %s was %s', str(self.type), self.file, str(self.fulfilled))
149 return self.fulfilled 163 return self.fulfilled
150 164
151 165