static struct ptunit_result sync_set_null(void) { int errcode; errcode = pt_pkt_sync_set(NULL, 0ull); ptu_int_eq(errcode, -pte_invalid); return ptu_passed(); }
static struct ptunit_result sync_set_eos(struct test_fixture *tfix) { int errcode; errcode = pt_pkt_sync_set(&tfix->decoder, sizeof(tfix->buffer) + 1); ptu_int_eq(errcode, -pte_eos); return ptu_passed(); }
static struct ptunit_result sync_set_get_offset(struct test_fixture *tfix) { uint64_t offset; int errcode; errcode = pt_pkt_sync_set(&tfix->decoder, 1ull); ptu_int_eq(errcode, 0); errcode = pt_pkt_get_offset(&tfix->decoder, &offset); ptu_int_eq(errcode, 0); ptu_uint_eq(offset, 1ull); return ptu_passed(); }
static struct ptunit_result pfix_init(struct packet_fixture *pfix) { int errcode; memset(pfix->buffer, 0, sizeof(pfix->buffer)); memset(pfix->packet, 0, sizeof(pfix->packet)); memset(&pfix->config, 0, sizeof(pfix->config)); pfix->config.size = sizeof(pfix->config); pfix->config.begin = pfix->buffer; pfix->config.end = pfix->buffer + sizeof(pfix->buffer); pfix->config.decode.callback = pfix_decode_unknown; pfix->config.decode.context = pfix; pt_encoder_init(&pfix->encoder, &pfix->config); pt_pkt_decoder_init(&pfix->decoder, &pfix->config); errcode = pt_pkt_sync_set(&pfix->decoder, 0x0ull); ptu_int_eq(errcode, 0); pfix->unknown = 0; return ptu_passed(); }