Skip to content

Commit

Permalink
Tests/CheckLogFiles: Fix the test
Browse files Browse the repository at this point in the history
We should only ignore the lines with {} and heartbeat messages from the
ZeroMQ XOP. And only if we only have these lines can we skip the file.

Added also two more info calls for better debugging.

Bug introduced in ed8a41d (LOG_AddEntry: Readd timestamp, 2023-12-11).
  • Loading branch information
t-b committed Feb 6, 2024
1 parent 63c8c28 commit a033d01
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions Packages/tests/Basic/UTF_Utils.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -7391,12 +7391,13 @@ End

static Function CheckLogFiles()

string file, line
variable foundFiles, jsonID

// ensure that the ZeroMQ logfile exists as well
// and also have the right layout
PrepareForPublishTest()

string file
variable foundFiles, jsonID

WAVE/T filesAndOther = GetLogFileNames()
Duplicate/RMD=[][0]/FREE/T filesAndOther, files

Expand All @@ -7409,16 +7410,28 @@ static Function CheckLogFiles()
CHECK_WAVE(contents, TEXT_WAVE)
CHECK_GT_VAR(DimSize(contents, ROWS), 0)

if(!cmpstr(contents[0], "{}"))
for(line : contents)
if(cmpstr(line, "{}"))
break
endif
endfor

if(!cmpstr(line, "{}"))
// only {} inside the file, no need to check for timestamp
continue
endif

jsonID = JSON_Parse(contents[0])
jsonID = JSON_Parse(line)
CHECK(JSON_IsValid(jsonID))

INFO("File: \"%s\", Line: \"%s\"", s0 = file, s1 = line)

CHECK(MIES_LOG#LOG_HasRequiredKeys(jsonID))
WAVE/T keys = JSON_GetKeys(jsonID, "")
FindValue/TEXT="ts" keys

INFO("File: \"%s\", Line: \"%s\"", s0 = file, s1 = line)

CHECK_GE_VAR(V_Value, 0)

foundFiles += 1
Expand Down

0 comments on commit a033d01

Please sign in to comment.