Browse Source

Add signal handler so code coverage records coverage

(Logical change 1.67)


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@244 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 21 years ago
parent
commit
3241af44d0
7 changed files with 56 additions and 0 deletions
  1. 8 0
      test/testamf1.c
  2. 8 0
      test/testamf2.c
  3. 8 0
      test/testamf3.c
  4. 9 0
      test/testamf4.c
  5. 7 0
      test/testamf5.c
  6. 8 0
      test/testamf6.c
  7. 8 0
      test/testclm.c

+ 8 - 0
test/testamf1.c

@@ -35,6 +35,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <signal.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
@@ -238,6 +240,11 @@ static struct sched_param sched_param = {
     sched_priority: 99
 };
 
+void sigintr_handler (int signum) {
+	exit (0);
+}
+
+
 int main (void) {
 	SaAmfHandleT handle;
 	int result;
@@ -245,6 +252,7 @@ int main (void) {
 	fd_set read_fds;
 	SaNameT compName;
 
+	signal (SIGINT, sigintr_handler);
    result = sched_setscheduler (0, SCHED_RR, &sched_param);
     if (result == -1) {
 printf ("couldn't set sched priority\n");

+ 8 - 0
test/testamf2.c

@@ -36,6 +36,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <unistd.h>
+#include <signal.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
@@ -235,6 +236,11 @@ SaAmfCallbacksT amfCallbacks = {
 
 SaVersionT version = { 'A', 1, 1 };
 
+void sigintr_handler (int signum) {
+	exit (0);
+}
+
+
 int main (void) {
 	SaAmfHandleT handle;
 	int result;
@@ -244,6 +250,8 @@ int main (void) {
 	int i;
 	SaAmfErrorDescriptorT errorDescriptor;
 
+	signal (SIGINT, sigintr_handler);
+
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
 	if (result != SA_OK) {
 		printf ("initialize result is %d\n", result);

+ 8 - 0
test/testamf3.c

@@ -35,6 +35,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <signal.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
@@ -233,6 +235,11 @@ SaAmfCallbacksT amfCallbacks = {
 
 SaVersionT version = { 'A', 1, 1 };
 
+void sigintr_handler (int signum) {
+	exit (0);
+}
+
+
 int main (void) {
 	SaAmfHandleT handle;
 	int result;
@@ -240,6 +247,7 @@ int main (void) {
 	fd_set read_fds;
 	SaNameT compName;
 
+	signal (SIGINT, sigintr_handler);
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
 	if (result != SA_OK) {
 		printf ("initialize result is %d\n", result);

+ 9 - 0
test/testamf4.c

@@ -35,6 +35,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <signal.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
@@ -232,6 +234,11 @@ SaAmfCallbacksT amfCallbacks = {
 
 SaVersionT version = { 'A', 1, 1 };
 
+void sigintr_handler (int signum) {
+	exit (0);
+}
+
+
 int main (void) {
 	SaAmfHandleT handle;
 	int result;
@@ -239,6 +246,8 @@ int main (void) {
 	fd_set read_fds;
 	SaNameT compName;
 
+	signal (SIGINT, sigintr_handler);
+
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
 	if (result != SA_OK) {
 		printf ("initialize result is %d\n", result);

+ 7 - 0
test/testamf5.c

@@ -35,6 +35,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <signal.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
@@ -233,6 +235,10 @@ SaAmfCallbacksT amfCallbacks = {
 
 SaVersionT version = { 'A', 1, 1 };
 
+void sigintr_handler (int signum) {
+	exit (0);
+}
+
 int main (void) {
 	SaAmfHandleT handle;
 	int result;
@@ -240,6 +246,7 @@ int main (void) {
 	fd_set read_fds;
 	SaNameT compName;
 
+	signal (SIGINT, sigintr_handler);
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
 	if (result != SA_OK) {
 		printf ("initialize result is %d\n", result);

+ 8 - 0
test/testamf6.c

@@ -35,6 +35,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <signal.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/un.h>
@@ -234,6 +236,10 @@ SaAmfCallbacksT amfCallbacks = {
 
 SaVersionT version = { 'A', 1, 1 };
 
+void sigintr_handler (int signum) {
+        exit (0);
+}
+
 int main (void) {
 	SaAmfHandleT handle;
 	int result;
@@ -241,6 +247,8 @@ int main (void) {
 	fd_set read_fds;
 	SaNameT compName;
 
+	signal (SIGINT, sigintr_handler);
+
 	result = saAmfInitialize (&handle, &amfCallbacks, &version);
 	if (result != SA_OK) {
 		printf ("initialize result is %d\n", result);

+ 8 - 0
test/testclm.c

@@ -35,6 +35,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <signal.h>
+#include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/select.h>
@@ -133,6 +135,10 @@ SaClmCallbacksT callbacks = {
 
 SaVersionT version = { 'A', 1, 1 };
 
+void sigintr_handler (int signum) {
+	exit (0);
+}
+
 int main (void) {
 	SaClmHandleT handle;
 	fd_set read_fds;
@@ -140,6 +146,8 @@ int main (void) {
 	int result;
 	SaClmClusterNotificationT clusterNotificationBuffer[64];
 
+	signal (SIGINT, sigintr_handler);
+
 	result = saClmInitialize (&handle, &callbacks, &version);
 	if (result != SA_OK) {
 		printf ("Could not initialize Cluster Membership API instance error %d\n", result);