diff --git a/test/testamf1.c b/test/testamf1.c index dd41584c..e0477ddf 100644 --- a/test/testamf1.c +++ b/test/testamf1.c @@ -67,19 +67,25 @@ void setSanameT (SaNameT *name, char *str) { memcpy (name->value, str, name->length); } -int healthcheck_count = 0; +static int health_flag = -1; +static unsigned int healthcheck_count = 0; +static unsigned int healthcheck_no = 0; void HealthcheckCallback (SaInvocationT invocation, const SaNameT *compName, SaAmfHealthcheckT checkType) { + SaErrorT res; -// if (healthcheck_count++ % 20 == 19) { - printf ("20 HealthcheckCallback have occured for component: "); + healthcheck_no ++; + if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) { + printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no); printSaNameT ((SaNameT *)compName); printf ("\n"); -// } - saAmfResponse (invocation, SA_OK); - + } + res = saAmfResponse (invocation, SA_OK); + if (res != SA_OK) { + printf ("response res is %d\n", res); + } } void ReadinessStateSetCallback (SaInvocationT invocation, @@ -245,18 +251,42 @@ void sigintr_handler (int signum) { } -int main (void) { +int main (int argc, char **argv) { SaAmfHandleT handle; int result; int select_fd; fd_set read_fds; SaNameT compName; + extern char *optarg; + extern int optind; + int c; + memset (&compName, 0, sizeof (SaNameT)); signal (SIGINT, sigintr_handler); - result = sched_setscheduler (0, SCHED_RR, &sched_param); - if (result == -1) { -printf ("couldn't set sched priority\n"); - } + result = sched_setscheduler (0, SCHED_RR, &sched_param); + if (result == -1) { + printf ("couldn't set sched priority\n"); + } + + for (;;){ + c = getopt(argc,argv,"h:n:"); + if (c==-1) { + break; + } + switch (c) { + case 0 : + break; + case 'h': + health_flag = 0; + sscanf (optarg,"%ud" ,&healthcheck_count); + break; + case 'n': + setSanameT (&compName, optarg); + break; + default : + break; + } + } result = saAmfInitialize (&handle, &amfCallbacks, &version); if (result != SA_OK) { @@ -267,8 +297,9 @@ printf ("couldn't set sched priority\n"); FD_ZERO (&read_fds); saAmfSelectionObjectGet (&handle, &select_fd); FD_SET (select_fd, &read_fds); - - setSanameT (&compName, "comp_a_in_su_x"); + if (compName.length <= 0) { + setSanameT (&compName, "comp_a_in_su_x"); + } result = saAmfComponentRegister (&handle, &compName, NULL); printf ("register result is %d (should be 1)\n", result); diff --git a/test/testamf2.c b/test/testamf2.c index 751f2b56..ba513100 100644 --- a/test/testamf2.c +++ b/test/testamf2.c @@ -67,20 +67,26 @@ void setSanameT (SaNameT *name, char *str) { memcpy (name->value, str, name->length); } -int healthcheck_count = 0; +static int health_flag = -1; +static unsigned int healthcheck_count = 0; +static unsigned int healthcheck_no = 0; void HealthcheckCallback (SaInvocationT invocation, const SaNameT *compName, SaAmfHealthcheckT checkType) { + SaErrorT res; -// if (healthcheck_count++ % 20 == 19) { - printf ("20 HealthcheckCallback have occured for component: "); + healthcheck_no++; + + if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) { + printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no); printSaNameT ((SaNameT *)compName); printf ("\n"); -// } - saAmfResponse (invocation, SA_OK); - printf ("Healthcheck Count is %d\n", healthcheck_count++); - + } + res = saAmfResponse (invocation, SA_OK); + if (res != SA_OK) { + printf ("response res is %d\n", res); + } } void ReadinessStateSetCallback (SaInvocationT invocation, @@ -240,18 +246,40 @@ void sigintr_handler (int signum) { exit (0); } - -int main (void) { +int main (int argc, char **argv) { SaAmfHandleT handle; int result; int select_fd; fd_set read_fds; SaNameT compName; - int i; + int c,i; SaAmfErrorDescriptorT errorDescriptor; + extern char *optarg; + extern int optind; + memset (&compName, 0, sizeof (SaNameT)); signal (SIGINT, sigintr_handler); + for (;;) { + c = getopt(argc,argv,"h:n:"); + if (c==-1) { + break; + } + switch (c) { + case 0 : + break; + case 'h': + health_flag = 0; + sscanf (optarg,"%ud" ,&healthcheck_count); + break; + case 'n': + setSanameT (&compName, optarg); + break; + default : + break; + } + } + result = saAmfInitialize (&handle, &amfCallbacks, &version); if (result != SA_OK) { printf ("initialize result is %d\n", result); @@ -262,7 +290,9 @@ int main (void) { saAmfSelectionObjectGet (&handle, &select_fd); FD_SET (select_fd, &read_fds); - setSanameT (&compName, "comp_b_in_su_x"); + if (compName.length <= 0){ + setSanameT (&compName, "comp_b_in_su_x"); + } result = saAmfComponentRegister (&handle, &compName, NULL); diff --git a/test/testamf3.c b/test/testamf3.c index cb85ca18..11032770 100644 --- a/test/testamf3.c +++ b/test/testamf3.c @@ -66,19 +66,26 @@ void setSanameT (SaNameT *name, char *str) { memcpy (name->value, str, name->length); } -int healthcheck_count = 0; +static int health_flag = -1; +static unsigned int healthcheck_count = 0; +static unsigned int healthcheck_no = 0; void HealthcheckCallback (SaInvocationT invocation, const SaNameT *compName, SaAmfHealthcheckT checkType) { + SaErrorT res; + healthcheck_no ++; -// if (healthcheck_count++ % 20 == 19) { - printf ("20 HealthcheckCallback have occured for component: "); + if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) { + printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no); printSaNameT ((SaNameT *)compName); printf ("\n"); -// } - saAmfResponse (invocation, SA_OK); + } + res = saAmfResponse (invocation, SA_OK); + if (res != SA_OK) { + printf ("response res is %d\n", res); + } } void ReadinessStateSetCallback (SaInvocationT invocation, @@ -240,14 +247,38 @@ void sigintr_handler (int signum) { } -int main (void) { +int main (int argc, char **argv) { SaAmfHandleT handle; int result; int select_fd; fd_set read_fds; SaNameT compName; + extern char *optarg; + extern int optind; + int c; signal (SIGINT, sigintr_handler); + memset (&compName, 0, sizeof (SaNameT)); + for (;;) { + c = getopt(argc,argv,"h:n:"); + if (c==-1) { + break; + } + switch (c) { + case 0 : + break; + case 'h': + health_flag = 0; + sscanf (optarg,"%ud" ,&healthcheck_count); + break; + case 'n': + setSanameT (&compName, optarg); + break; + default : + break; + } + } + result = saAmfInitialize (&handle, &amfCallbacks, &version); if (result != SA_OK) { printf ("initialize result is %d\n", result); @@ -258,7 +289,9 @@ int main (void) { saAmfSelectionObjectGet (&handle, &select_fd); FD_SET (select_fd, &read_fds); - setSanameT (&compName, "comp_a_in_su_y"); + if (compName.length <= 0){ + setSanameT (&compName, "comp_b_in_su_x"); + } result = saAmfComponentRegister (&handle, &compName, NULL); printf ("register result is %d (should be 1)\n", result); diff --git a/test/testamf4.c b/test/testamf4.c index 145eff72..517f91fb 100644 --- a/test/testamf4.c +++ b/test/testamf4.c @@ -66,19 +66,25 @@ void setSanameT (SaNameT *name, char *str) { memcpy (name->value, str, name->length); } -int healthcheck_count = 0; +static int health_flag = -1; +static unsigned int healthcheck_count = 0; +static unsigned int healthcheck_no = 0; void HealthcheckCallback (SaInvocationT invocation, const SaNameT *compName, SaAmfHealthcheckT checkType) { + SaErrorT res; -// if (healthcheck_count++ % 20 == 19) { - printf ("20 HealthcheckCallback have occured for component: "); + healthcheck_no ++; + if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) { + printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no); printSaNameT ((SaNameT *)compName); printf ("\n"); -// } - saAmfResponse (invocation, SA_OK); - + } + res = saAmfResponse (invocation, SA_OK); + if (res != SA_OK) { + printf ("response res is %d\n", res); + } } void ReadinessStateSetCallback (SaInvocationT invocation, @@ -238,16 +244,39 @@ void sigintr_handler (int signum) { exit (0); } - -int main (void) { +int main (int argc, char **argv) { SaAmfHandleT handle; int result; int select_fd; fd_set read_fds; SaNameT compName; + extern char *optarg; + extern int optind; + int c; + memset (&compName, 0, sizeof (SaNameT)); signal (SIGINT, sigintr_handler); + for (;;) { + c = getopt(argc,argv,"h:n:"); + if (c==-1) { + break; + } + switch (c) { + case 0 : + break; + case 'h': + health_flag = 0; + sscanf (optarg,"%ud" ,&healthcheck_count); + break; + case 'n': + setSanameT (&compName, optarg); + break; + default : + break; + } + } + result = saAmfInitialize (&handle, &amfCallbacks, &version); if (result != SA_OK) { printf ("initialize result is %d\n", result); @@ -258,7 +287,9 @@ int main (void) { saAmfSelectionObjectGet (&handle, &select_fd); FD_SET (select_fd, &read_fds); - setSanameT (&compName, "comp_b_in_su_y"); + if (compName.length <= 0){ + setSanameT (&compName, "comp_b_in_su_x"); + } result = saAmfComponentRegister (&handle, &compName, NULL); printf ("register result is %d (should be 1)\n", result); diff --git a/test/testamf5.c b/test/testamf5.c index cf8a5b86..73cdd5c1 100644 --- a/test/testamf5.c +++ b/test/testamf5.c @@ -66,19 +66,25 @@ void setSanameT (SaNameT *name, char *str) { memcpy (name->value, str, name->length); } -int healthcheck_count = 0; +static int health_flag = -1; +static unsigned int healthcheck_count = 0; +static unsigned int healthcheck_no = 0; void HealthcheckCallback (SaInvocationT invocation, const SaNameT *compName, SaAmfHealthcheckT checkType) { + SaErrorT res; -// if (healthcheck_count++ % 20 == 19) { - printf ("20 HealthcheckCallback have occured for component: "); + healthcheck_no ++; + if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) { + printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no); printSaNameT ((SaNameT *)compName); printf ("\n"); -// } - saAmfResponse (invocation, SA_OK); - + } + res = saAmfResponse (invocation, SA_OK); + if (res != SA_OK) { + printf ("response res is %d\n", res); + } } void ReadinessStateSetCallback (SaInvocationT invocation, @@ -239,14 +245,39 @@ void sigintr_handler (int signum) { exit (0); } -int main (void) { +int main (int argc, char **argv) { SaAmfHandleT handle; int result; int select_fd; fd_set read_fds; SaNameT compName; + extern char *optarg; + extern int optind; + int c; + memset (&compName, 0, sizeof (SaNameT)); signal (SIGINT, sigintr_handler); + + for (;;) { + c = getopt(argc,argv,"h:n:"); + if (c==-1) { + break; + } + switch (c) { + case 0 : + break; + case 'h': + health_flag = 0; + sscanf (optarg,"%ud" ,&healthcheck_count); + break; + case 'n': + setSanameT (&compName, optarg); + break; + default : + break; + } + } + result = saAmfInitialize (&handle, &amfCallbacks, &version); if (result != SA_OK) { printf ("initialize result is %d\n", result); @@ -257,7 +288,9 @@ int main (void) { saAmfSelectionObjectGet (&handle, &select_fd); FD_SET (select_fd, &read_fds); - setSanameT (&compName, "comp_a_in_su_z"); + if (compName.length <= 0){ + setSanameT (&compName, "comp_b_in_su_x"); + } result = saAmfComponentRegister (&handle, &compName, NULL); printf ("register result is %d (should be 1)\n", result); diff --git a/test/testamf6.c b/test/testamf6.c index 6d7b960b..b623bc8f 100644 --- a/test/testamf6.c +++ b/test/testamf6.c @@ -66,21 +66,26 @@ void setSanameT (SaNameT *name, char *str) { memcpy (name->value, str, name->length); } -int healthcheck_count = 0; + +static int health_flag = -1; +static unsigned int healthcheck_count = 0; +static unsigned int healthcheck_no = 0; void HealthcheckCallback (SaInvocationT invocation, const SaNameT *compName, SaAmfHealthcheckT checkType) { SaErrorT res; -// if (healthcheck_count++ % 20 == 19) { - printf ("20 HealthcheckCallback have occured for component: "); + healthcheck_no ++; + if (health_flag == -1 || healthcheck_no%healthcheck_count == 0) { + printf ("%u HealthcheckCallback have occured for component: ",healthcheck_no); printSaNameT ((SaNameT *)compName); printf ("\n"); -// } + } res = saAmfResponse (invocation, SA_OK); - printf ("response res is %d\n", res); - + if (res != SA_OK) { + printf ("response res is %d\n", res); + } } void ReadinessStateSetCallback (SaInvocationT invocation, @@ -240,26 +245,53 @@ void sigintr_handler (int signum) { exit (0); } -int main (void) { +int main (int argc, char **argv) { SaAmfHandleT handle; int result; int select_fd; fd_set read_fds; SaNameT compName; + extern char *optarg; + extern int optind; + int c; + memset (&compName, 0, sizeof (SaNameT)); signal (SIGINT, sigintr_handler); + for (;;) { + c = getopt(argc,argv,"h:n:"); + if (c==-1) { + break; + } + switch (c) { + case 0 : + break; + case 'h': + health_flag = 0; + sscanf (optarg,"%ud" ,&healthcheck_count); + break; + case 'n': + setSanameT (&compName, optarg); + break; + default : + break; + } + } + result = saAmfInitialize (&handle, &amfCallbacks, &version); if (result != SA_OK) { printf ("initialize result is %d\n", result); exit (1); } + printf ("initialize result is %d\n", result); FD_ZERO (&read_fds); saAmfSelectionObjectGet (&handle, &select_fd); FD_SET (select_fd, &read_fds); - setSanameT (&compName, "comp_b_in_su_z"); + if (compName.length <= 0){ + setSanameT (&compName, "comp_b_in_su_z"); + } result = saAmfComponentRegister (&handle, &compName, NULL); printf ("register result is %d (should be 1)\n", result);