/* * Test event driven healtchecking. */ static int test5 (void) { cs_error_t error; unsigned int instance_id; int hc_cb_count; qb_log (LOG_INFO, " initialize"); error = sam_initialize (100, SAM_RECOVERY_POLICY_RESTART); if (error != CS_OK) { qb_log (LOG_ERR, "Can't initialize SAM API. Error %d", error); return 1; } qb_log (LOG_INFO, " register"); error = sam_register (&instance_id); if (error != CS_OK) { qb_log (LOG_ERR, "Can't register. Error %d", error); return 1; } if (instance_id == 1) { qb_log (LOG_INFO, "iid %d: hc callback register", instance_id); error = sam_hc_callback_register (test5_hc_cb); if (error != CS_OK) { qb_log (LOG_ERR, "Can't register hc cb. Error %d", error); return 1; } qb_log (LOG_INFO, "iid %d: start", instance_id); error = sam_start (); if (error != CS_OK) { qb_log (LOG_ERR, "Can't start hc. Error %d", error); return 1; } sleep (2); qb_log (LOG_INFO, "iid %d: Failed. Wasn't killed.", instance_id); return 1; } if (instance_id == 2) { error = sam_data_restore (&hc_cb_count, sizeof (hc_cb_count)); if (error != CS_OK) { qb_log (LOG_ERR, "sam_data_restore should return CS_OK. Error returned %d", error); return 1; } if (hc_cb_count != 11) { qb_log (LOG_ERR, "iid %d: Premature killed. hc_cb_count should be 11 and it is %d", __FUNCTION__, instance_id - 1, hc_cb_count); return 1; } return 0; } return 1; }
/* * Test event driven healtchecking. */ static int test5 (void) { cs_error_t error; unsigned int instance_id; int hc_cb_count; printf ("%s: initialize\n", __FUNCTION__); error = sam_initialize (100, SAM_RECOVERY_POLICY_RESTART); if (error != CS_OK) { fprintf (stderr, "Can't initialize SAM API. Error %d\n", error); return 1; } printf ("%s: register\n", __FUNCTION__); error = sam_register (&instance_id); if (error != CS_OK) { fprintf (stderr, "Can't register. Error %d\n", error); return 1; } if (instance_id == 1) { printf ("%s iid %d: hc callback register\n", __FUNCTION__, instance_id); error = sam_hc_callback_register (test5_hc_cb); if (error != CS_OK) { fprintf (stderr, "Can't register hc cb. Error %d\n", error); return 1; } printf ("%s iid %d: start\n", __FUNCTION__, instance_id); error = sam_start (); if (error != CS_OK) { fprintf (stderr, "Can't start hc. Error %d\n", error); return 1; } sleep (2); printf ("%s iid %d: Failed. Wasn't killed.\n", __FUNCTION__, instance_id); return 1; } if (instance_id == 2) { error = sam_data_restore (&hc_cb_count, sizeof (hc_cb_count)); if (error != CS_OK) { fprintf (stderr, "sam_data_restore should return CS_OK. Error returned %d\n", error); return 1; } if (hc_cb_count != 11) { fprintf (stderr, "%s iid %d: Premature killed. hc_cb_count should be 11 and it is %d\n", __FUNCTION__, instance_id - 1, hc_cb_count); return 1; } return 0; } return 1; }
/* * Test warn signal set. */ static int test6 (void) { cs_error_t error; unsigned int instance_id; int test6_sig_del; qb_log (LOG_INFO, " initialize"); error = sam_initialize (2000, SAM_RECOVERY_POLICY_RESTART); if (error != CS_OK) { qb_log (LOG_ERR, "Can't initialize SAM API. Error %d", error); return 1; } qb_log (LOG_INFO, " register"); error = sam_register (&instance_id); if (error != CS_OK) { qb_log (LOG_ERR, "Can't register. Error %d", error); return 1; } if (instance_id == 1) { error = sam_warn_signal_set (SIGUSR1); if (error != CS_OK) { qb_log (LOG_ERR, "Can't set warn signal. Error %d", error); return 1; } signal (SIGUSR1, test6_signal); qb_log (LOG_INFO, " iid %d: start", instance_id); error = sam_start (); if (error != CS_OK) { qb_log (LOG_ERR, "Can't start hc. Error %d", error); return 1; } qb_log (LOG_INFO, "iid %d: sleep 1", instance_id); sleep (1); qb_log (LOG_INFO, "iid %d: hc send", instance_id); error = sam_hc_send (); if (error != CS_OK) { qb_log (LOG_ERR, "Can't send hc. Error %d", error); return 1; } qb_log (LOG_INFO, "iid %d: wait for delivery of signal", instance_id); while (!test6_sig_delivered) { sleep (1); } qb_log (LOG_INFO, "iid %d: wait for real kill", instance_id); sleep (3); qb_log (LOG_INFO, "iid %d: wasn't killed", instance_id); return (1); } if (instance_id == 2) { error = sam_data_restore (&test6_sig_del, sizeof (test6_sig_del)); if (error != CS_OK) { qb_log (LOG_ERR, "Can't restore data. Error %d", error); return 1; } if (test6_sig_del != 1) { qb_log (LOG_ERR, "Previous test failed. Signal was not delivered"); return 1; } error = sam_warn_signal_set (SIGKILL); if (error != CS_OK) { qb_log (LOG_ERR, "Can't set warn signal. Error %d", error); return 1; } signal (SIGUSR1, test6_signal); qb_log (LOG_INFO, "iid %d: start", instance_id); error = sam_start (); if (error != CS_OK) { qb_log (LOG_ERR, "Can't start hc. Error %d", error); return 1; } qb_log (LOG_INFO, "iid %d: sleep 1", instance_id); sleep (1); qb_log (LOG_INFO, "iid %d: hc send", instance_id); error = sam_hc_send (); if (error != CS_OK) { qb_log (LOG_ERR, "Can't send hc. Error %d", error); return 1; } qb_log (LOG_INFO, "iid %d: wait for delivery of signal", instance_id); while (!test6_sig_delivered) { sleep (1); } qb_log (LOG_INFO, "iid %d: wasn't killed", instance_id); return (1); } if (instance_id == 3) { error = sam_data_restore (&test6_sig_del, sizeof (test6_sig_del)); if (error != CS_OK) { qb_log (LOG_ERR, "Can't restore data. Error %d", error); return 1; } if (test6_sig_del != 1) { qb_log (LOG_ERR, "Previous test failed. Signal WAS delivered"); return 1; } return (0); } return 1; }
/* * Test sam_data_store, sam_data_restore and sam_data_getsize */ static int test4 (void) { size_t size; cs_error_t err; int i; unsigned int instance_id; char saved_data[128]; char saved_data2[128]; qb_log (LOG_INFO, "sam_data_getsize 1"); err = sam_data_getsize (&size); if (err != CS_ERR_BAD_HANDLE) { qb_log (LOG_ERR, "Test should return CS_ERR_BAD_HANDLE. Error returned %d", err); return 1; } qb_log (LOG_INFO, "sam_data_getsize 2"); err = sam_data_getsize (NULL); if (err != CS_ERR_INVALID_PARAM) { qb_log (LOG_ERR, "Test should return CS_ERR_INVALID_PARAM. Error returned %d", err); return 1; } qb_log (LOG_INFO, "sam_data_store 1"); err = sam_data_store (NULL, 0); if (err != CS_ERR_BAD_HANDLE) { qb_log (LOG_ERR, "Test should return CS_ERR_BAD_HANDLE. Error returned %d", err); return 1; } qb_log (LOG_INFO, "sam_data_restore 1"); err = sam_data_restore (saved_data, sizeof (saved_data)); if (err != CS_ERR_BAD_HANDLE) { qb_log (LOG_ERR, "Test should return CS_ERR_BAD_HANDLE. Error returned %d", err); return 1; } qb_log (LOG_INFO, "sam_initialize"); err = sam_initialize (0, SAM_RECOVERY_POLICY_RESTART); if (err != CS_OK) { qb_log (LOG_ERR, "Can't initialize SAM API. Error %d", err); return 1; } qb_log (LOG_INFO, "sam_data_getsize 3"); err = sam_data_getsize (&size); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_ERR_BAD_HANDLE. Error returned %d", err); return 1; } if (size != 0) { qb_log (LOG_ERR, "Test should return size of 0. Returned %zx", size); return 1; } qb_log (LOG_INFO, "sam_data_restore 2"); err = sam_data_restore (NULL, sizeof (saved_data)); if (err != CS_ERR_INVALID_PARAM) { qb_log (LOG_ERR, "Test should return CS_ERR_INVALID_PARAM. Error returned %d", err); return 1; } /* * Store some real data */ for (i = 0; i < sizeof (saved_data); i++) { saved_data[i] = (char)(i + 5); } qb_log (LOG_INFO, "sam_data_store 2"); err = sam_data_store (saved_data, sizeof (saved_data)); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err); return 1; } qb_log (LOG_INFO, " sam_data_getsize 4"); err = sam_data_getsize (&size); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err); return 1; } if (size != sizeof (saved_data)) { qb_log (LOG_ERR, "Test should return size of 0. Returned %zx", size); return 1; } qb_log (LOG_INFO, " sam_data_restore 3"); err = sam_data_restore (saved_data2, sizeof (saved_data2) - 1); if (err != CS_ERR_INVALID_PARAM) { qb_log (LOG_ERR, "Test should return CS_ERR_INVALID_PARAM. Error returned %d", err); return 1; } qb_log (LOG_INFO, " sam_data_restore 4"); err = sam_data_restore (saved_data2, sizeof (saved_data2)); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err); return 1; } if (memcmp (saved_data, saved_data2, sizeof (saved_data2)) != 0) { qb_log (LOG_ERR, "Retored data are not same"); return 1; } memset (saved_data2, 0, sizeof (saved_data2)); qb_log (LOG_INFO, " sam_data_store 3"); err = sam_data_store (NULL, 1); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err); return 1; } qb_log (LOG_INFO, " sam_data_getsize 5"); err = sam_data_getsize (&size); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err); return 1; } if (size != 0) { qb_log (LOG_ERR, "Test should return size of 0. Returned %zx", size); return 1; } qb_log (LOG_INFO, " sam_data_store 4"); err = sam_data_store (saved_data, sizeof (saved_data)); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err); return 1; } qb_log (LOG_INFO, " register"); err = sam_register (&instance_id); if (err != CS_OK) { qb_log (LOG_ERR, "Can't register. Error %d", err); return 1; } if (instance_id == 1) { qb_log (LOG_INFO, "iid %d: sam_start", instance_id); err = sam_start (); if (err != CS_OK) { qb_log (LOG_ERR, "Can't start hc. Error %d", err); return 1; } qb_log (LOG_INFO, "iid %d: sam_data_getsize 6", instance_id); err = sam_data_getsize (&size); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err); return 1; } if (size != sizeof (saved_data2)) { qb_log (LOG_ERR, "Test should return size of 0. Returned %zx", size); return 1; } qb_log (LOG_INFO, "iid %d: sam_data_restore 5", instance_id); err = sam_data_restore (saved_data2, sizeof (saved_data2)); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err); return 1; } if (memcmp (saved_data, saved_data2, sizeof (saved_data2)) != 0) { qb_log (LOG_ERR, "Retored data are not same"); return 1; } for (i = 0; i < sizeof (saved_data); i++) { saved_data[i] = (char)(i - 5); } qb_log (LOG_INFO, "iid %d: sam_data_store 5", instance_id); err = sam_data_store (saved_data, sizeof (saved_data) - 7); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err); return 1; } exit (1); } if (instance_id == 2) { qb_log (LOG_INFO, "iid %d: sam_start", instance_id); err = sam_start (); if (err != CS_OK) { qb_log (LOG_ERR, "Can't start hc. Error %d", err); return 1; } qb_log (LOG_INFO, "iid %d: sam_data_getsize 7", instance_id); err = sam_data_getsize (&size); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err); return 1; } if (size != sizeof (saved_data2) - 7) { qb_log (LOG_ERR, "Test should return size of 0. Returned %zx", size); return 1; } qb_log (LOG_INFO, "iid %d: sam_data_restore 6", instance_id); err = sam_data_restore (saved_data2, sizeof (saved_data2)); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err); return 1; } for (i = 0; i < sizeof (saved_data); i++) { saved_data[i] = (char)(i - 5); } if (memcmp (saved_data, saved_data2, sizeof (saved_data2) - 7) != 0) { qb_log (LOG_ERR, "Retored data are not same"); return 1; } qb_log (LOG_INFO, "iid %d: sam_data_store 6", instance_id); err = sam_data_store (NULL, 0); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err); return 1; } exit (1); } if (instance_id == 3) { qb_log (LOG_INFO, "iid %d: sam_data_getsize 8", instance_id); err = sam_data_getsize (&size); if (err != CS_OK) { qb_log (LOG_ERR, "Test should return CS_OK. Error returned %d", err); return 1; } if (size != 0) { qb_log (LOG_ERR, "Test should return size of 0. Returned %zx", size); return 1; } } return (0); }
/* * Test warn signal set. */ static int sam_test6 (void) { cs_error_t error; unsigned int instance_id; int test6_sig_del; setlinebuf(stdout); printf ("%s: initialize\n", __FUNCTION__); error = sam_initialize (2000, SAM_RECOVERY_POLICY_RESTART); if (error != CS_OK) { fprintf (stderr, "Can't initialize SAM API. Error %d\n", error); return 1; } printf ("%s: register\n", __FUNCTION__); error = sam_register (&instance_id); if (error != CS_OK) { fprintf (stderr, "Can't register. Error %d\n", error); return 1; } if (instance_id == 1) { error = sam_warn_signal_set (SIGUSR1); if (error != CS_OK) { fprintf (stderr, "Can't set warn signal. Error %d\n", error); return 1; } signal (SIGUSR1, test6_signal); printf ("%s iid %d: start\n", __FUNCTION__, instance_id); error = sam_start (); if (error != CS_OK) { fprintf (stderr, "Can't start hc. Error %d\n", error); return 1; } printf ("%s iid %d: sleep 1\n", __FUNCTION__, instance_id); sleep (1); printf ("%s iid %d: hc send\n", __FUNCTION__, instance_id); error = sam_hc_send (); if (error != CS_OK) { fprintf (stderr, "Can't send hc. Error %d\n", error); return 1; } printf ("%s iid %d: wait for delivery of signal\n", __FUNCTION__, instance_id); while (!test6_sig_delivered) { sleep (1); } printf ("%s iid %d: wait for real kill\n", __FUNCTION__, instance_id); sleep (3); printf ("%s iid %d: wasn't killed\n", __FUNCTION__, instance_id); return (1); } if (instance_id == 2) { error = sam_data_restore (&test6_sig_del, sizeof (test6_sig_del)); if (error != CS_OK) { fprintf (stderr, "Can't restore data. Error %d\n", error); return 1; } if (test6_sig_del != 1) { fprintf (stderr, "Previous test failed. Signal was not delivered\n"); return 1; } error = sam_warn_signal_set (SIGKILL); if (error != CS_OK) { fprintf (stderr, "Can't set warn signal. Error %d\n", error); return 1; } signal (SIGUSR1, test6_signal); printf ("%s iid %d: start\n", __FUNCTION__, instance_id); error = sam_start (); if (error != CS_OK) { fprintf (stderr, "Can't start hc. Error %d\n", error); return 1; } printf ("%s iid %d: sleep 1\n", __FUNCTION__, instance_id); sleep (1); printf ("%s iid %d: hc send\n", __FUNCTION__, instance_id); error = sam_hc_send (); if (error != CS_OK) { fprintf (stderr, "Can't send hc. Error %d\n", error); return 1; } printf ("%s iid %d: wait for delivery of signal\n", __FUNCTION__, instance_id); while (!test6_sig_delivered) { sleep (1); } printf ("%s iid %d: wasn't killed\n", __FUNCTION__, instance_id); return (1); } if (instance_id == 3) { error = sam_data_restore (&test6_sig_del, sizeof (test6_sig_del)); if (error != CS_OK) { fprintf (stderr, "Can't restore data. Error %d\n", error); return 1; } if (test6_sig_del != 1) { fprintf (stderr, "Previous test failed. Signal WAS delivered\n"); return 1; } return (0); } return 1; }
/* * Test sam_data_store, sam_data_restore and sam_data_getsize */ static int sam_test4 (void) { size_t size; cs_error_t err; int i; unsigned int instance_id; char saved_data[128]; char saved_data2[128]; setlinebuf(stdout); printf ("%s: sam_data_getsize 1\n", __FUNCTION__); err = sam_data_getsize (&size); if (err != CS_ERR_BAD_HANDLE) { fprintf (stderr, "Test should return CS_ERR_BAD_HANDLE. Error returned %d\n", err); return 1; } printf ("%s: sam_data_getsize 2\n", __FUNCTION__); err = sam_data_getsize (NULL); if (err != CS_ERR_INVALID_PARAM) { fprintf (stderr, "Test should return CS_ERR_INVALID_PARAM. Error returned %d\n", err); return 1; } printf ("%s: sam_data_store 1\n", __FUNCTION__); err = sam_data_store (NULL, 0); if (err != CS_ERR_BAD_HANDLE) { fprintf (stderr, "Test should return CS_ERR_BAD_HANDLE. Error returned %d\n", err); return 1; } printf ("%s: sam_data_restore 1\n", __FUNCTION__); err = sam_data_restore (saved_data, sizeof (saved_data)); if (err != CS_ERR_BAD_HANDLE) { fprintf (stderr, "Test should return CS_ERR_BAD_HANDLE. Error returned %d\n", err); return 1; } printf ("%s: sam_initialize\n", __FUNCTION__); err = sam_initialize (0, SAM_RECOVERY_POLICY_RESTART); if (err != CS_OK) { fprintf (stderr, "Can't initialize SAM API. Error %d\n", err); return 1; } printf ("%s: sam_data_getsize 3\n", __FUNCTION__); err = sam_data_getsize (&size); if (err != CS_OK) { fprintf (stderr, "Test should return CS_ERR_BAD_HANDLE. Error returned %d\n", err); return 1; } if (size != 0) { fprintf (stderr, "Test should return size of 0. Returned %zx\n", size); return 1; } printf ("%s: sam_data_restore 2\n", __FUNCTION__); err = sam_data_restore (NULL, sizeof (saved_data)); if (err != CS_ERR_INVALID_PARAM) { fprintf (stderr, "Test should return CS_ERR_INVALID_PARAM. Error returned %d\n", err); return 1; } /* * Store some real data */ for (i = 0; i < sizeof (saved_data); i++) { saved_data[i] = (char)(i + 5); } printf ("%s: sam_data_store 2\n", __FUNCTION__); err = sam_data_store (saved_data, sizeof (saved_data)); if (err != CS_OK) { fprintf (stderr, "Test should return CS_OK. Error returned %d\n", err); return 1; } printf ("%s: sam_data_getsize 4\n", __FUNCTION__); err = sam_data_getsize (&size); if (err != CS_OK) { fprintf (stderr, "Test should return CS_OK. Error returned %d\n", err); return 1; } if (size != sizeof (saved_data)) { fprintf (stderr, "Test should return size of 0. Returned %zx\n", size); return 1; } printf ("%s: sam_data_restore 3\n", __FUNCTION__); err = sam_data_restore (saved_data2, sizeof (saved_data2) - 1); if (err != CS_ERR_INVALID_PARAM) { fprintf (stderr, "Test should return CS_ERR_INVALID_PARAM. Error returned %d\n", err); return 1; } printf ("%s: sam_data_restore 4\n", __FUNCTION__); err = sam_data_restore (saved_data2, sizeof (saved_data2)); if (err != CS_OK) { fprintf (stderr, "Test should return CS_OK. Error returned %d\n", err); return 1; } if (memcmp (saved_data, saved_data2, sizeof (saved_data2)) != 0) { fprintf (stderr, "Retored data are not same\n"); return 1; } memset (saved_data2, 0, sizeof (saved_data2)); printf ("%s: sam_data_store 3\n", __FUNCTION__); err = sam_data_store (NULL, 1); if (err != CS_OK) { fprintf (stderr, "Test should return CS_OK. Error returned %d\n", err); return 1; } printf ("%s: sam_data_getsize 5\n", __FUNCTION__); err = sam_data_getsize (&size); if (err != CS_OK) { fprintf (stderr, "Test should return CS_OK. Error returned %d\n", err); return 1; } if (size != 0) { fprintf (stderr, "Test should return size of 0. Returned %zx\n", size); return 1; } printf ("%s: sam_data_store 4\n", __FUNCTION__); err = sam_data_store (saved_data, sizeof (saved_data)); if (err != CS_OK) { fprintf (stderr, "Test should return CS_OK. Error returned %d\n", err); return 1; } printf ("%s: register\n", __FUNCTION__); err = sam_register (&instance_id); if (err != CS_OK) { fprintf (stderr, "Can't register. Error %d\n", err); return 1; } if (instance_id == 1) { printf ("%s iid %d: sam_start\n", __FUNCTION__, instance_id); err = sam_start (); if (err != CS_OK) { fprintf (stderr, "Can't start hc. Error %d\n", err); return 1; } printf ("%s iid %d: sam_data_getsize 6\n", __FUNCTION__, instance_id); err = sam_data_getsize (&size); if (err != CS_OK) { fprintf (stderr, "Test should return CS_OK. Error returned %d\n", err); return 1; } if (size != sizeof (saved_data2)) { fprintf (stderr, "Test should return size of 0. Returned %zx\n", size); return 1; } printf ("%s iid %d: sam_data_restore 5\n", __FUNCTION__, instance_id); err = sam_data_restore (saved_data2, sizeof (saved_data2)); if (err != CS_OK) { fprintf (stderr, "Test should return CS_OK. Error returned %d\n", err); return 1; } if (memcmp (saved_data, saved_data2, sizeof (saved_data2)) != 0) { fprintf (stderr, "Retored data are not same\n"); return 1; } for (i = 0; i < sizeof (saved_data); i++) { saved_data[i] = (char)(i - 5); } printf ("%s iid %d: sam_data_store 5\n", __FUNCTION__, instance_id); err = sam_data_store (saved_data, sizeof (saved_data) - 7); if (err != CS_OK) { fprintf (stderr, "Test should return CS_OK. Error returned %d\n", err); return 1; } exit (1); } if (instance_id == 2) { printf ("%s iid %d: sam_start\n", __FUNCTION__, instance_id); err = sam_start (); if (err != CS_OK) { fprintf (stderr, "Can't start hc. Error %d\n", err); return 1; } printf ("%s iid %d: sam_data_getsize 7\n", __FUNCTION__, instance_id); err = sam_data_getsize (&size); if (err != CS_OK) { fprintf (stderr, "Test should return CS_OK. Error returned %d\n", err); return 1; } if (size != sizeof (saved_data2) - 7) { fprintf (stderr, "Test should return size of 0. Returned %zx\n", size); return 1; } printf ("%s iid %d: sam_data_restore 6\n", __FUNCTION__, instance_id); err = sam_data_restore (saved_data2, sizeof (saved_data2)); if (err != CS_OK) { fprintf (stderr, "Test should return CS_OK. Error returned %d\n", err); return 1; } for (i = 0; i < sizeof (saved_data); i++) { saved_data[i] = (char)(i - 5); } if (memcmp (saved_data, saved_data2, sizeof (saved_data2) - 7) != 0) { fprintf (stderr, "Retored data are not same\n"); return 1; } printf ("%s iid %d: sam_data_store 6\n", __FUNCTION__, instance_id); err = sam_data_store (NULL, 0); if (err != CS_OK) { fprintf (stderr, "Test should return CS_OK. Error returned %d\n", err); return 1; } exit (1); } if (instance_id == 3) { printf ("%s iid %d: sam_data_getsize 8\n", __FUNCTION__, instance_id); err = sam_data_getsize (&size); if (err != CS_OK) { fprintf (stderr, "Test should return CS_OK. Error returned %d\n", err); return 1; } if (size != 0) { fprintf (stderr, "Test should return size of 0. Returned %zx\n", size); return 1; } } return (0); }