[gnome-ostree] smoketest: Attempt to log in too
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-ostree] smoketest: Attempt to log in too
- Date: Sat, 19 Jan 2013 19:35:48 +0000 (UTC)
commit f0779cee04efcd0c09324c79622e24c2db99c6a1
Author: Colin Walters <walters verbum org>
Date: Sat Jan 19 14:33:49 2013 -0500
smoketest: Attempt to log in too
src/ostbuild/js/builtins/qa_smoketest.js | 22 ++++++-------
src/ostbuild/js/libqa.js | 51 ++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 12 deletions(-)
---
diff --git a/src/ostbuild/js/builtins/qa_smoketest.js b/src/ostbuild/js/builtins/qa_smoketest.js
index 6a8decd..2ffa596 100644
--- a/src/ostbuild/js/builtins/qa_smoketest.js
+++ b/src/ostbuild/js/builtins/qa_smoketest.js
@@ -35,8 +35,12 @@ const QaSmokeTest = new Lang.Class({
Name: 'QaSmokeTest',
RequiredMessageIDs: ["39f53479d3a045ac8e11786248231fbf", // graphical.target
- "f77379a8490b408bbe5f6940505a777b"], // systemd-journald
- FailedMessageIDs: ["fc2e22bc6ee647b6b90729ab34a250b1"], // coredump
+ "f77379a8490b408bbe5f6940505a777b", // systemd-journald
+ "0ce153587afa4095832d233c17a88001" // gnome-session startup ok
+ ],
+ FailedMessageIDs: ["fc2e22bc6ee647b6b90729ab34a250b1", // coredump
+ "10dd2dc188b54a5e98970f56499d1f73" // gnome-session required component failed
+ ],
_onQemuExited: function(proc, result) {
let [success, status] = ProcUtil.asyncWaitCheckFinish(proc, result);
@@ -93,6 +97,7 @@ const QaSmokeTest = new Lang.Class({
loop.quit();
}
}
+ }
}
if (this._countPendingRequiredMessageIds > 0) {
this._readingJournal = true;
@@ -154,17 +159,10 @@ const QaSmokeTest = new Lang.Class({
LibQA.modifyBootloaderAppendKernelArgs(mntdir, ["console=ttyS0"], cancellable);
let [currentDir, currentEtcDir] = LibQA.getDeployDirs(mntdir, 'gnome-ostree');
- let binDir = currentDir.resolve_relative_path('usr/bin');
- // let systemdSystemDir = currentDir.resolve_relative_path('usr/lib/systemd/system');
- let multiuserWantsDir = currentEtcDir.resolve_relative_path('systemd/system/multi-user.target.wants');
- let datadir = Gio.File.new_for_path(GLib.getenv('OSTBUILD_DATADIR'));
- let exportScript = datadir.resolve_relative_path('tests/gnome-ostree-export-journal-to-serialdev');
- let exportScriptService = datadir.resolve_relative_path('tests/gnome-ostree-export-journal-to-serialdev.service');
- let exportBin = binDir.get_child(exportScript.get_basename());
- exportScript.copy(exportBin, 0, cancellable, null, null);
- GSystem.file_chmod(exportBin, 493, cancellable);
- exportScriptService.copy(multiuserWantsDir.get_child(exportScriptService.get_basename()), 0, cancellable, null, null);
+ LibQA.injectExportJournal(currentDir, currentEtcDir, cancellable);
+ LibQA.injectTestUserCreation(currentDir, currentEtcDir, 'smoketest', {}, cancellable);
+ LibQA.enableAutologin(currentDir, currentEtcDir, 'smoketest', cancellable);
} finally {
gfmnt.umount(cancellable);
}
diff --git a/src/ostbuild/js/libqa.js b/src/ostbuild/js/libqa.js
index d95a547..429ac91 100644
--- a/src/ostbuild/js/libqa.js
+++ b/src/ostbuild/js/libqa.js
@@ -91,6 +91,57 @@ function modifyBootloaderAppendKernelArgs(mntdir, kernelArgs, cancellable) {
cancellable);
}
+function getMultiuserWantsDir(currentEtcDir) {
+ return currentEtcDir.resolve_relative_path('systemd/system/multi-user.target.wants');
+}
+
+function getDatadir() {
+ return Gio.File.new_for_path(GLib.getenv('OSTBUILD_DATADIR'));
+}
+
+function injectExportJournal(currentDir, currentEtcDir, cancellable) {
+ let binDir = currentDir.resolve_relative_path('usr/bin');
+ let multiuserWantsDir = getMultiuserWantsDir(currentEtcDir);
+ let datadir = getDatadir();
+ let exportScript = datadir.resolve_relative_path('tests/gnome-ostree-export-journal-to-serialdev');
+ let exportScriptService = datadir.resolve_relative_path('tests/gnome-ostree-export-journal-to-serialdev.service');
+ let exportBin = binDir.get_child(exportScript.get_basename());
+ exportScript.copy(exportBin, 0, cancellable, null, null);
+ GSystem.file_chmod(exportBin, 493, cancellable);
+ exportScriptService.copy(multiuserWantsDir.get_child(exportScriptService.get_basename()), 0, cancellable, null, null);
+}
+
+function injectTestUserCreation(currentDir, currentEtcDir, username, params, cancellable) {
+ params = Params.parse(params, { password: null });
+ let execLine;
+ if (params.password === null) {
+ execLine = Format.vprintf('/bin/sh -c "/usr/sbin/useradd %s; passwd -d %s"',
+ [username, username]);
+ } else {
+ execLine = Format.vprintf('/bin/sh -c "/usr/sbin/useradd %s; echo %s | passwd --stdin %s',
+ [username, params.password, username]);
+ }
+ let addUserService = '[Unit]\n\
+Description=Add user %s\n\
+Before=gdm.service\n\
+[Service]\n\
+ExecStart=%s\n\
+Type=oneshot\n';
+ addUserService = Format.vprintf(addUserService, [username, execLine]);
+
+ let addUserServicePath = getMultiuserWantsDir(currentEtcDir).get_child('gnome-ostree-add-user-' + username + '.service');
+ addUserServicePath.replace_contents(addUserService, null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, cancellable);
+}
+
+function enableAutologin(currentDir, currentEtcDir, username, cancellable) {
+ let gdmCustomPath = currentEtcDir.resolve_relative_path('gdm/custom.conf');
+ let keyfile = new GLib.KeyFile();
+ keyfile.load_from_file(gdmCustomPath.get_path(), GLib.KeyFileFlags.NONE);
+ keyfile.set_string('daemon', 'AutomaticLoginEnable', 'true');
+ keyfile.set_string('daemon', 'AutomaticLogin', username);
+ gdmCustomPath.replace_contents(keyfile.to_data()[0], null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, cancellable);
+}
+
function _findCurrentKernel(mntdir, osname, cancellable) {
let deployBootdir = mntdir.resolve_relative_path('ostree/deploy/' + osname + '/current/boot');
let d = deployBootdir.enumerate_children('standard::*', Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, cancellable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]