summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2008-06-29 22:18:39 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2008-06-29 22:18:39 +0000
commitc341a03404a9466e150cd035b8cf8df6f7158da1 (patch)
tree4f3481eff4439f68d050ba83edc3520328d862db /test
parent60d37c75f9704cdf5f1e57cff3d29982c65f3024 (diff)
downloadnixpkgs-c341a03404a9466e150cd035b8cf8df6f7158da1.tar
nixpkgs-c341a03404a9466e150cd035b8cf8df6f7158da1.tar.gz
nixpkgs-c341a03404a9466e150cd035b8cf8df6f7158da1.tar.bz2
nixpkgs-c341a03404a9466e150cd035b8cf8df6f7158da1.tar.lz
nixpkgs-c341a03404a9466e150cd035b8cf8df6f7158da1.tar.xz
nixpkgs-c341a03404a9466e150cd035b8cf8df6f7158da1.tar.zst
nixpkgs-c341a03404a9466e150cd035b8cf8df6f7158da1.zip
* A little script to test changes to individual Upstart jobs,
  i.e., only the specified jobs are rebuilt and restarted.
  Example:

  $ test/test-upstart-job.sh udev

  will rebuild and restart just the udev service.  This is useful
  e.g. when making changes to the udev package, which would
  normally entail rebuilding lots of other services as well 
  (e.g. the X service might depend on KDE, which depends on HAL,
  which depends on udev...).

  It's implemented by making a copy of the current /etc/event.d 
  in /tmp/event.d, then replacing only those jobs indicated on the
  command line, symlinking /etc/event.d to /tmp/event.d, and 
  restarting init.

svn path=/nixos/trunk/; revision=12217
Diffstat (limited to 'test')
-rwxr-xr-xtest/test-upstart-job.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test-upstart-job.sh b/test/test-upstart-job.sh
new file mode 100755
index 00000000000..626aed806ae
--- /dev/null
+++ b/test/test-upstart-job.sh
@@ -0,0 +1,25 @@
+#! /bin/sh -e
+
+tmpDir=/tmp/event.d
+
+rm -rf $tmpDir
+
+cp -prd $(readlink -f /etc/event.d) /tmp/event.d
+
+for i in $*; do
+    echo "building job $i..."
+    nix-build /etc/nixos/nixos -A "upstartJobs.$i" -o $tmpDir/.result
+    ln -sfn $(readlink -f $tmpDir/.result)/etc/event.d/* /tmp/event.d/
+done
+
+ln -sfn /tmp/event.d /etc/event.d
+
+echo "restarting init..."
+kill -TERM 1 
+
+for i in $*; do
+    echo "restarting job $i..."
+    initctl stop "$i"
+    sleep 1
+    initctl start "$i"
+done