Skip to content

Commit 3cc0cba

Browse files
committed
Merge remote-tracking branch 'origin/master' into flushRace
2 parents ca71d7b + 5281eb8 commit 3cc0cba

File tree

3 files changed

+91
-7
lines changed

3 files changed

+91
-7
lines changed

.github/workflows/windows.yaml

+78
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,84 @@ jobs:
344344
# Use the following to run just a single test (e.g. http_server_test)
345345
# build/tests/run_http_server_test
346346
347+
# Test for Windows ETW Log Entries
348+
349+
cd "$savedpwd";
350+
351+
logman start -ets Pistache -p "Pistache-Provider" 0 0 -o pistache.etl
352+
353+
cd "build/tests";
354+
./run_cookie_test_3.exe;
355+
cd "..\..";
356+
logman stop Pistache -ets
357+
358+
$fst5 =
359+
Get-WinEvent -path "pistache.etl" -Oldest | Select-Object -First 5
360+
361+
cd "$savedpwd"
362+
363+
$id_102_count=0;
364+
$id_102_start_msg_count=0;
365+
$id_1_count=0;
366+
foreach ($evitm in $fst5) {
367+
if ($evitm.Id -eq 102) {
368+
$id_102_count++;
369+
370+
$ldn=$evitm.LevelDisplayName;
371+
if (! ($ldn -contains "Information")) {
372+
Write-Error "log LevelDisplayName not as expected: $ldn";
373+
throw "Windows log LevelDisplayName not as expected";
374+
}
375+
376+
$msg=$evitm.Message;
377+
if ((! $id_102_start_msg_count) -and
378+
((! ("$msg" -like "*INFO*")) -or
379+
(! ("$msg" -like "*Pistache start*")))) {
380+
Write-Warning "log msg not as expected: $msg";
381+
}
382+
else {
383+
$id_102_start_msg_count++;
384+
}
385+
}
386+
387+
if ($evitm.Id -eq 1) {
388+
$id_1_count++
389+
390+
$ldn=$evitm.LevelDisplayName;
391+
if (! ($ldn -contains "Verbose")) {
392+
Write-Error "log LevelDisplayName not as expected: $ldn"
393+
throw "Windows log LevelDisplayName not as expected"
394+
}
395+
396+
$msg=$evitm.Message;
397+
if ((! ("$msg" -like "*DEBUG*")) -or
398+
(! ("$msg" -like "*PSTCH*"))) {
399+
Write-Error "log msg not as expected: $msg";
400+
throw "Windows log message not as expected"
401+
}
402+
}
403+
}
404+
405+
if (! $id_102_count) {
406+
throw "No Id=102 / INFO log messages found"
407+
}
408+
if (! $id_102_start_msg_count) {
409+
throw "No Id=102 / INFO Pistache start message found"
410+
}
411+
if ($env:mtrx_def_debug -eq "false") {
412+
if ($id_1_count) {
413+
throw "Id=1 / DEBUG log messages found unexpectedly"
414+
}
415+
}
416+
else {
417+
if (! $id_1_count) {
418+
throw "No Id=1 / DEBUG log messages found"
419+
}
420+
}
421+
422+
Write-Host "Logging test passed"
423+
424+
347425
- name: Install
348426
env:
349427
mtrx_compiler: ${{ matrix.compiler }}

src/common/pist_sockfns.cc

+12-6
Original file line numberDiff line numberDiff line change
@@ -252,38 +252,44 @@ int pist_sock_startup_check()
252252
if (wsastartup_res == 0)
253253
{
254254
lWsaStartupDone = true;
255+
256+
// Note: By doing this log here, we ensure there is at least one
257+
// message in the log. Apart from anything else, this can be used by
258+
// github workflows to check that logging is working
259+
PS_LOG_INFO("WSAStartup Succeeded");
260+
255261
return(0); // success
256262
}
257263

258264
switch(wsastartup_res)
259265
{
260266
case WSASYSNOTREADY:
261-
PS_LOG_DEBUG("WSAStartup WSASYSNOTREADY");
267+
PS_LOG_WARNING("WSAStartup WSASYSNOTREADY");
262268
errno = ENETUNREACH;
263269
break;
264270

265271
case WSAVERNOTSUPPORTED:
266-
PS_LOG_DEBUG("WSAStartup WSAVERNOTSUPPORTED");
272+
PS_LOG_WARNING("WSAStartup WSAVERNOTSUPPORTED");
267273
errno = EOPNOTSUPP;
268274
break;
269275

270276
case WSAEINPROGRESS:
271-
PS_LOG_DEBUG("WSAStartup WSAEINPROGRESS");
277+
PS_LOG_INFO("WSAStartup WSAEINPROGRESS");
272278
errno = EINPROGRESS;
273279
break;
274280

275281
case WSAEPROCLIM:
276-
PS_LOG_DEBUG("WSAStartup WSAEPROCLIM");
282+
PS_LOG_WARNING("WSAStartup WSAEPROCLIM");
277283
errno = EMFILE; // too many files
278284
break;
279285

280286
case WSAEFAULT:
281-
PS_LOG_DEBUG("WSAStartup WSAEFAULT");
287+
PS_LOG_WARNING("WSAStartup WSAEFAULT");
282288
errno = EFAULT;
283289
break;
284290

285291
default:
286-
PS_LOG_DEBUG_ARGS("Unexpected WSAStartup error %d:", wsastartup_res);
292+
PS_LOG_WARNING_ARGS("Unexpected WSAStartup error %d:", wsastartup_res);
287293
errno = EIO;
288294
break;
289295
}

version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.1.20250305
1+
0.5.2.20250309

0 commit comments

Comments
 (0)