Skip to content

Commit

Permalink
ensure test fails if unexpected result
Browse files Browse the repository at this point in the history
  • Loading branch information
pabuhler committed Dec 12, 2023
1 parent 8f12a96 commit f0a3f9c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/srtp_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ srtp_err_status_t srtp_test(const srtp_policy_t *policy,
free(hdr);
free(hdr2);
free(rcvr_policy);
return status;
return srtp_err_status_algo_fail;
} else {
printf("passed\n");
}
Expand All @@ -1300,11 +1300,12 @@ srtp_err_status_t srtp_test(const srtp_policy_t *policy,
/* unprotect, and check for authentication failure */
status = srtp_test_call_unprotect(srtp_rcvr, hdr, &len, use_mki);
if (status != srtp_err_status_auth_fail) {
printf("failed with error code %d\n", status);
printf("failed\n");
free(hdr);
free(hdr2);
free(rcvr_policy);
return status;
return srtp_err_status_algo_fail;
} else {
printf("passed\n");
}
Expand Down Expand Up @@ -1460,7 +1461,7 @@ srtp_err_status_t srtcp_test(const srtp_policy_t *policy, int mki_index)
debug_print(mod_driver, "after unprotection:\n%s",
srtp_rtcp_packet_to_string(hdr, len));

/* verify that the unprotected packet matches the origial one */
/* verify that the unprotected packet matches the original one */
for (i = 0; i < len; i++) {
if (((uint8_t *)hdr)[i] != ((uint8_t *)hdr2)[i]) {
fprintf(stdout, "mismatch at octet %d\n", i);
Expand Down Expand Up @@ -1490,7 +1491,7 @@ srtp_err_status_t srtcp_test(const srtp_policy_t *policy, int mki_index)
free(hdr);
free(hdr2);
free(rcvr_policy);
return status;
return srtp_err_status_algo_fail;
} else {
printf("passed\n");
}
Expand All @@ -1507,11 +1508,12 @@ srtp_err_status_t srtcp_test(const srtp_policy_t *policy, int mki_index)
/* unprotect, and check for authentication failure */
status = srtp_test_call_unprotect_rtcp(srtcp_rcvr, hdr, &len, use_mki);
if (status != srtp_err_status_auth_fail) {
printf("failed with error code %d\n", status);
printf("failed\n");
free(hdr);
free(hdr2);
free(rcvr_policy);
return status;
return srtp_err_status_algo_fail;
} else {
printf("passed\n");
}
Expand Down

0 comments on commit f0a3f9c

Please sign in to comment.