} \
})
+/*!
+ * \brief Initialize the capture structure.
+ *
+ * \since 16.30.0, 18.16.0, 19.8.0, 20.1.0
+ *
+ * \param capture The structure describing the child process and its
+ * associated output.
+ */
+void ast_test_capture_init(struct ast_test_capture *capture);
+
/*!
* \brief Release the storage (buffers) associated with capturing
* the output of an external child process.
test->state = state;
}
+void ast_test_capture_init(struct ast_test_capture *capture)
+{
+ capture->outbuf = capture->errbuf = NULL;
+ capture->pid = capture->exitcode = -1;
+}
+
void ast_test_capture_free(struct ast_test_capture *capture)
{
if (capture) {
int status = 0;
FILE *cmd = NULL, *out = NULL, *err = NULL;
- memset(capture, 0, sizeof(*capture));
- capture->pid = capture->exitcode = -1;
+ ast_test_capture_init(capture);
if (data != NULL && datalen > 0) {
if (pipe(fd0) == -1) {
ast_test_status_update(test, "Executing RSA encryption test\n");
+ ast_test_capture_init(&cap);
+
if (!ast_check_command_in_path(command)) {
ast_test_status_update(test, "couldn't find %s\n", command);
return res;
ast_test_status_update(test, "Executing RSA decryption test\n");
+ ast_test_capture_init(&cap);
+
if (!ast_check_command_in_path(command)) {
ast_test_status_update(test, "couldn't find %s\n", command);
return res;
ast_test_status_update(test, "Executing RSA signing test\n");
+ ast_test_capture_init(&cap);
+
if (!ast_check_command_in_path(command)) {
ast_test_status_update(test, "couldn't find %s\n", command);
return res;
ast_test_status_update(test, "Executing RSA signature verification test\n");
+ ast_test_capture_init(&cap);
+
if (!ast_check_command_in_path(command)) {
ast_test_status_update(test, "couldn't find %s\n", command);
return res;
ast_test_status_update(test, "Executing AES-ECB encryption test\n");
+ ast_test_capture_init(&cap);
+
if (!ast_check_command_in_path(command)) {
ast_test_status_update(test, "couldn't find %s\n", command);
return res;
ast_test_status_update(test, "Executing AES-ECB decryption test\n");
+ ast_test_capture_init(&cap);
+
if (!ast_check_command_in_path(command)) {
ast_test_status_update(test, "couldn't find %s\n", command);
return res;