static struct ovs_mutex mutex;
-static void atexit_handler(void);
static void call_hooks(int sig_nr);
#ifdef _WIN32
static BOOL WINAPI ConsoleHandlerRoutine(DWORD dwCtrlType);
}
#endif
}
- atexit(atexit_handler);
+ atexit(fatal_signal_atexit_handler);
}
}
#endif
}
-static void
-atexit_handler(void)
+void
+fatal_signal_atexit_handler(void)
{
call_hooks(0);
}
void fatal_signal_run(void);
void fatal_signal_wait(void);
void fatal_ignore_sigpipe(void);
+void fatal_signal_atexit_handler(void);
/* Convenience functions for unlinking files upon termination.
*
[0], [ignore], [])
AT_CHECK([test ! -s pid])
AT_CLEANUP
+
+AT_SETUP([daemon --service])
+AT_SKIP_IF([test "$IS_WIN32" != "yes"])
+OVSDB_INIT([db])
+AT_CAPTURE_FILE([pid])
+# To create a Windows service, we need the absolute path for the executable.
+abs_path="$(cd $(dirname `which ovsdb-server`); pwd -W; cd $OLDPWD)"
+
+AT_CHECK([sc create ovsdb-server binpath="$abs_path/ovsdb-server `pwd`/db --log-file=`pwd`/ovsdb-server.log --pidfile=`pwd`/pid --remote=punix:`pwd`/socket --unixctl=`pwd`/unixctl --service"],
+[0], [[[SC]] CreateService SUCCESS
+])
+
+AT_CHECK([sc start ovsdb-server], [0], [ignore])
+OVS_WAIT_UNTIL([test -s pid])
+AT_CHECK([sc query ovsdb-server | grep STATE | grep RUNNING], [0], [ignore])
+AT_CHECK([kill -0 `cat pid`], [0], [ignore])
+AT_CHECK([ovs-appctl -t `pwd`/unixctl ovsdb-server/list-dbs], [0],
+[Open_vSwitch
+])
+AT_CHECK([sc stop ovsdb-server], [0], [ignore])
+OVS_WAIT_UNTIL([test ! -s pid])
+AT_CHECK([sc query ovsdb-server | grep STATE | grep STOPPED], [0], [ignore])
+AT_CHECK([sc delete ovsdb-server], [0], [[[SC]] DeleteService SUCCESS
+])
+AT_CLEANUP