summaryrefslogtreecommitdiff
path: root/test-cli/test/tasks/generatedmesg.py
diff options
context:
space:
mode:
authorHector Fernandez <hector@iatec.biz>2020-06-17 09:44:56 +0200
committerHector Fernandez <hector@iatec.biz>2020-06-17 09:44:56 +0200
commit09b3bb38fc7305c9b47c29bc90ebc9c636827307 (patch)
treea793c8f232031183960178d2a18fcde4baf3348f /test-cli/test/tasks/generatedmesg.py
parent0dd2613b88d937e71b274d68924088b1bad65de4 (diff)
downloadboard-09b3bb38fc7305c9b47c29bc90ebc9c636827307.zip
board-09b3bb38fc7305c9b47c29bc90ebc9c636827307.tar.gz
board-09b3bb38fc7305c9b47c29bc90ebc9c636827307.tar.bz2
SOPA0000: Added support for saving results (strings or files) in the DB. It also saves a final DMESG file.
Diffstat (limited to 'test-cli/test/tasks/generatedmesg.py')
-rw-r--r--test-cli/test/tasks/generatedmesg.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test-cli/test/tasks/generatedmesg.py b/test-cli/test/tasks/generatedmesg.py
new file mode 100644
index 0000000..f0a3418
--- /dev/null
+++ b/test-cli/test/tasks/generatedmesg.py
@@ -0,0 +1,17 @@
+import sh
+
+
+def generate_dmesg(tidctl, pgObj):
+ print("Start getting DMESG...")
+ p = sh.dmesg()
+ if p.exit_code != 0:
+ print("DMESG: Unknown error.")
+ return 1
+ else:
+ # save dmesg in a file
+ with open('/tmp/dmesg.txt', 'w') as outfile:
+ n = outfile.write(p.stdout.decode('ascii'))
+ # save dmesg result in DB
+ pgObj.upload_dmesg(tidctl, '/tmp/dmesg.txt')
+ print("DMESG: saved succesfully.")
+ return 0