From: Ondrej Lichtner <olichtne(a)redhat.com>
Adding the Result summary print to the end of the example recipe
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
recipes/examples/python_recipe.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/recipes/examples/python_recipe.py b/recipes/examples/python_recipe.py
index 43fa95d..00dd329 100755
--- a/recipes/examples/python_recipe.py
+++ b/recipes/examples/python_recipe.py
@@ -4,6 +4,7 @@ This is an example python recipe that can be run as an executable script.
Performs a simple ping between two hosts.
"""
+import logging
from lnst.Common.Parameters import IpParam
from lnst.Common.IpAddress import ipaddress
from lnst.Controller import Controller
@@ -24,6 +25,9 @@ from lnst.Tests.Netperf import Netperf, Netserver
import signal
+
+from lnst.Controller.RunSummaryFormatter import RunSummaryFormatter
+
class MyRecipe(BaseRecipe):
m1 = HostReq()
m1.eth0 = DeviceReq(label="net1")
@@ -118,3 +122,7 @@ ctl = Controller(debug=1)
r = MyRecipe()
ctl.run(r, allow_virt=True)
+
+summary_fmt = RunSummaryFormatter()
+for run in r.runs:
+ logging.info(summary_fmt.format_run(run))
--
2.16.1