--- /dev/null
+#!/bin/sh
+
+../../dinit -d sd -u -p socket -q &
+DINITPID=$!
+
+# give time for socket to open
+while [ ! -e socket ]; do
+ sleep 0.1
+done
+
+DINITCTLOUT="$(../../dinitctl -p socket list)"
+if [ "$DINITCTLOUT" != "$(cat expected-1)" ]; then
+ kill $DINITPID; wait $DINITPID
+ exit 1
+fi
+
+DINITCTLOUT="$(../../dinitctl -p socket stop critical 2>&1)"
+if [ "$DINITCTLOUT" != "$(cat expected-2.err)" ]; then
+ kill $DINITPID; wait $DINITPID
+ exit 1
+fi
+
+DINITCTLOUT="$(../../dinitctl -p socket stop --force critical 2>&1)"
+if [ "$DINITCTLOUT" != "$(cat expected-3)" ]; then
+ kill $DINITPID; wait $DINITPID
+ exit 1;
+fi
+
+# Note dinit should shutdown since all services stopped.
+wait $DINITPID
+
+# Passed:
+exit 0
int main(int argc, char **argv)
{
- const char * const test_dirs[] = { "basic", "environ", "ps-environ", "chain-to" };
+ const char * const test_dirs[] = { "basic", "environ", "ps-environ", "chain-to", "force-stop" };
constexpr int num_tests = sizeof(test_dirs) / sizeof(test_dirs[0]);
int passed = 0;