[gnome-continuous/wip/systemtests] wip



commit bcf50e89386abc2897a13fb58560dbc06372ea15
Author: Colin Walters <walters verbum org>
Date:   Sun Dec 1 18:45:17 2013 -0500

    wip

 src/system-tests/coredump/systemtest-coredump      |   47 ++++++++++++++++++++
 .../coredump/systemtest-coredump.service           |    5 ++
 src/system-tests/systemtest.js                     |    2 +
 3 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/src/system-tests/coredump/systemtest-coredump b/src/system-tests/coredump/systemtest-coredump
new file mode 100644
index 0000000..f9b8656
--- /dev/null
+++ b/src/system-tests/coredump/systemtest-coredump
@@ -0,0 +1,47 @@
+#!/usr/bin/env gjs
+// -*- mode: javascript -*-
+
+const GLib = imports.gi.GLib;
+const Gio = imports.gi.Gio;
+
+let running = true;
+let success = false;
+
+let sleepProc = Gio.Subprocess.new(['sleep', '1d'], 0);
+sleepProc.init(null);
+let pid = parseInt(sleepProc.get_identifier());
+
+let journalctlProc = Gio.Subprocess.new(['journalctl', '-o', 'json', '-f',
+                                        'MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1'],
+                                       Gio.SubprocessFlags.STDOUT_PIPE);
+journalctlProc.init(null);
+let journalOut = Gio.DataInputStream.new(journalctlProc.get_stdout_pipe());
+function onJournalReadLine(src, result) {
+    let line, len;
+    try {
+       [line, len] = src.read_line_finish_utf8(result);
+    } catch (e) {
+       print("Caught " + e);
+       running = false;
+       return;
+    }
+    let msg = JSON.parse(line);
+    let coredumpExe = msg['COREDUMP_EXE'];
+    if (coredumpExe.indexOf('sleep') >= 0) {
+       print("Found COREDUMP_EXE=" + coredumpExe);
+       running = false;
+       success = true;
+    } else {
+       journalout.read_line_async(GLib.PRIORITY_DEFAULT, null, onJournalReadLine);
+    }
+}
+journalout.read_line_async(GLib.PRIORITY_DEFAULT, null, onJournalReadLine);
+
+let killProc = Gio.Subprocess.new(['kill', '-11', '' + pid], 0);
+killProc.init(null);
+
+let context = GLib.MainContext.default();
+while (running)
+    context.iteration(true);
+
+success ? 0 : 1;
diff --git a/src/system-tests/coredump/systemtest-coredump.service 
b/src/system-tests/coredump/systemtest-coredump.service
new file mode 100644
index 0000000..c992d3b
--- /dev/null
+++ b/src/system-tests/coredump/systemtest-coredump.service
@@ -0,0 +1,5 @@
+[Unit]
+Description=Test a coredump
+
+[Service]
+ExecStart=/usr/bin/gnome-continuous-systemtest-coredump
diff --git a/src/system-tests/systemtest.js b/src/system-tests/systemtest.js
new file mode 100644
index 0000000..f368b46
--- /dev/null
+++ b/src/system-tests/systemtest.js
@@ -0,0 +1,2 @@
+
+function await


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]