Skip to content

Instantly share code, notes, and snippets.

@vrutkovs
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save vrutkovs/a2d7ddd6dcb2c6067fb2 to your computer and use it in GitHub Desktop.

Select an option

Save vrutkovs/a2d7ddd6dcb2c6067fb2 to your computer and use it in GitHub Desktop.
From c279d9a1f58b8d3b0d805232f786f301403f8fea Mon Sep 17 00:00:00 2001
From: Vadim Rutkovsky <vrutkovs@redhat.com>
Date: Thu, 5 Mar 2015 14:45:02 +0100
Subject: [PATCH] smoketest: support both Automatic and Timed Login smoketest
We should check both login paths, in case one of them got broken.
This also switches default login type to Automatic.
Default Timed login timeout is 30 seconds, which is too much - we'll boot
with 10 seconds delay - this should be enough to verify that timedlogin
works and make screenshots of login indicator
---
.../partials/gnome-continuous-build.html | 17 +++++++++++++++++
src/js/libqa.js | 18 +++++++++++++-----
src/js/tasks/task-smoketest.js | 12 ++++++++++++
src/js/tasks/testbase.js | 6 ++++--
4 files changed, 46 insertions(+), 7 deletions(-)
diff --git a/extras/build.gnome.org/partials/gnome-continuous-build.html b/extras/build.gnome.org/partials/gnome-continuous-build.html
index ec12da2..70f8c92 100644
--- a/extras/build.gnome.org/partials/gnome-continuous-build.html
+++ b/extras/build.gnome.org/partials/gnome-continuous-build.html
@@ -140,6 +140,23 @@
</span>
</div>
+ <div ng-if="tasks.get('smoketest-timed').length > 0"
+ ng-init='task = tasks.get("smoketest-timed")[0]'>
+ <span ng-if='task.started'>
+ <span ng-if='task.complete'>
+ <span ng-if='task.success'>
+ <span class='task-succeded'>Smoketest Timed Login</span><span> completed in {{ task.elapsed }}s</span> <a href="{{ buildRoot+task.name }}/work-gnome-continuous-x86_64-runtime/screenshot-final.png">screenshot</a>
+ </span>
+ <span ng-if='!task.success'>
+ <span class='task-failed'>Smoketest Timed Login</span><span> <a href="{{ buildRoot+task.name }}">failed</a></span>
+ </span>
+ </span>
+ <span ng-if='!task.complete'>
+ <span class='task-running'>Smoketest Timed Login</span><span> in progress</span>
+ </span>
+ </span>
+ </div>
+
<div ng-if="tasks.get('integrationtest').length > 0"
ng-init='task = tasks.get("integrationtest")[0]'>
<span ng-if='task.started'>
diff --git a/src/js/libqa.js b/src/js/libqa.js
index 297cb96..ad2d709 100644
--- a/src/js/libqa.js
+++ b/src/js/libqa.js
@@ -219,7 +219,7 @@ RateLimitInterval=0\n', null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, ca
}
function injectTestUserCreation(currentDir, currentEtcDir, username, params, cancellable) {
- params = Params.parse(params, { password: null, session: null });
+ params = Params.parse(params, { password: null, session: null, loginType: null });
let passwordCommand, setSessionCommand;
let commandTemplate = '/usr/bin/dbus-send --print-reply --reply-timeout=60000 --system --type=method_call --print-reply' +
' --dest=org.freedesktop.Accounts /org/freedesktop/Accounts%s org.freedesktop.Accounts.%s %s'
@@ -252,13 +252,21 @@ ExecStart=%s\n\
addUserServicePath.replace_contents(addUserService, null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, cancellable);
}
-function enableAutologin(currentDir, currentEtcDir, username, cancellable) {
+function enableAutologin(currentDir, currentEtcDir, username, loginType, 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', 'TimedLoginEnable', 'true');
- keyfile.set_string('daemon', 'TimedLoginDelay', '10');
- keyfile.set_string('daemon', 'TimedLogin', username);
+ let loginString = null;
+ if (loginType === null) {
+ loginString = 'Automatic'
+ } else {
+ loginString = loginType
+ }
+ keyfile.set_string('daemon', loginString + 'LoginEnable', 'true');
+ keyfile.set_string('daemon', loginString + 'Login', username);
+ if (loginType == 'Timed') {
+ keyfile.set_string('daemon', 'TimedLoginDelay', '10');
+ }
keyfile.set_string('debug', 'Enable', 'true');
gdmCustomPath.replace_contents(keyfile.to_data()[0], null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, cancellable);
}
diff --git a/src/js/tasks/task-smoketest.js b/src/js/tasks/task-smoketest.js
index 3115e81..fe7d3bf 100644
--- a/src/js/tasks/task-smoketest.js
+++ b/src/js/tasks/task-smoketest.js
@@ -81,3 +81,15 @@ const TaskSmoketestWayland = new Lang.Class({
GdmSession: 'gnome-wayland',
});
+
+const TaskSmoketestTimed = new Lang.Class({
+ Name: 'TaskSmoketestTimed',
+ Extends: SmoketestBase,
+
+ TaskDef: {
+ TaskName: "smoketest-timed",
+ TaskAfter: ['builddisks'],
+ },
+
+ LoginType: 'Timed',
+});
\ No newline at end of file
diff --git a/src/js/tasks/testbase.js b/src/js/tasks/testbase.js
index af5be1e..5eeaa17 100644
--- a/src/js/tasks/testbase.js
+++ b/src/js/tasks/testbase.js
@@ -71,12 +71,13 @@ const CommandSocketProxy = new Lang.Class({
const TestOneDisk = new Lang.Class({
Name: 'TestOneDisk',
- _init: function(parentTask, testRequiredMessageIds, testFailedMessageIds, testStatusMessageId, testGdmSession, timeout) {
+ _init: function(parentTask, testRequiredMessageIds, testFailedMessageIds, testStatusMessageId, testGdmSession, testLoginType, timeout) {
this._parentTask = parentTask;
this._testRequiredMessageIds = testRequiredMessageIds;
this._testFailedMessageIds = testFailedMessageIds;
this._statusMessageId = testStatusMessageId;
this._gdmSession = testGdmSession;
+ this._loginType = testLoginType;
this._timeout = timeout;
},
@@ -456,7 +457,7 @@ const TestOneDisk = new Lang.Class({
const username = 'testuser';
LibQA.injectTestUserCreation(currentDir, currentEtcDir, username, {session: this._gdmSession}, cancellable);
- LibQA.enableAutologin(currentDir, currentEtcDir, username, cancellable);
+ LibQA.enableAutologin(currentDir, currentEtcDir, username, this._loginType, cancellable);
this._parentTask._prepareDisk(mntdir, this._diskArch, cancellable);
} finally {
@@ -631,6 +632,7 @@ const TestBase = new Lang.Class({
this.BaseFailedMessageIDs.concat(this.FailedMessageIDs),
this.StatusMessageID,
this.GdmSession,
+ this.LoginType,
this.Timeout);
test.execute(this.subworkdir, this._buildData, this.repo, currentImages.get_child(name), cancellable);
}
--
1.8.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment