[CRIU] [PATCH] zdtm.py: add YAML block with details to a TAP report

Sergey Bronnikov sergeyb at openvz.org
Thu Mar 17 04:45:18 PDT 2016


It was requested by Andrey.


This patch adds details about failed testcase to a TAP report:

TAP version 13
1..1
not ok 1 - zdtm/static/deleted_unix_sock # flavor h
---
"output": |2

  ==================== Run zdtm/static/deleted_unix_sock in h ====================
  Start test
  ./deleted_unix_sock --pidfile=deleted_unix_sock.pid --outfile=deleted_unix_sock.out --filename=deleted_unix_sock.test
  Makefile:277: recipe for target 'deleted_unix_sock.pid' failed
  make: *** [deleted_unix_sock.pid] Error 1
  ############### Test zdtm/static/deleted_unix_sock FAIL at start ###############
  Test output: ================================
  19:57:39.619:    24: ERR: deleted_unix_sock.c:51: can't bind to socket "deleted_unix_sock.test" (errno = 13 (Permission denied))
  19:57:39.619:    23: ERR: test.c:204: Test exited unexpectedly with code 1

   <<< ================================
...

Signed-off-by: Sergey Bronnikov <sergeyb at openvz.org>
---
 test/zdtm.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/zdtm.py b/test/zdtm.py
index a1611cc..2da0d59 100755
--- a/test/zdtm.py
+++ b/test/zdtm.py
@@ -19,6 +19,7 @@ import socket
 import fcntl
 import errno
 import datetime
+import yaml
 
 os.chdir(os.path.dirname(os.path.abspath(__file__)))
 
@@ -1079,7 +1080,9 @@ class launcher:
 				failed_flavor = decode_flav(os.WEXITSTATUS(status))
 				if self.__file_report:
 					testline = "not ok %d - %s # flavor %s" % (self.__runtest, sub['name'], failed_flavor)
+					details = { 'output': open(sub['log']).read() }
 					print >> self.__file_report, testline
+					print >> self.__file_report, yaml.dump(details, explicit_start=True, explicit_end=True, default_style='|')
 				if not opts['keep_going']:
 					self.__fail = True
 				if sub['log']:
-- 
2.5.0


-- 
sergeyb@


More information about the CRIU mailing list