'Parsing 1st row of values from a custom table
Our test script generates the following output file and need to parse this file to check for the following: CTRL Results generates 2 sets of data: i. D0_R# ii. E0_R# where 1st row in both should have 0x40 (same value) then system is healthy
similarly Data Results generates 2 sets of data: i. D0_R# ii. E0_R# where 1st row in both should have 0x81 then system is healthy
Similarly Replay Results generates 12 sets of data: where each 1st row should have 0x0
One issue in this is, 1st row values can appear in other rows too but as long as all the values in the 1st row is equal to expected value then evaluates to 'system healthy' even other rows have the expected value.
I need to include this in Jenkins and I've thought of following options:
- using Jenkins
def firstRowValues = readFile(file: output).readLines()
def ctrlCount = 0
def dataCount = 0
def replayCount = 0
for (firstRowVal in firstRowValues){
\\between each column 2 tabs space exists
firstRow = firstRowVal.split("\t").split("\t")
if(firstRow == "0x40"){
ctrlCount += 1
}
else if(firstRow == "0x81"){
dataCount += 1
}
else if(firstRow == 0x0){
replayCount += 1
}
}
if(ctrlCount >= 12 && dataCount >= 12 && replayCount >= 48){
println("System is healthy")
}
but I'm not sure how to proceed further and don't think above is correct either
- create a custom parser in Python and use the parser script in Jenkins job but I'm not sure how to write a parser for this condition
Looking for some guidance or how to go about in processing below data.
------------- CTRL Results -------------
D0_R0 D0_R1 D0_R2 D0_R3 D0_R4 D0_R5
0x40 0x40 0x40 0x40 0x40 0x40
0x20 0x20 0x20 0x20 0x20 0x20
0x40 0x40 0x40 0x40 0x40 0x40
E0_R0 E1_R0 E2_R0 E3_R0 E4_R0 E5_R0
0x40 0x40 0x40 0x40 0x40 0x40
0x20 0x20 0x20 0x20 0x20 0x20
0x40 0x40 0x40 0x40 0x40 0x40
------------- DATA Results -------------
D0_R0 D0_R1 D0_R2 D0_R3 D0_R4 D0_R5
0x81 0x81 0x81 0x81 0x81 0x81
0x71 0x71 0x71 0x71 0x71 0x71
0x42 0x42 0x42 0x42 0x42 0x42
0x81 0x81 0x81 0x81 0x81 0x81
E0_R0 E1_R0 E2_R0 E3_R0 E4_R0 E5_R0
0x81 0x81 0x81 0x81 0x81 0x81
0x71 0x71 0x71 0x71 0x71 0x71
0x42 0x42 0x42 0x42 0x42 0x42
------------- DATA Results Replay -------------
D0_R0
REPLAY0 REPLAY1 REPLAY2 REPLAY3
0x0 0x0 0x0 0x0
0x73 0x73 0x73 0x73
0x0 0x0 0x0 0x0
D0_R1
REPLAY0 REPLAY1 REPLAY2 REPLAY3
0x0 0x0 0x0 0x0
0x73 0x73 0x73 0x73
0x0 0x0 0x0 0x0
0x72 0x72 0x72 0x72
0x0 0x0 0x0 0x0
D0_R2
REPLAY0 REPLAY1 REPLAY2 REPLAY3
0x0 0x0 0x0 0x0
0x73 0x73 0x73 0x73
0x72 0x72 0x72 0x72
0x0 0x0 0x0 0x0
D0_R3
REPLAY0 REPLAY1 REPLAY2 REPLAY3
0x0 0x0 0x0 0x0
0x73 0x73 0x73 0x73
0x72 0x72 0x72 0x72
D0_R4
REPLAY0 REPLAY1 REPLAY2 REPLAY3
0x0 0x0 0x0 0x0
0x71 0x71 0x71 0x71
0x11 0x11 0x11 0x11
0x0 0x0 0x0 0x0
D0_R5
REPLAY0 REPLAY1 REPLAY2 REPLAY3
0x0 0x0 0x0 0x0
0x73 0x73 0x73 0x73
E0_R0
REPLAY0 REPLAY1 REPLAY2 REPLAY3
0x0 0x0 0x0 0x0
0x73 0x73 0x73 0x73
E1_R0
REPLAY0 REPLAY1 REPLAY2 REPLAY3
0x0 0x0 0x0 0x0
0x73 0x73 0x73 0x73
E2_R0
REPLAY0 REPLAY1 REPLAY2 REPLAY3
0x0 0x0 0x0 0x0
0x11 0x11 0x11 0x11
0x0 0x0 0x0 0x0
E3_R0
REPLAY0 REPLAY1 REPLAY2 REPLAY3
0x0 0x0 0x0 0x0
0x73 0x73 0x73 0x73
E4_R0
REPLAY0 REPLAY1 REPLAY2 REPLAY3
0x0 0x0 0x0 0x0
0x73 0x73 0x73 0x73
E5_R0
REPLAY0 REPLAY1 REPLAY2 REPLAY3
0x0 0x0 0x0 0x0
0x73 0x73 0x73 0x73
0x0 0x0 0x0 0x0
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
