summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/boot-environment.nix10
-rw-r--r--test/upstart-jobs/halt.nix23
-rw-r--r--test/upstart-jobs/maintenance-shell.nix19
3 files changed, 52 insertions, 0 deletions
diff --git a/test/boot-environment.nix b/test/boot-environment.nix
index b70906b13f6..887e8feb978 100644
--- a/test/boot-environment.nix
+++ b/test/boot-environment.nix
@@ -101,6 +101,16 @@ rec {
       (import ./upstart-jobs/dhclient.nix {
         dhcp = pkgs.dhcpWrapper;
       })
+
+      # Handles the maintenance/stalled event (single-user shell).
+      (import ./upstart-jobs/maintenance-shell.nix {
+        inherit (pkgs) bash;
+      })
+
+      # Handles the reboot/halt events.
+      (import ./upstart-jobs/halt.nix {
+        inherit (pkgs) bash;
+      })
     ]
 
     # The terminals on ttyX.
diff --git a/test/upstart-jobs/halt.nix b/test/upstart-jobs/halt.nix
new file mode 100644
index 00000000000..f259ea77cc9
--- /dev/null
+++ b/test/upstart-jobs/halt.nix
@@ -0,0 +1,23 @@
+{bash}:
+
+{
+  name = "sys-halt";
+  
+  job = "
+start on reboot
+start on halt
+start on system-halt
+start on power-off
+
+script
+    exec < /dev/tty1 > /dev/tty1 2>&1
+    echo \"\"
+    echo \"<<< SYSTEM SHUTDOWN >>>\"
+    echo \"\"
+
+    # Right now all events above power off the system.
+    exec halt -f -p
+end script
+  ";
+  
+}
diff --git a/test/upstart-jobs/maintenance-shell.nix b/test/upstart-jobs/maintenance-shell.nix
new file mode 100644
index 00000000000..9e2acdaa0f5
--- /dev/null
+++ b/test/upstart-jobs/maintenance-shell.nix
@@ -0,0 +1,19 @@
+{bash}:
+
+{
+  name = "maintenance-shell";
+  
+  job = "
+start on maintenance
+start on stalled
+
+script
+    exec < /dev/tty1 > /dev/tty1 2>&1
+    echo \"\"
+    echo \"<<< MAINTENANCE SHELL >>>\"
+    echo \"\"
+    exec ${bash}/bin/sh
+end script
+  ";
+  
+}