mirror of https://github.com/BOINC/boinc.git
[UnitTest] Add shmem unit-tests to windows
Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
This commit is contained in:
parent
bda5e7ee8f
commit
731bf24573
|
@ -17,14 +17,12 @@
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#ifdef _WIN32
|
||||||
#include "boinc_win.h"
|
#include "boinc_win.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "shmem.h"
|
#include "shmem.h"
|
||||||
|
|
||||||
#define KEY 0xbeefcafe
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace test_shmem {
|
namespace test_shmem {
|
||||||
|
@ -60,14 +58,26 @@ namespace test_shmem {
|
||||||
// Objects declared here can be used by all tests in the test case for Foo.
|
// Objects declared here can be used by all tests in the test case for Foo.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Test shmem functions for Unix/Linux/Mac V5 applications
|
// Test shmem functions for Windows/Unix/Linux/Mac V5 applications
|
||||||
TEST_F(test_shmem, shmem) {
|
TEST_F(test_shmem, shmem) {
|
||||||
void* p;
|
void* p;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
const std::string KEY("0xbeefcafe");
|
||||||
|
|
||||||
|
HANDLE handle = create_shmem(reinterpret_cast<LPCTSTR>(KEY.c_str()), 100, &p);
|
||||||
|
EXPECT_NE(handle, INVALID_HANDLE_VALUE);
|
||||||
|
HANDLE handle2 = attach_shmem(reinterpret_cast<LPCTSTR>(KEY.c_str()), &p);
|
||||||
|
EXPECT_NE(handle2, INVALID_HANDLE_VALUE);
|
||||||
|
EXPECT_EQ(detach_shmem(handle, &p), 0);
|
||||||
|
EXPECT_EQ(detach_shmem(handle2, &p), 0);
|
||||||
|
#else
|
||||||
|
#define KEY 0xbeefcafe
|
||||||
|
|
||||||
EXPECT_EQ(create_shmem(KEY, 100, false, &p), 0);
|
EXPECT_EQ(create_shmem(KEY, 100, false, &p), 0);
|
||||||
|
|
||||||
EXPECT_EQ(attach_shmem(KEY, &p), 0);
|
EXPECT_EQ(attach_shmem(KEY, &p), 0);
|
||||||
|
|
||||||
EXPECT_EQ(destroy_shmem(KEY), 0);
|
EXPECT_EQ(destroy_shmem(KEY), 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -23,14 +23,14 @@
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
|
Loading…
Reference in New Issue