[pkg-fso-commits] [SCM] Automatic Display Manager branch, bug540201, updated. debian/0.6-1-43-g57ac67b
Enrico Zini
enrico at enricozini.org
Wed Jul 6 11:00:59 UTC 2011
The following commit has been merged in the bug540201 branch:
commit 6c46219bf2cac0fd8335de4f801486751ff4e117
Author: Enrico Zini <enrico at enricozini.org>
Date: Wed Jul 6 11:43:16 2011 +0200
More session test cases
diff --git a/test-xsession.c b/test-xsession.c
index 6b17cac..41eae06 100644
--- a/test-xsession.c
+++ b/test-xsession.c
@@ -21,15 +21,38 @@
#include "log.h"
#include "common.h"
#include "dm.h"
+#include "xserver.h"
+#include "xsession-child.h"
#include "test.h"
#include <stdio.h>
#include <stdlib.h>
+#include <sys/types.h>
+#include <signal.h>
+#include <unistd.h>
int test_session(struct nodm_xsession_child* s)
{
return E_SUCCESS;
}
+int test_session_bad(struct nodm_xsession_child* s)
+{
+ return E_USAGE;
+}
+
+int test_session_x_killer(struct nodm_xsession_child* s)
+{
+ if (s->srv->pid == -1)
+ {
+ fprintf(stderr, "server PID has not been set\n");
+ return E_BAD_ARG;
+ }
+ kill(s->srv->pid, SIGTERM);
+ sleep(10);
+ return E_SUCCESS;
+}
+
+// X server starts, X session quits with success
void test_trivial_session()
{
struct nodm_display_manager dm;
@@ -45,6 +68,7 @@ void test_trivial_session()
nodm_display_manager_cleanup(&dm);
}
+// X server does not start
void test_bad_x_server()
{
struct nodm_display_manager dm;
@@ -68,17 +92,51 @@ void test_bad_x_server()
nodm_display_manager_cleanup(&dm);
}
+// X server starts, X session quits with error
+void test_failing_x_session()
+{
+ struct nodm_display_manager dm;
+ nodm_display_manager_init(&dm);
+ ensure_succeeds(nodm_display_manager_parse_xcmdline(&dm, "/usr/bin/Xnest :1 -geometry 1x1+0+0"));
+ dm.session.conf_use_pam = false;
+ dm.session.conf_cleanup_xse = false;
+ dm.session.conf_run_as[0] = 0;
+ dm.session.child_body = test_session_bad;
+
+ ensure_succeeds(nodm_display_manager_start(&dm));
+ ensure_succeeds(nodm_display_manager_wait(&dm));
+ ensure_succeeds(nodm_display_manager_stop(&dm));
+ nodm_display_manager_cleanup(&dm);
+}
+
+// X server starts, X session starts, then server dies
+void test_dying_x_server()
+{
+ struct nodm_display_manager dm;
+ nodm_display_manager_init(&dm);
+ ensure_succeeds(nodm_display_manager_parse_xcmdline(&dm, "/usr/bin/Xnest :1 -geometry 1x1+0+0"));
+ dm.session.conf_use_pam = false;
+ dm.session.conf_cleanup_xse = false;
+ dm.session.conf_run_as[0] = 0;
+ dm.session.child_body = test_session_x_killer;
+
+ ensure_succeeds(nodm_display_manager_start(&dm));
+ ensure_succeeds(nodm_display_manager_wait(&dm));
+ ensure_succeeds(nodm_display_manager_stop(&dm));
+ nodm_display_manager_cleanup(&dm);
+}
+
int main(int argc, char* argv[])
{
test_start("test-xsession", false);
test_trivial_session();
test_bad_x_server();
+ test_failing_x_session();
+ test_dying_x_server();
// TODO:
- // - test a wrong xserver command line (dying X server)
- // - test a wrong username (dying X session)
- // - start everything fine then kill the X server
+ // - test a wrong username (error before starting X session)
test_ok();
}
--
Automatic Display Manager
More information about the pkg-fso-commits
mailing list