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