summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.cpm>2012-02-16 10:06:17 +0900
committerMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:06:17 +0900
commitbf27a8a5282dab443335d8a8ab62cdf8fe1f6a95 (patch)
tree837bbb218bc7c0b07766752d025e6bea293d3316
parent802d84df533c131f91fbc599dae915390fad3e2b (diff)
Windows version of the tests implemented
Signed-off-by: Martin Sustrik <sustrik@250bpm.cpm>
-rw-r--r--builds/msvc/msvc10.sln13
-rw-r--r--builds/msvc/tests/tests.vcxproj87
-rw-r--r--src/ctx.cpp2
-rw-r--r--tests/pair_ipc.cpp9
-rw-r--r--tests/reqrep_ipc.cpp9
-rw-r--r--tests/shutdown_stress.cpp9
-rw-r--r--tests/tests.cpp120
-rw-r--r--tests/timeo.cpp8
8 files changed, 256 insertions, 1 deletions
diff --git a/builds/msvc/msvc10.sln b/builds/msvc/msvc10.sln
index 2345b58..8e88ac8 100644
--- a/builds/msvc/msvc10.sln
+++ b/builds/msvc/msvc10.sln
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
+# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxs", "libxs\libxs.vcxproj", "{641C5F36-32EE-4323-B740-992B651CF9D6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "local_lat", "local_lat\local_lat.vcxproj", "{4FDB8C73-9D4A-4D87-A4A9-A7FC06DFEA57}"
@@ -15,6 +15,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "inproc_lat", "inproc_lat\in
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "inproc_thr", "inproc_thr\inproc_thr.vcxproj", "{1077E977-95DD-4E73-A692-74647DD0CC1E}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "tests\tests.vcxproj", "{E4EC3EA1-FCA9-402E-BB69-6E9644997D98}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -109,6 +111,15 @@ Global
{1077E977-95DD-4E73-A692-74647DD0CC1E}.WithOpenPGM|Win32.Build.0 = Release|Win32
{1077E977-95DD-4E73-A692-74647DD0CC1E}.WithOpenPGM|x64.ActiveCfg = Release|x64
{1077E977-95DD-4E73-A692-74647DD0CC1E}.WithOpenPGM|x64.Build.0 = Release|x64
+ {E4EC3EA1-FCA9-402E-BB69-6E9644997D98}.Debug|Win32.ActiveCfg = Debug|Win32
+ {E4EC3EA1-FCA9-402E-BB69-6E9644997D98}.Debug|Win32.Build.0 = Debug|Win32
+ {E4EC3EA1-FCA9-402E-BB69-6E9644997D98}.Debug|x64.ActiveCfg = Debug|Win32
+ {E4EC3EA1-FCA9-402E-BB69-6E9644997D98}.Release|Win32.ActiveCfg = Release|Win32
+ {E4EC3EA1-FCA9-402E-BB69-6E9644997D98}.Release|Win32.Build.0 = Release|Win32
+ {E4EC3EA1-FCA9-402E-BB69-6E9644997D98}.Release|x64.ActiveCfg = Release|Win32
+ {E4EC3EA1-FCA9-402E-BB69-6E9644997D98}.WithOpenPGM|Win32.ActiveCfg = Release|Win32
+ {E4EC3EA1-FCA9-402E-BB69-6E9644997D98}.WithOpenPGM|Win32.Build.0 = Release|Win32
+ {E4EC3EA1-FCA9-402E-BB69-6E9644997D98}.WithOpenPGM|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/builds/msvc/tests/tests.vcxproj b/builds/msvc/tests/tests.vcxproj
new file mode 100644
index 0000000..dcbe996
--- /dev/null
+++ b/builds/msvc/tests/tests.vcxproj
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>tests</ProjectName>
+ <ProjectGuid>{E4EC3EA1-FCA9-402E-BB69-6E9644997D98}</ProjectGuid>
+ <RootNamespace>tests</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings" />
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(ProjectDir)..\properties\Executable.props" />
+ <Import Project="$(ProjectDir)..\properties\Win32_Release.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(ProjectDir)..\properties\Executable.props" />
+ <Import Project="$(ProjectDir)..\properties\x64.props" />
+ <Import Project="$(ProjectDir)..\properties\Release.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(ProjectDir)..\properties\Executable.props" />
+ <Import Project="$(ProjectDir)..\properties\Win32.props" />
+ <Import Project="$(ProjectDir)..\properties\Debug.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(ProjectDir)..\properties\Executable.props" />
+ <Import Project="$(ProjectDir)..\properties\x64.props" />
+ <Import Project="$(ProjectDir)..\properties\Debug.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\..\tests\tests.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\libxs\libxs.vcxproj">
+ <Project>{641c5f36-32ee-4323-b740-992b651cf9d6}</Project>
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/src/ctx.cpp b/src/ctx.cpp
index df1019b..97a3e62 100644
--- a/src/ctx.cpp
+++ b/src/ctx.cpp
@@ -82,8 +82,10 @@ xs::ctx_t::ctx_t (uint32_t io_threads_) :
int hwm = 1;
rc = log_socket->setsockopt (XS_SNDHWM, &hwm, sizeof (hwm));
errno_assert (rc == 0);
+#if !defined XS_HAVE_WINDOWS
rc = log_socket->connect ("ipc:///tmp/xslogs.ipc");
errno_assert (rc == 0);
+#endif
// Create the monitor object.
io_thread_t *io_thread = choose_io_thread (0);
diff --git a/tests/pair_ipc.cpp b/tests/pair_ipc.cpp
index c9dd5ae..ad58798 100644
--- a/tests/pair_ipc.cpp
+++ b/tests/pair_ipc.cpp
@@ -20,6 +20,13 @@
#include "testutil.hpp"
+#if defined XS_HAVE_WINDOWS
+int XS_TEST_MAIN ()
+{
+ return 0;
+}
+#else
+
int XS_TEST_MAIN ()
{
fprintf (stderr, "pair_ipc test running...\n");
@@ -50,3 +57,5 @@ int XS_TEST_MAIN ()
return 0 ;
}
+
+#endif
diff --git a/tests/reqrep_ipc.cpp b/tests/reqrep_ipc.cpp
index 3d1092e..1718c62 100644
--- a/tests/reqrep_ipc.cpp
+++ b/tests/reqrep_ipc.cpp
@@ -20,6 +20,13 @@
#include "testutil.hpp"
+#if defined XS_HAVE_WINDOWS
+int XS_TEST_MAIN ()
+{
+ return 0;
+}
+#else
+
int XS_TEST_MAIN ()
{
fprintf (stderr, "reqrep_ipc test running...\n");
@@ -50,3 +57,5 @@ int XS_TEST_MAIN ()
return 0 ;
}
+
+#endif \ No newline at end of file
diff --git a/tests/shutdown_stress.cpp b/tests/shutdown_stress.cpp
index d0156ff..2e6b4d5 100644
--- a/tests/shutdown_stress.cpp
+++ b/tests/shutdown_stress.cpp
@@ -21,6 +21,13 @@
#include "testutil.hpp"
+#if defined XS_HAVE_WINDOWS
+int XS_TEST_MAIN ()
+{
+ return 0;
+}
+#else
+
#include <pthread.h>
#include <stddef.h>
@@ -88,3 +95,5 @@ int XS_TEST_MAIN ()
return 0;
}
+
+#endif \ No newline at end of file
diff --git a/tests/tests.cpp b/tests/tests.cpp
new file mode 100644
index 0000000..dc55e97
--- /dev/null
+++ b/tests/tests.cpp
@@ -0,0 +1,120 @@
+/*
+ Copyright (c) 2012 250bpm s.r.o.
+ Copyright (c) 2012 Other contributors as noted in the AUTHORS file
+
+ This file is part of Crossroads project.
+
+ Crossroads is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ Crossroads is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+// This file is used only in MSVC build.
+// It gathers all the tests into a single executable.
+
+#include <assert.h>
+
+#define XS_TEST_MAIN hwm
+#include "hwm.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN invalid_rep
+#include "invalid_rep.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN linger
+#include "linger.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN msg_flags
+#include "msg_flags.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN pair_inproc
+#include "pair_inproc.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN pair_ipc
+#include "pair_ipc.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN pair_tcp
+#include "pair_tcp.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN reconnect
+#include "reconnect.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN reqrep_device
+#include "reqrep_device.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN reqrep_inproc
+#include "reqrep_inproc.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN reqrep_ipc
+#include "reqrep_ipc.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN reqrep_tcp
+#include "reqrep_tcp.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN shutdown_stress
+#include "shutdown_stress.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN sub_forward
+#include "sub_forward.cpp"
+#undef XS_TEST_MAIN
+
+#define XS_TEST_MAIN timeo
+#include "timeo.cpp"
+#undef XS_TEST_MAIN
+
+int main ()
+{
+ int rc;
+
+ rc = hwm ();
+ assert (rc == 0);
+ rc = invalid_rep ();
+ assert (rc == 0);
+ rc = linger ();
+ assert (rc == 0);
+ rc = msg_flags ();
+ assert (rc == 0);
+ rc = pair_inproc ();
+ assert (rc == 0);
+ rc = pair_ipc ();
+ assert (rc == 0);
+ rc = reconnect ();
+ assert (rc == 0);
+ rc = reqrep_device ();
+ assert (rc == 0);
+ rc = reqrep_inproc ();
+ assert (rc == 0);
+ rc = reqrep_ipc ();
+ assert (rc == 0);
+ rc = reqrep_tcp ();
+ assert (rc == 0);
+ rc = shutdown_stress ();
+ assert (rc == 0);
+ rc = sub_forward ();
+ assert (rc == 0);
+ rc = timeo ();
+ assert (rc == 0);
+
+ return 0;
+} \ No newline at end of file
diff --git a/tests/timeo.cpp b/tests/timeo.cpp
index f718056..3cb09f1 100644
--- a/tests/timeo.cpp
+++ b/tests/timeo.cpp
@@ -20,6 +20,13 @@
#include "testutil.hpp"
+#if defined XS_HAVE_WINDOWS
+int XS_TEST_MAIN ()
+{
+ return 0;
+}
+#else
+
#include <pthread.h>
extern "C"
@@ -112,3 +119,4 @@ int XS_TEST_MAIN ()
return 0 ;
}
+#endif \ No newline at end of file