func (comm *TcpComm) CheckResp( rawReq loadgenlib.RawReq, rawResp loadgenlib.RawResp) *loadgenlib.CallResult { var commResult loadgenlib.CallResult commResult.Id = rawResp.Id commResult.Req = rawReq commResult.Resp = rawResp var sreq ServerReq err := json.Unmarshal(rawReq.Req, &sreq) if err != nil { commResult.Code = loadgenlib.RESULT_CODE_FATAL_CALL commResult.Msg = fmt.Sprintf("Incorrectly formatted Req: %s!\n", string(rawReq.Req)) return &commResult } var sresp ServerResp err = json.Unmarshal(rawResp.Resp, &sresp) if err != nil { commResult.Code = loadgenlib.RESULT_CODE_ERROR_RESPONSE commResult.Msg = fmt.Sprintf("Incorrectly formatted Resp: %s!\n", string(rawResp.Resp)) return &commResult } if sresp.Id != sreq.Id { commResult.Code = loadgenlib.RESULT_CODE_ERROR_RESPONSE commResult.Msg = fmt.Sprintf("Inconsistent raw id! (%d != %d)\n", rawReq.Id, rawResp.Id) return &commResult } if sresp.Err != nil { commResult.Code = loadgenlib.RESULT_CODE_ERROR_CALEE commResult.Msg = fmt.Sprintf("Abnormal server: %s!\n", sresp.Err) return &commResult } if sresp.Result != op(sreq.Operands, sreq.Operator) { commResult.Code = loadgenlib.RESULT_CODE_ERROR_RESPONSE commResult.Msg = fmt.Sprintf( "Incorrect result: %s!\n", genFormula(sreq.Operands, sreq.Operator, sresp.Result, false)) return &commResult } commResult.Code = loadgenlib.RESULT_CODE_SUCCESS commResult.Msg = fmt.Sprintf("Success. (%s)", sresp.Formula) return &commResult }