git://git.onelab.eu
/
tests.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
80751a1
)
log all header output as well as commands and their output
author
Tony Mack
<tmack@cs.princeton.edu>
Thu, 7 Feb 2008 23:45:33 +0000
(23:45 +0000)
committer
Tony Mack
<tmack@cs.princeton.edu>
Thu, 7 Feb 2008 23:45:33 +0000
(23:45 +0000)
qaapi/qa/utils.py
patch
|
blob
|
history
diff --git
a/qaapi/qa/utils.py
b/qaapi/qa/utils.py
index
52e359f
..
c4de8d5
100644
(file)
--- a/
qaapi/qa/utils.py
+++ b/
qaapi/qa/utils.py
@@
-2,16
+2,20
@@
import time
import os
import commands
import time
import os
import commands
+from logger import logfile
def header(message):
now=time.strftime("%H:%M:%S", time.localtime())
def header(message):
now=time.strftime("%H:%M:%S", time.localtime())
- print "*",now,'--',message
+ output = "*"+now+'--'+message
+ print output
+ print >> logfile, output
def popen(command, fatal=True):
(stdin, stdout, stderr) = os.popen3(command)
output = stdout.readlines()
def popen(command, fatal=True):
(stdin, stdout, stderr) = os.popen3(command)
output = stdout.readlines()
-
+ print >> logfile, "+ "+command
+ print >> logfile, "".join(output).strip()
# filter output generated by set x
remove_set_x = lambda line: not line.startswith("+")
errors = filter(remove_set_x, stderr.readlines())
# filter output generated by set x
remove_set_x = lambda line: not line.startswith("+")
errors = filter(remove_set_x, stderr.readlines())
@@
-22,6
+26,8
@@
def popen(command, fatal=True):
def commands(command, fatal = True):
(status, output) = commands.getstatusoutput(command)
def commands(command, fatal = True):
(status, output) = commands.getstatusoutput(command)
+ print >> logfile, "+ "+command
+ print >> logfile, output.strip()
if fatal and not status == 0:
raise Exception, "%(command)s Failed:\n%(output)s" % locals()
return (status, output)
if fatal and not status == 0:
raise Exception, "%(command)s Failed:\n%(output)s" % locals()
return (status, output)