util: Make WSAStartup available outside stream.c.

WSAStartup() needs to be called before using winsock2 related
functions. We need this for almost all the utilities. So call
it through OVS_CONSTRUCTOR.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
test-util: Changes for 'assert' test on Windows.

There is no 'kill -l' type functionality available on Windows.
So instead of looking for the string 'ABRT', check for the exit
code in both platforms. On msys (unit test environment), it is 9
and on Linux, it is 134 (SIGABRT + 128).

On Windows, stderr is fully buffered if connected to a pipe.
Make it _IONBF so that an abort does not miss log contents.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
daemon-windows: unlink pidfile before stopping the service.

When a OVS daemon is configured to run as a Windows service,
when the service is stopped by calling service_stop(), the
windows services manager does not give enough time to do
everything in the atexit handler. So call the exit handler
directly from service_stop().

Also add a test case for Windows services which checks for
the termination of the service by looking at pidfile cleaned
by the exit handler.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com
Acked-by: Ben Pfaff <blp@nicira.com>
util: Don't compile couple of unused function for Windows.

basename() and dir_name() are not used for Windows and won't work well if
used. So put a '#ifndef _WIN32' around them to prevent future calls.

test-file_name.c tests the above 2 functions. It makes sense to merge
this single function file with test-util.c and then not compile it for
Windows.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lockfile: Modify tests for Windows.

As of now, when a process tries to reacquire a lockfile, we
return EEXIST on Windows and print a different error message.
This means that the unit tests need to look for different error
messages too. Linux uses EDEADLK for the same. EDEADLK feels like
a good error description for Windows too and this also lets us
not change the tests too much. So use it.

Some of the tests in test-lockfile.c uses fork to test a
child's ability to acquire lock. We do not fork in Windows.
We also do not support symlinks on Windows.  So, comment out
those tests.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
atlocal: Disable Python related tests on Windows.

Most of the Python code in Open vSwitch repo does not work
on Windows. Till that porting is done, simply skip all
Python tests.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>