test tool: Fix memory leaks in test setup and teardown functions

Free read_write_buf and task after each test. Free iscsi2 after
each PGR test when using CUnit version 2. Note: CUnit version 1
doesn't support test setup and teardown functions.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
This commit is contained in:
Bart Van Assche
2013-10-21 11:54:38 +02:00
committed by Ronnie Sahlberg
parent a1f32527d5
commit b6b49e4a66
2 changed files with 191 additions and 276 deletions
+178 -265
View File
@@ -400,88 +400,56 @@ typedef struct libiscsi_suite_info {
const char *pName; /**< Suite name. */ const char *pName; /**< Suite name. */
CU_InitializeFunc pInitFunc; /**< Suite initialization function. */ CU_InitializeFunc pInitFunc; /**< Suite initialization function. */
CU_CleanupFunc pCleanupFunc; /**< Suite cleanup function */ CU_CleanupFunc pCleanupFunc; /**< Suite cleanup function */
CU_SetUpFunc pSetUpFunc; /**< Test setup function. */
CU_TearDownFunc pTearDownFunc; /**< Test tear down function */
CU_TestInfo *pTests; /**< Test case array - must be NULL terminated. */ CU_TestInfo *pTests; /**< Test case array - must be NULL terminated. */
} libiscsi_suite_info; } libiscsi_suite_info;
#define NON_PGR_FUNCS suite_init, suite_cleanup, test_setup, test_teardown
#define PGR_FUNCS suite_init_pgr, suite_cleanup_pgr, test_setup, test_teardown
/* SCSI protocol tests */ /* SCSI protocol tests */
static libiscsi_suite_info scsi_suites[] = { static libiscsi_suite_info scsi_suites[] = {
{ "CompareAndWrite", test_setup, test_teardown, { "CompareAndWrite", NON_PGR_FUNCS, tests_compareandwrite },
tests_compareandwrite }, { "GetLBAStatus", NON_PGR_FUNCS, tests_get_lba_status },
{ "GetLBAStatus", test_setup, test_teardown, { "Inquiry", NON_PGR_FUNCS, tests_inquiry },
tests_get_lba_status }, { "Mandatory", NON_PGR_FUNCS, tests_mandatory },
{ "Inquiry", test_setup, test_teardown, { "ModeSense6", NON_PGR_FUNCS, tests_modesense6 },
tests_inquiry }, { "NoMedia", NON_PGR_FUNCS, tests_nomedia },
{ "Mandatory", test_setup, test_teardown, { "OrWrite", NON_PGR_FUNCS, tests_orwrite },
tests_mandatory }, { "Prefetch10", NON_PGR_FUNCS, tests_prefetch10 },
{ "ModeSense6", test_setup, test_teardown, { "Prefetch16", NON_PGR_FUNCS, tests_prefetch16 },
tests_modesense6 }, { "PreventAllow", NON_PGR_FUNCS, tests_preventallow },
{ "NoMedia", test_setup, test_teardown, { "PrinReadKeys", NON_PGR_FUNCS, tests_prin_read_keys },
tests_nomedia }, { "PrinServiceactionRange", NON_PGR_FUNCS, tests_prin_serviceaction_range },
{ "OrWrite", test_setup, test_teardown, { "ProutRegister", NON_PGR_FUNCS, tests_prout_register },
tests_orwrite }, { "ProutReserve", PGR_FUNCS, tests_prout_reserve },
{ "Prefetch10", test_setup, test_teardown, { "Read6", NON_PGR_FUNCS, tests_read6 },
tests_prefetch10 }, { "Read10", NON_PGR_FUNCS, tests_read10 },
{ "Prefetch16", test_setup, test_teardown, { "Read12", NON_PGR_FUNCS, tests_read12 },
tests_prefetch16 }, { "Read16", NON_PGR_FUNCS, tests_read16 },
{ "PreventAllow", test_setup, test_teardown, { "ReadCapacity10", NON_PGR_FUNCS, tests_readcapacity10 },
tests_preventallow }, { "ReadCapacity16", NON_PGR_FUNCS, tests_readcapacity16 },
{ "PrinReadKeys", test_setup, test_teardown, { "ReadOnly", NON_PGR_FUNCS, tests_readonly },
tests_prin_read_keys }, { "ReportSupportedOpcodes", NON_PGR_FUNCS,
{ "PrinServiceactionRange", test_setup, test_teardown,
tests_prin_serviceaction_range },
{ "ProutRegister", test_setup, test_teardown,
tests_prout_register },
{ "ProutReserve", test_setup_pgr, test_teardown_pgr,
tests_prout_reserve },
{ "Read6", test_setup, test_teardown,
tests_read6 },
{ "Read10", test_setup, test_teardown,
tests_read10 },
{ "Read12", test_setup, test_teardown,
tests_read12 },
{ "Read16", test_setup, test_teardown,
tests_read16 },
{ "ReadCapacity10", test_setup, test_teardown,
tests_readcapacity10 },
{ "ReadCapacity16", test_setup, test_teardown,
tests_readcapacity16 },
{ "ReadOnly", test_setup, test_teardown,
tests_readonly },
{ "ReportSupportedOpcodes", test_setup, test_teardown,
tests_report_supported_opcodes }, tests_report_supported_opcodes },
{ "Reserve6", test_setup, test_teardown, { "Reserve6", NON_PGR_FUNCS, tests_reserve6 },
tests_reserve6 }, { "Sanitize", NON_PGR_FUNCS, tests_sanitize },
{ "Sanitize", test_setup, test_teardown, { "StartStopUnit", NON_PGR_FUNCS, tests_startstopunit },
tests_sanitize }, { "UnitReady", NON_PGR_FUNCS, tests_testunitready },
{ "StartStopUnit", test_setup, test_teardown, { "Unmap", NON_PGR_FUNCS, tests_unmap },
tests_startstopunit }, { "Verify10", NON_PGR_FUNCS, tests_verify10 },
{ "UnitReady", test_setup, test_teardown, { "Verify12", NON_PGR_FUNCS, tests_verify12 },
tests_testunitready }, { "Verify16", NON_PGR_FUNCS, tests_verify16 },
{ "Unmap", test_setup, test_teardown, { "Write10", NON_PGR_FUNCS, tests_write10 },
tests_unmap }, { "Write12", NON_PGR_FUNCS, tests_write12 },
{ "Verify10", test_setup, test_teardown, { "Write16", NON_PGR_FUNCS, tests_write16 },
tests_verify10 }, { "WriteSame10", NON_PGR_FUNCS, tests_writesame10 },
{ "Verify12", test_setup, test_teardown, { "WriteSame16", NON_PGR_FUNCS, tests_writesame16 },
tests_verify12 }, { "WriteVerify10", NON_PGR_FUNCS, tests_writeverify10 },
{ "Verify16", test_setup, test_teardown, { "WriteVerify12", NON_PGR_FUNCS, tests_writeverify12 },
tests_verify16 }, { "WriteVerify16", NON_PGR_FUNCS, tests_writeverify16 },
{ "Write10", test_setup, test_teardown, { NULL, NULL, NULL, NULL, NULL, NULL }
tests_write10 },
{ "Write12", test_setup, test_teardown,
tests_write12 },
{ "Write16", test_setup, test_teardown,
tests_write16 },
{ "WriteSame10", test_setup, test_teardown,
tests_writesame10 },
{ "WriteSame16", test_setup, test_teardown,
tests_writesame16 },
{ "WriteVerify10", test_setup, test_teardown,
tests_writeverify10 },
{ "WriteVerify12", test_setup, test_teardown,
tests_writeverify12 },
{ "WriteVerify16", test_setup, test_teardown,
tests_writeverify16 },
{ NULL, NULL, NULL, NULL }
}; };
static CU_TestInfo tests_iscsi_cmdsn[] = { static CU_TestInfo tests_iscsi_cmdsn[] = {
@@ -506,168 +474,98 @@ static CU_TestInfo tests_iscsi_residuals[] = {
/* iSCSI protocol tests */ /* iSCSI protocol tests */
static libiscsi_suite_info iscsi_suites[] = { static libiscsi_suite_info iscsi_suites[] = {
{ "iSCSIcmdsn", test_setup, test_teardown, { "iSCSIcmdsn", NON_PGR_FUNCS,
tests_iscsi_cmdsn }, tests_iscsi_cmdsn },
{ "iSCSIResiduals", test_setup, test_teardown, { "iSCSIResiduals", NON_PGR_FUNCS,
tests_iscsi_residuals }, tests_iscsi_residuals },
{ NULL, NULL, NULL, NULL } { NULL, NULL, NULL, NULL, NULL, NULL }
}; };
/* All tests */ /* All tests */
static libiscsi_suite_info all_suites[] = { static libiscsi_suite_info all_suites[] = {
{ "CompareAndWrite", test_setup, test_teardown, { "CompareAndWrite", NON_PGR_FUNCS, tests_compareandwrite },
tests_compareandwrite }, { "GetLBAStatus", NON_PGR_FUNCS, tests_get_lba_status },
{ "GetLBAStatus", test_setup, test_teardown, { "Inquiry", NON_PGR_FUNCS, tests_inquiry },
tests_get_lba_status }, { "Mandatory", NON_PGR_FUNCS, tests_mandatory },
{ "Inquiry", test_setup, test_teardown, { "ModeSense6", NON_PGR_FUNCS, tests_modesense6 },
tests_inquiry }, { "NoMedia", NON_PGR_FUNCS, tests_nomedia },
{ "Mandatory", test_setup, test_teardown, { "OrWrite", NON_PGR_FUNCS, tests_orwrite },
tests_mandatory }, { "Prefetch10", NON_PGR_FUNCS, tests_prefetch10 },
{ "ModeSense6", test_setup, test_teardown, { "Prefetch16", NON_PGR_FUNCS, tests_prefetch16 },
tests_modesense6 }, { "PreventAllow", NON_PGR_FUNCS, tests_preventallow },
{ "NoMedia", test_setup, test_teardown, { "PrinReadKeys", NON_PGR_FUNCS, tests_prin_read_keys },
tests_nomedia }, { "PrinServiceactionRange", NON_PGR_FUNCS,
{ "OrWrite", test_setup, test_teardown,
tests_orwrite },
{ "Prefetch10", test_setup, test_teardown,
tests_prefetch10 },
{ "Prefetch16", test_setup, test_teardown,
tests_prefetch16 },
{ "PreventAllow", test_setup, test_teardown,
tests_preventallow },
{ "PrinReadKeys", test_setup, test_teardown,
tests_prin_read_keys },
{ "PrinServiceactionRange", test_setup, test_teardown,
tests_prin_serviceaction_range }, tests_prin_serviceaction_range },
{ "ProutRegister", test_setup, test_teardown, { "ProutRegister", NON_PGR_FUNCS, tests_prout_register },
tests_prout_register }, { "ProutReserve", PGR_FUNCS, tests_prout_reserve },
{ "ProutReserve", test_setup_pgr, test_teardown_pgr, { "Read6", NON_PGR_FUNCS, tests_read6 },
tests_prout_reserve }, { "Read10", NON_PGR_FUNCS, tests_read10 },
{ "Read6", test_setup, test_teardown, { "Read12", NON_PGR_FUNCS, tests_read12 },
tests_read6 }, { "Read16", NON_PGR_FUNCS, tests_read16 },
{ "Read10", test_setup, test_teardown, { "ReadCapacity10", NON_PGR_FUNCS, tests_readcapacity10 },
tests_read10 }, { "ReadCapacity16", NON_PGR_FUNCS, tests_readcapacity16 },
{ "Read12", test_setup, test_teardown, { "ReadOnly", NON_PGR_FUNCS, tests_readonly },
tests_read12 }, { "ReportSupportedOpcodes", NON_PGR_FUNCS,
{ "Read16", test_setup, test_teardown,
tests_read16 },
{ "ReadCapacity10", test_setup, test_teardown,
tests_readcapacity10 },
{ "ReadCapacity16", test_setup, test_teardown,
tests_readcapacity16 },
{ "ReadOnly", test_setup, test_teardown,
tests_readonly },
{ "ReportSupportedOpcodes", test_setup, test_teardown,
tests_report_supported_opcodes }, tests_report_supported_opcodes },
{ "Reserve6", test_setup, test_teardown, { "Reserve6", NON_PGR_FUNCS, tests_reserve6 },
tests_reserve6 }, { "Sanitize", NON_PGR_FUNCS, tests_sanitize },
{ "Sanitize", test_setup, test_teardown, { "StartStopUnit", NON_PGR_FUNCS, tests_startstopunit },
tests_sanitize }, { "TestUnitReady", NON_PGR_FUNCS, tests_testunitready },
{ "StartStopUnit", test_setup, test_teardown, { "Unmap", NON_PGR_FUNCS, tests_unmap },
tests_startstopunit }, { "Verify10", NON_PGR_FUNCS, tests_verify10 },
{ "TestUnitReady", test_setup, test_teardown, { "Verify12", NON_PGR_FUNCS, tests_verify12 },
tests_testunitready }, { "Verify16", NON_PGR_FUNCS, tests_verify16 },
{ "Unmap", test_setup, test_teardown, { "Write10", NON_PGR_FUNCS, tests_write10 },
tests_unmap }, { "Write12", NON_PGR_FUNCS, tests_write12 },
{ "Verify10", test_setup, test_teardown, { "Write16", NON_PGR_FUNCS, tests_write16 },
tests_verify10 }, { "WriteSame10", NON_PGR_FUNCS, tests_writesame10 },
{ "Verify12", test_setup, test_teardown, { "WriteSame16", NON_PGR_FUNCS, tests_writesame16 },
tests_verify12 }, { "WriteVerify10", NON_PGR_FUNCS, tests_writeverify10 },
{ "Verify16", test_setup, test_teardown, { "WriteVerify12", NON_PGR_FUNCS, tests_writeverify12 },
tests_verify16 }, { "WriteVerify16", NON_PGR_FUNCS, tests_writeverify16 },
{ "Write10", test_setup, test_teardown, { "iSCSIcmdsn", NON_PGR_FUNCS, tests_iscsi_cmdsn },
tests_write10 }, { "iSCSIResiduals", NON_PGR_FUNCS, tests_iscsi_residuals },
{ "Write12", test_setup, test_teardown, { NULL, NULL, NULL, NULL, NULL, NULL },
tests_write12 },
{ "Write16", test_setup, test_teardown,
tests_write16 },
{ "WriteSame10", test_setup, test_teardown,
tests_writesame10 },
{ "WriteSame16", test_setup, test_teardown,
tests_writesame16 },
{ "WriteVerify10", test_setup, test_teardown,
tests_writeverify10 },
{ "WriteVerify12", test_setup, test_teardown,
tests_writeverify12 },
{ "WriteVerify16", test_setup, test_teardown,
tests_writeverify16 },
{ "iSCSIcmdsn", test_setup, test_teardown,
tests_iscsi_cmdsn },
{ "iSCSIResiduals", test_setup, test_teardown,
tests_iscsi_residuals },
{ NULL, NULL, NULL, NULL },
}; };
static libiscsi_suite_info scsi_usb_sbc_suites[] = { static libiscsi_suite_info scsi_usb_sbc_suites[] = {
{ "CompareAndWrite", test_setup, test_teardown, { "CompareAndWrite", NON_PGR_FUNCS, tests_compareandwrite },
tests_compareandwrite }, { "GetLBAStatus", NON_PGR_FUNCS, tests_get_lba_status },
{ "GetLBAStatus", test_setup, test_teardown, { "Inquiry", NON_PGR_FUNCS, tests_inquiry },
tests_get_lba_status }, { "Mandatory", NON_PGR_FUNCS, tests_mandatory },
{ "Inquiry", test_setup, test_teardown, { "ModeSense6", NON_PGR_FUNCS, tests_modesense6 },
tests_inquiry }, { "OrWrite", NON_PGR_FUNCS, tests_orwrite },
{ "Mandatory", test_setup, test_teardown, { "Prefetch10", NON_PGR_FUNCS, tests_prefetch10 },
tests_mandatory }, { "Prefetch16", NON_PGR_FUNCS, tests_prefetch16 },
{ "ModeSense6", test_setup, test_teardown, { "PrinReadKeys", NON_PGR_FUNCS, tests_prin_read_keys },
tests_modesense6 }, { "PrinServiceactionRange", NON_PGR_FUNCS,
{ "OrWrite", test_setup, test_teardown,
tests_orwrite },
{ "Prefetch10", test_setup, test_teardown,
tests_prefetch10 },
{ "Prefetch16", test_setup, test_teardown,
tests_prefetch16 },
{ "PrinReadKeys", test_setup, test_teardown,
tests_prin_read_keys },
{ "PrinServiceactionRange", test_setup, test_teardown,
tests_prin_serviceaction_range }, tests_prin_serviceaction_range },
{ "ProutRegister", test_setup, test_teardown, { "ProutRegister", NON_PGR_FUNCS, tests_prout_register },
tests_prout_register }, { "ProutReserve", PGR_FUNCS, tests_prout_reserve },
{ "ProutReserve", test_setup_pgr, test_teardown_pgr, { "Read6", NON_PGR_FUNCS, tests_read6 },
tests_prout_reserve }, { "Read10", NON_PGR_FUNCS, tests_read10 },
{ "Read6", test_setup, test_teardown, { "Read12", NON_PGR_FUNCS, tests_read12 },
tests_read6 }, { "Read16", NON_PGR_FUNCS, tests_read16 },
{ "Read10", test_setup, test_teardown, { "ReadCapacity10", NON_PGR_FUNCS, tests_readcapacity10 },
tests_read10 }, { "ReadCapacity16", NON_PGR_FUNCS, tests_readcapacity16 },
{ "Read12", test_setup, test_teardown, { "ReadOnly", NON_PGR_FUNCS, tests_readonly },
tests_read12 }, { "ReportSupportedOpcodes", NON_PGR_FUNCS,
{ "Read16", test_setup, test_teardown,
tests_read16 },
{ "ReadCapacity10", test_setup, test_teardown,
tests_readcapacity10 },
{ "ReadCapacity16", test_setup, test_teardown,
tests_readcapacity16 },
{ "ReadOnly", test_setup, test_teardown,
tests_readonly },
{ "ReportSupportedOpcodes", test_setup, test_teardown,
tests_report_supported_opcodes }, tests_report_supported_opcodes },
{ "Reserve6", test_setup, test_teardown, { "Reserve6", NON_PGR_FUNCS, tests_reserve6 },
tests_reserve6 }, { "TestUnitReady", NON_PGR_FUNCS, tests_testunitready },
{ "TestUnitReady", test_setup, test_teardown, { "Unmap", NON_PGR_FUNCS, tests_unmap },
tests_testunitready }, { "Verify10", NON_PGR_FUNCS, tests_verify10 },
{ "Unmap", test_setup, test_teardown, { "Verify12", NON_PGR_FUNCS, tests_verify12 },
tests_unmap }, { "Verify16", NON_PGR_FUNCS, tests_verify16 },
{ "Verify10", test_setup, test_teardown, { "Write10", NON_PGR_FUNCS, tests_write10 },
tests_verify10 }, { "Write12", NON_PGR_FUNCS, tests_write12 },
{ "Verify12", test_setup, test_teardown, { "Write16", NON_PGR_FUNCS, tests_write16 },
tests_verify12 }, { "WriteSame10", NON_PGR_FUNCS, tests_writesame10 },
{ "Verify16", test_setup, test_teardown, { "WriteSame16", NON_PGR_FUNCS, tests_writesame16 },
tests_verify16 }, { "WriteVerify10", NON_PGR_FUNCS, tests_writeverify10 },
{ "Write10", test_setup, test_teardown, { "WriteVerify12", NON_PGR_FUNCS, tests_writeverify12 },
tests_write10 }, { "WriteVerify16", NON_PGR_FUNCS, tests_writeverify16 },
{ "Write12", test_setup, test_teardown, { NULL, NULL, NULL, NULL, NULL, NULL },
tests_write12 },
{ "Write16", test_setup, test_teardown,
tests_write16 },
{ "WriteSame10", test_setup, test_teardown,
tests_writesame10 },
{ "WriteSame16", test_setup, test_teardown,
tests_writesame16 },
{ "WriteVerify10", test_setup, test_teardown,
tests_writeverify10 },
{ "WriteVerify12", test_setup, test_teardown,
tests_writeverify12 },
{ "WriteVerify16", test_setup, test_teardown,
tests_writeverify16 },
{ NULL, NULL, NULL, NULL },
}; };
struct test_family { struct test_family {
@@ -753,68 +651,77 @@ print_usage(void)
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
CU_ST_RETTYPE void
test_setup(void) test_setup(void)
{
iscsic = iscsi_context_login(initiatorname1, tgt_url, &tgt_lun);
if (iscsic == NULL) {
fprintf(stderr,
"error: Failed to login to target for test set-up\n");
CU_ST_RETURN(1);
}
task = NULL;
CU_ST_RETURN(0);
}
CU_ST_RETTYPE
test_setup_pgr(void)
{ {
task = NULL; task = NULL;
read_write_buf = NULL; read_write_buf = NULL;
}
void
test_teardown(void)
{
free(read_write_buf);
read_write_buf = NULL;
scsi_free_scsi_task(task);
task = NULL;
}
int
suite_init(void)
{
iscsic = iscsi_context_login(initiatorname1, tgt_url, &tgt_lun); iscsic = iscsi_context_login(initiatorname1, tgt_url, &tgt_lun);
if (iscsic == NULL) { if (iscsic == NULL) {
fprintf(stderr, fprintf(stderr,
"error: Failed to login to target for test set-up\n"); "error: Failed to login to target for test set-up\n");
CU_ST_RETURN(1); return 1;
} }
#ifndef HAVE_CU_SUITEINFO_PSETUPFUNC
iscsic2 = iscsi_context_login(initiatorname2, tgt_url, &tgt_lun2); /* libcunit version 1 */
if (iscsic2 == NULL) { test_setup();
fprintf(stderr, #endif
"error: Failed to login to target for test set-up\n"); return 0;
iscsi_logout_sync(iscsic);
iscsi_destroy_context(iscsic);
iscsic = NULL;
CU_ST_RETURN(1);
}
CU_ST_RETURN(0);
} }
CU_ST_RETTYPE int
test_teardown(void) suite_cleanup(void)
{ {
if (task) { #ifndef HAVE_CU_SUITEINFO_PSETUPFUNC
scsi_free_scsi_task(task); /* libcunit version 1 */
task = NULL; test_teardown();
} #endif
if (iscsic) { if (iscsic) {
iscsi_logout_sync(iscsic); iscsi_logout_sync(iscsic);
iscsi_destroy_context(iscsic); iscsi_destroy_context(iscsic);
iscsic = NULL; iscsic = NULL;
} }
CU_ST_RETURN(0); return 0;
} }
CU_ST_RETTYPE int
test_teardown_pgr(void) suite_init_pgr(void)
{ {
test_teardown(); suite_init();
if (read_write_buf != NULL) { iscsic2 = iscsi_context_login(initiatorname2, tgt_url, &tgt_lun2);
free(read_write_buf); if (iscsic2 == NULL) {
read_write_buf = NULL; fprintf(stderr,
"error: Failed to login to target for test set-up\n");
suite_cleanup();
return 1;
} }
CU_ST_RETURN(0); return 0;
}
int
suite_cleanup_pgr(void)
{
if (iscsic2) {
iscsi_logout_sync(iscsic2);
iscsi_destroy_context(iscsic2);
iscsic2 = NULL;
}
suite_cleanup();
return 0;
} }
static void static void
@@ -902,8 +809,14 @@ add_tests(const char *testname_re)
} }
if (!suite_added) { if (!suite_added) {
suite_added++; suite_added++;
#ifdef HAVE_CU_SUITEINFO_PSETUPFUNC
pSuite = CU_add_suite_with_setup_and_teardown(sp->pName,
sp->pInitFunc, sp->pCleanupFunc,
sp->pSetUpFunc, sp->pTearDownFunc);
#else
pSuite = CU_add_suite(sp->pName, pSuite = CU_add_suite(sp->pName,
sp->pInitFunc, sp->pCleanupFunc); sp->pInitFunc, sp->pCleanupFunc);
#endif
} }
CU_add_test(pSuite, tp->pName, tp->pTestFunc); CU_add_test(pSuite, tp->pName, tp->pTestFunc);
} }
+13 -11
View File
@@ -25,6 +25,10 @@
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "iscsi-support.h" #include "iscsi-support.h"
/* globals between setup, tests, and teardown */ /* globals between setup, tests, and teardown */
@@ -35,20 +39,18 @@ extern struct iscsi_context *iscsic2;
extern int tgt_lun2; extern int tgt_lun2;
extern unsigned char *read_write_buf; extern unsigned char *read_write_buf;
#ifdef HAVE_CU_SUITEINFO_PSETUPFUNC #ifndef HAVE_CU_SUITEINFO_PSETUPFUNC
/* libcunit version 2 */
#define CU_ST_RETTYPE void
#define CU_ST_RETURN(v) return
#else
/* libcunit version 1 */ /* libcunit version 1 */
#define CU_ST_RETTYPE int typedef void (*CU_SetUpFunc)(void);
#define CU_ST_RETURN(v) return v typedef void (*CU_TearDownFunc)(void);
#endif #endif
CU_ST_RETTYPE test_setup(void); int suite_init(void);
CU_ST_RETTYPE test_teardown(void); int suite_cleanup(void);
CU_ST_RETTYPE test_setup_pgr(void); int suite_init_pgr(void);
CU_ST_RETTYPE test_teardown_pgr(void); int suite_cleanup_pgr(void);
void test_setup(void);
void test_teardown(void);
void test_compareandwrite_simple(void); void test_compareandwrite_simple(void);
void test_compareandwrite_miscompare(void); void test_compareandwrite_miscompare(void);