Provide cross platform utilities for process creation

This may go into trond's Platform package one day. But this is meant to
be a means to redirect output and "asynchronously" spawn processes on
both Unix and Windows platforms

Change-Id: Ie8c8a9db5720093e8454b538b2eaa33a01a0a4b8
Reviewed-on: http://review.couchbase.org/28007
Reviewed-by: Mark Nunberg <mnunberg@haskalah.org>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Fixup warning causing build break

Change-Id: I740ed3aa340b8e294c7d9986e0fc8db9afb2083f
Reviewed-on: http://review.couchbase.org/28089
Tested-by: Trond Norbye <trond.norbye@gmail.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Provide more location options for Mock in startmock.sh

Change-Id: Ie5f464987a911b4ddc9db2d9b447d25ba6fd4f5e
Reviewed-on: http://review.couchbase.org/28090
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
mock-unit-tests: don't assume key is nul-terminated

Change-Id: I26d4414fedbd2b12b8f616fb2aaf7f5f07b14b78
Reviewed-on: http://review.couchbase.org/28114
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Don't embed non-ASCII literal into source code

This occasionally crashes on Windows. Use hex escapes instead.

Change-Id: I72024ea835ba60c846ecc9d89337688ed8d2861d
Reviewed-on: http://review.couchbase.org/28115
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
[url_encoding] cast to unsigned char for isalpha

This crashes the CRT on Windows when the character is out of the 7 bit
range

Change-Id: I8d3ee66c38651a24b0e5832d8c99edc1c6752f7c
Reviewed-on: http://review.couchbase.org/28116
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Add callbacks and more checks to CCBC-150 test

Change-Id: I125674c6a004efafb63c9934615c6380043ba00d
Reviewed-on: http://review.couchbase.org/28118
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Better signal handling for procutil

Check the various other types of termination and signal stats. Ignore
SIGSTOP/SIGCONT and handle abnormal termination by things like SIGABRT
and SIGSEGV and friends

Change-Id: I9bf48f1bc463aba41daac9cc55214bb550cf6f18
Reviewed-on: http://review.couchbase.org/28119
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Don't do copy constructors for mock commands

Change-Id: I0e149f8c1ac660d6fedc8db3d64176de360b1874
Reviewed-on: http://review.couchbase.org/28117
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
start_mock.bat - don't insert lone quotes

Change-Id: I911db0992116b794c9a4362827bcd459a8040596
Reviewed-on: http://review.couchbase.org/28121
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Provide description for NO_MATCHING_SERVER

Change-Id: Ica53fa29590375bffe33bf73c9373e0f81cd78fe
Reviewed-on: http://review.couchbase.org/28122
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
[iofactory] Refactor

This allows reading of the 'normal' environment variables on Windows,
with behavior similar to what is on Unix

The massive code additions were for making these features reasonably
testable and accessible from the API. While an environment variable
might be a trivial thing, it's quite difficult to figure out what's
wrong when all you have to work with is an environment variable; so
included are tests which should work on both Unix and Win32 with similar
semantics.

Change-Id: I0ab1c1b1b646233bae1308b892d3500069289de8
Reviewed-on: http://review.couchbase.org/28048
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
io: Allow asynchronous errors for socket init failures

Sometimes we don't get a callback if the socket itself could not be
created. We offer the option to convert it into one

Change-Id: I1552fd6a93855f86f79c4f3932daa5154b63c5d9
Reviewed-on: http://review.couchbase.org/28131
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
[select] Check for both timers and events before breaking

Change-Id: Ib41b8641791f60ffb03dc2cc1b75cf418eb465a9
Reviewed-on: http://review.couchbase.org/28132
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Provide 'last_error' connection field

This is mainly useful during the connect sequence and can be helpful in
debugging various errors along the way. The LCB error at this point is
rather unhelpful (something we might want to change in the future) and
does not intend to expose the full array of OS errors anyway.

Change-Id: If537289fa2ead15491ee07f3fea9aee8b7a21790
Reviewed-on: http://review.couchbase.org/28133
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
[select] Add LCB_ERROR_EVENT

This special event is delivered when an FD is set with 'exceptfds'. In
this case we check the socket error with getsockopt, and hopefully be
more timely when a connection is refused.

Change-Id: I96865df6800e10add25244029fc34cb85b8a7730
Reviewed-on: http://review.couchbase.org/28134
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Add IOPS unit tests

Currently this doesn't do much except test timers, but it's good to have
as we expand our array of plugins

Change-Id: I34664fd25f736624836207938e63ec7d8128c5f4
Reviewed-on: http://review.couchbase.org/28135
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
[iops-unit-tests] Free timers in dtor

Change-Id: Ic135cd927a5912b7a3e770f92794f810f106f1d3
Reviewed-on: http://review.couchbase.org/28187
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Run tests against all plugins

This "Script" is written in C++ and is cross platform (i.e. works on
both Linux and Windows). It provides options for running the test suite
against different plugins as well as other options such as running them
under a debugger.

Change-Id: I1f9710dec850f252024ee037b962d526b7326a2d
Reviewed-on: http://review.couchbase.org/28008
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Mark Nunberg <mnunberg@haskalah.org>
Run 'smoke-test' on Win32

Change-Id: I24146d26923615f953aca7d318cef16785aa9d5d
Reviewed-on: http://review.couchbase.org/28033
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>