mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-31 12:58:21 +08:00
test: fixup for Windows.
Change-Id: I13468caf53988d9599235d1423603146abf9eb46
This commit is contained in:
parent
c4846c8141
commit
a0f1d61a4a
1
TODO.md
1
TODO.md
@ -1,3 +1,4 @@
|
|||||||
|
- [ ] разделение errno и GetLastError()
|
||||||
- [x] CI посредством AppVeyor
|
- [x] CI посредством AppVeyor
|
||||||
- [ ] uint32/uint64 в структурах
|
- [ ] uint32/uint64 в структурах
|
||||||
- [ ] правки API (много...)
|
- [ ] правки API (много...)
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;%(PreprocessorDefinitions);MDB_DEBUG=1</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
@ -121,7 +121,7 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;_USRDLL;LIBMDBX_EXPORTS;%(PreprocessorDefinitions);MDB_DEBUG=1</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
<StringPooling>true</StringPooling>
|
<StringPooling>true</StringPooling>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -94,7 +94,8 @@ time now_motonic() {
|
|||||||
if (reciprocal == 0) {
|
if (reciprocal == 0) {
|
||||||
if (!QueryPerformanceFrequency(&Frequency))
|
if (!QueryPerformanceFrequency(&Frequency))
|
||||||
failure_perror("QueryPerformanceFrequency()", GetLastError());
|
failure_perror("QueryPerformanceFrequency()", GetLastError());
|
||||||
reciprocal = (UINT64_C(1) << 32) / Frequency.QuadPart;
|
reciprocal =
|
||||||
|
((UINT64_C(1) << 32) + Frequency.QuadPart / 2) / Frequency.QuadPart;
|
||||||
assert(reciprocal);
|
assert(reciprocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +108,6 @@ time now_motonic() {
|
|||||||
uint64_t mod = Counter.QuadPart % Frequency.QuadPart;
|
uint64_t mod = Counter.QuadPart % Frequency.QuadPart;
|
||||||
assert(mod < UINT32_MAX);
|
assert(mod < UINT32_MAX);
|
||||||
result.fractional = UInt32x32To64((uint32_t)mod, reciprocal);
|
result.fractional = UInt32x32To64((uint32_t)mod, reciprocal);
|
||||||
assert(result.fractional == (mod << 32) / Frequency.QuadPart);
|
|
||||||
return result;
|
return result;
|
||||||
#else
|
#else
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
static std::vector<HANDLE> events;
|
static std::unordered_map<unsigned, HANDLE> events;
|
||||||
static HANDLE hBarrierSemaphore, hBarrierEvent;
|
static HANDLE hBarrierSemaphore, hBarrierEvent;
|
||||||
|
|
||||||
static int waitstatus2errcode(DWORD result) {
|
static int waitstatus2errcode(DWORD result) {
|
||||||
@ -67,13 +67,13 @@ void osal_setup(const std::vector<actor_config> &actors) {
|
|||||||
const size_t n = actors.size() + 1;
|
const size_t n = actors.size() + 1;
|
||||||
events.reserve(n);
|
events.reserve(n);
|
||||||
|
|
||||||
for (size_t i = 0; i < n; ++i) {
|
for (unsigned i = 0; i < n; ++i) {
|
||||||
HANDLE hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
HANDLE hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
if (!hEvent)
|
if (!hEvent)
|
||||||
failure_perror("CreateEvent()", GetLastError());
|
failure_perror("CreateEvent()", GetLastError());
|
||||||
hEvent = make_inharitable(hEvent);
|
hEvent = make_inharitable(hEvent);
|
||||||
log_trace("osal_setup: event %zu -> %p", i, hEvent);
|
log_trace("osal_setup: event %zu -> %p", i, hEvent);
|
||||||
events.push_back(hEvent);
|
events[i] = hEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
hBarrierSemaphore = CreateSemaphore(NULL, 0, (LONG)actors.size(), NULL);
|
hBarrierSemaphore = CreateSemaphore(NULL, 0, (LONG)actors.size(), NULL);
|
||||||
@ -121,7 +121,7 @@ actor_config::osal_serialize(simple_checksum &checksum) const {
|
|||||||
|
|
||||||
HANDLE hSignal = INVALID_HANDLE_VALUE;
|
HANDLE hSignal = INVALID_HANDLE_VALUE;
|
||||||
if (wanna_event4signalling()) {
|
if (wanna_event4signalling()) {
|
||||||
hSignal = events.at(id);
|
hSignal = events.at(actor_id);
|
||||||
checksum.push(hSignal);
|
checksum.push(hSignal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ bool actor_config::osal_deserialize(const char *str, const char *end,
|
|||||||
|
|
||||||
if (wanna_event4signalling()) {
|
if (wanna_event4signalling()) {
|
||||||
checksum.push(hSignal);
|
checksum.push(hSignal);
|
||||||
events[id] = hSignal;
|
events[actor_id] = hSignal;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("<< osal_deserialize: OK\n");
|
TRACE("<< osal_deserialize: OK\n");
|
||||||
@ -278,9 +278,16 @@ void osal_udelay(unsigned us) {
|
|||||||
|
|
||||||
static unsigned threshold_us;
|
static unsigned threshold_us;
|
||||||
if (threshold_us == 0) {
|
if (threshold_us == 0) {
|
||||||
|
#if 1
|
||||||
|
unsigned timeslice_ms = 1;
|
||||||
|
while (timeBeginPeriod(timeslice_ms) == TIMERR_NOCANDO)
|
||||||
|
++timeslice_ms;
|
||||||
|
threshold_us = timeslice_ms * 1500u;
|
||||||
|
#else
|
||||||
ULONGLONG InterruptTimePrecise_100ns;
|
ULONGLONG InterruptTimePrecise_100ns;
|
||||||
QueryInterruptTimePrecise(&InterruptTimePrecise_100ns);
|
QueryInterruptTimePrecise(&InterruptTimePrecise_100ns);
|
||||||
threshold_us = InterruptTimePrecise_100ns / 5;
|
threshold_us = InterruptTimePrecise_100ns / 5;
|
||||||
|
#endif
|
||||||
assert(threshold_us > 0);
|
assert(threshold_us > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@
|
|||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
@ -116,6 +117,7 @@
|
|||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@ -134,6 +136,7 @@
|
|||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
@ -152,10 +155,12 @@
|
|||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="base.h" />
|
<ClInclude Include="base.h" />
|
||||||
|
<ClInclude Include="chrono.h" />
|
||||||
<ClInclude Include="config.h" />
|
<ClInclude Include="config.h" />
|
||||||
<ClInclude Include="keygen.h" />
|
<ClInclude Include="keygen.h" />
|
||||||
<ClInclude Include="log.h" />
|
<ClInclude Include="log.h" />
|
||||||
@ -164,6 +169,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="cases.cc" />
|
<ClCompile Include="cases.cc" />
|
||||||
|
<ClCompile Include="chrono.cc" />
|
||||||
<ClCompile Include="config.cc" />
|
<ClCompile Include="config.cc" />
|
||||||
<ClCompile Include="dead.cc" />
|
<ClCompile Include="dead.cc" />
|
||||||
<ClCompile Include="hill.cc" />
|
<ClCompile Include="hill.cc" />
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
#ifndef _MSC_VER
|
||||||
#include <ieee754.h>
|
#include <ieee754.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string format(const char *fmt, ...) {
|
std::string format(const char *fmt, ...) {
|
||||||
va_list ap, ones;
|
va_list ap, ones;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user