Skip to contentSkip to conversation

test library cleanups

PATCH New Cyril Hrubis 1 participant 1 message Jun 1, 2009 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test library cleanups

Hi,

This patch does:
================

Removing no longer used code from test.h eg. test_error.c is no longer in ltp, and the same for t_res.c so there is no need to include function prototypes for these.

Adding void to functions that doesn't take any parameters; tst_exit() -> tst_exit(void); so code that pases parameters to these is not compileable any more.

Also fixes all test broken by that change. As parameters passed to tst_exit() are ignored anyway it's quite safe to just remove them; but I'would rather see someone take a closer look.

Code cleanups and fixes in tst_res.c:

* removed trivial and useless comments
* cleaned coding style
* and much more

TODO: there is much redundant code in tst_res.c I'll eliminate that by static functions

Signed-off-by [email protected]
Signature · 2 lines
Cyril Hrubis
[email protected]
include/compiler.h +3 -3
Index: ltp-full-20090430/include/compiler.h
===================================================================
@@ -7,10 +7,10 @@
 #ifndef __LTP_COMPILER_H__
 #define __LTP_COMPILER_H__
 
-#define attribute_noreturn __attribute__((noreturn))
+#define LTP_ATTRIBUTE_NORETURN __attribute__((noreturn))
 
 #ifndef ARRAY_SIZE
-# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
+	#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
 #endif
 
-#endif
+#endif /* __LTP_COMPILER_H__ */
include/test.h +58 -74

156 lines not on this page · raw message

lib/tst_res.c +530 -617

1,319 lines not on this page · raw message

lib/get_high_address.c +1 -2
Index: ltp-full-20090430/lib/get_high_address.c
===================================================================
@@ -34,8 +34,7 @@
 
 #include <unistd.h> 
 
-char *
-get_high_address()
+char *get_high_address(void)
 {
        return (char *)sbrk(0) + (4 * getpagesize());
 }
lib/tst_is_cwd_nfs.c +5 -6
Index: ltp-full-20090430/lib/tst_is_cwd_nfs.c
===================================================================
@@ -31,12 +31,11 @@
 
 #define NFS_MAGIC 0x6969 /* man 2 statfs */
 
-int
-tst_is_cwd_nfs()
+int tst_is_cwd_nfs(void)
 {
-       struct statfs sf;
-       statfs(".", &sf);
+	struct statfs sf;
+	statfs(".", &sf);
 
-       /* Verify that the file is not on a nfs filesystem */
-       return sf.f_type == NFS_MAGIC?1:0;
+	/* Verify that the file is not on a nfs filesystem */
+	return sf.f_type == NFS_MAGIC?1:0;
 }
lib/tst_is_cwd_tmpfs.c +1 -2
Index: ltp-full-20090430/lib/tst_is_cwd_tmpfs.c
===================================================================
@@ -14,8 +14,7 @@
 
 #define TMPFS_MAGIC 0x01021994 /* man 2 statfs */
 
-int 
-tst_is_cwd_tmpfs() 
+int tst_is_cwd_tmpfs(void)
 {
 	struct statfs sf;
 	statfs(".", &sf);
lib/tst_tmpdir.c +2 -4
Index: ltp-full-20090430/lib/tst_tmpdir.c
===================================================================
@@ -116,8 +116,7 @@ extern char *TESTDIR;         /* the dir
 #undef   FN_NAME
 #define  FN_NAME  "tst_tmpdir()"
 
-void
-tst_tmpdir()
+void tst_tmpdir(void)
 {
  	char template[PATH_MAX];      /* template for mkstemp, mkdtemp */
   	int  no_cleanup = 0;          /* !0 means TDIRECTORY env var was set */
@@ -268,8 +267,7 @@ tst_tmpdir()
 #undef   FN_NAME
 #define  FN_NAME  "tst_rmdir()"
 
-void
-tst_rmdir()
+void tst_rmdir(void)
 {
    char *errmsg;
    char *tdirectory;
testcases/kernel/containers/mqns/mqns_01.c +4 -12
Index: ltp-full-20090430/testcases/kernel/containers/mqns/mqns_01.c
===================================================================
@@ -59,10 +59,8 @@ int check_mqueue(void *vtest)
 		write(p2[1], "exists", 7);
 		mq_close(mqd);
 	}
-	tst_exit(0);
 
-	/* NOT REACHED */
-	return 0;
+	tst_exit();
 }
 
 int main(int argc, char *argv[])
@@ -85,7 +83,7 @@ int main(int argc, char *argv[])
 	if (mqd == -1) {
 		perror("mq_open");
 		tst_resm(TFAIL, "mq_open failed\n");
-		tst_exit(3);
+		tst_exit();
 	}
 
 	tst_resm(TINFO, "Checking namespaces isolation from parent to child\n");
@@ -95,7 +93,7 @@ int main(int argc, char *argv[])
 		tst_resm(TFAIL, "failed clone/unshare\n");
 		mq_close(mqd);
 		mq_unlink(SLASH_MQ1);
-		tst_exit(1);
+		tst_exit();
 	}
 
 	close(p1[0]);
@@ -104,21 +102,15 @@ int main(int argc, char *argv[])
 	read(p2[0], buf, 7);
 	if (!strcmp(buf, "exists")) {
 		tst_resm(TFAIL, "child process found mqueue\n");
-		r = TFAIL;
 	} else if (!strcmp(buf, "notfnd")) {
 		tst_resm(TPASS, "child process didn't find mqueue\n");
-		r = TPASS;
 	} else {
 		tst_resm(TFAIL, "UNKNOWN RESULT\n");
-		r = TFAIL;
 	}
 
 	/* destroy the mqueue */
 	mq_close(mqd);
 	mq_unlink(SLASH_MQ1);
 
-	tst_exit(r);
-
-	/* NOT REACHED */
-	return 0;
+	tst_exit();
 }
testcases/kernel/containers/mqns/mqns_02.c +6 -14
Index: ltp-full-20090430/testcases/kernel/containers/mqns/mqns_02.c
===================================================================
@@ -59,7 +59,7 @@ int check_mqueue(void *vtest)
 	mqd = mq_open(SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0777, NULL);
 	if (mqd == -1) {
 		write(p2[1], "mqfail", 7);
-		tst_exit(3);
+		tst_exit();
 	}
 
 	write(p2[1], "mqopen", 7);
@@ -72,10 +72,7 @@ int check_mqueue(void *vtest)
 
 	write(p2[1], "done", 5);
 
-	tst_exit(0);
-
-	/* NOT REACHED */
-	return 0;
+	tst_exit();
 }
 
 
@@ -99,7 +96,7 @@ int main(int argc, char *argv[])
 	r = do_clone_unshare_test(use_clone, CLONE_NEWIPC, check_mqueue, NULL);
 	if (r < 0) {
 		tst_resm(TFAIL, "failed clone/unshare\n");
-		tst_exit(1);
+		tst_exit();
 	}
 
 	tst_resm(TINFO, "Checking namespaces isolation (child to parent)\n");
@@ -112,19 +109,17 @@ int main(int argc, char *argv[])
 	if (!strcmp(buf, "mqfail")) {
 		tst_resm(TFAIL, "child process could not create mqueue\n");
 		umount(DEV_MQUEUE);
-		tst_exit(TFAIL);
+		tst_exit();
 	} else if (strcmp(buf, "mqopen")) {
 		tst_resm(TFAIL, "child process could not create mqueue\n");
 		umount(DEV_MQUEUE);
-		tst_exit(TFAIL);
+		tst_exit();
 	}
 
 	mqd = mq_open(SLASH_MQ1, O_RDONLY);
 	if (mqd == -1) {
-		r = TPASS;
 		tst_resm(TPASS, "Father process doesn't see mqueue\n");
 	} else {
-		r = TFAIL;
 		tst_resm(TFAIL, "Father process found mqueue\n");
 		mq_close(mqd);
 	}
@@ -132,8 +127,5 @@ int main(int argc, char *argv[])
 	write(p1[1], "cont", 5);
 	read(p2[0], buf, 7);
 
-	tst_exit(r);
-
-	/* NOT REACHED */
-	return 0;
+	tst_exit();
 }
testcases/kernel/containers/mqns/mqns_03.c +11 -17
Index: ltp-full-20090430/testcases/kernel/containers/mqns/mqns_03.c
===================================================================
@@ -64,7 +64,7 @@ int check_mqueue(void *vtest)
 	mqd = mq_open(SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0755, NULL);
 	if (mqd == -1) {
 		write(p2[1], "mqfail", 7);
-		tst_exit(3);
+		tst_exit();
 	}
 
 	mq_close(mqd);
@@ -73,19 +73,19 @@ int check_mqueue(void *vtest)
 	if (rc == -1) {
 		perror("mount");
 		write(p2[1], "mount1", 7);
-		tst_exit(3);
+		tst_exit();
 	}
 
 	rc = stat(FNAM1, &statbuf);
 	if (rc == -1) {
 		write(p2[1], "stat1", 6);
-		tst_exit(3);
+		tst_exit();
 	}
 
 	rc = creat(FNAM2, 0755);
 	if (rc == -1) {
 		write(p2[1], "creat", 6);
-		tst_exit(3);
+		tst_exit();
 	}
 
 	close(rc);
@@ -94,33 +94,30 @@ int check_mqueue(void *vtest)
 	if (rc == -1) {
 		perror("umount");
 		write(p2[1], "umount", 7);
-		tst_exit(3);
+		tst_exit();
 	}
 
 	rc = mount("mqueue", DEV_MQUEUE2, "mqueue", 0, NULL);
 	if (rc == -1) {
 		write(p2[1], "mount2", 7);
-		tst_exit(3);
+		tst_exit();
 	}
 
 	rc = stat(FNAM1, &statbuf);
 	if (rc == -1) {
 		write(p2[1], "stat2", 7);
-		tst_exit(3);
+		tst_exit();
 	}
 
 	rc = stat(FNAM2, &statbuf);
 	if (rc == -1) {
 		write(p2[1], "stat3", 7);
-		tst_exit(3);
+		tst_exit();
 	}
 
 	write(p2[1], "done", 5);
 
-	tst_exit(0);
-
-	/* NOT REACHED */
-	return 0;
+	tst_exit();
 }
 
 
@@ -143,7 +140,7 @@ int main(int argc, char *argv[])
 	r = do_clone_unshare_test(use_clone, CLONE_NEWIPC, check_mqueue, NULL);
 	if (r < 0) {
 		tst_resm(TFAIL, "failed clone/unshare\n");
-		tst_exit(1);
+		tst_exit();
 	}
 
 	tst_resm(TINFO, "Checking correct umount+remount of mqueuefs\n");
@@ -189,8 +186,5 @@ int main(int argc, char *argv[])
 fail:
 	umount(DEV_MQUEUE2);
 	rmdir(DEV_MQUEUE2);
-	tst_exit(r);
-
-	/* NOT REACHED */
-	return 0;
+	tst_exit();
 }
testcases/kernel/containers/mqns/mqns_04.c +4 -10
Index: ltp-full-20090430/testcases/kernel/containers/mqns/mqns_04.c
===================================================================
@@ -60,7 +60,7 @@ int check_mqueue(void *vtest)
 	mqd = mq_open(SLASH_MQ1, O_RDWR|O_CREAT|O_EXCL, 0755, NULL);
 	if (mqd == -1) {
 		write(p2[1], "mqfail", 7);
-		tst_exit(3);
+		tst_exit();
 	}
 
 	mq_close(mqd);
@@ -69,22 +69,18 @@ int check_mqueue(void *vtest)
 	if (rc == -1) {
 		perror("mount");
 		write(p2[1], "mount", 6);
-		tst_exit(3);
+		tst_exit();
 	}
 
 	write(p2[1], "go", 3);
 	read(p1[0], buf, 3);
 
-	tst_exit(0);
-
-	/* NOT REACHED */
-	return 0;
+	tst_exit();
 }
 
 
 int main(int argc, char *argv[])
 {
-	int r = TFAIL;
 	int rc;
 	int status;
 	char buf[30];
@@ -157,12 +153,10 @@ int main(int argc, char *argv[])
 
 	tst_resm(TPASS, "Child mqueue fs still visible for parent\n");
 
-	r = 0;
-
 fail:
 	umount(DEV_MQUEUE2);
 	rmdir(DEV_MQUEUE2);
-	tst_exit(r);
+	tst_exit();
 
 	/* NOT REACHED */
 	return 0;
testcases/kernel/containers/pidns/pidns30.c +1 -2
Index: ltp-full-20090430/testcases/kernel/containers/pidns/pidns30.c
===================================================================
@@ -145,8 +145,7 @@ static void cleanup(int result, int step
 	/* Clean the test testcase as LTP wants*/
 	TEST_CLEANUP;
 
-	/* exit with return code appropriate for results */
-	tst_exit(result);
+	tst_exit();
 }
 
 /*
testcases/kernel/containers/pidns/pidns31.c +1 -1
Index: ltp-full-20090430/testcases/kernel/containers/pidns/pidns31.c
===================================================================
@@ -143,7 +143,7 @@ static void cleanup(int result, int step
 	TEST_CLEANUP;
 
 	/* exit with return code appropriate for results */
-	tst_exit(result);
+	tst_exit();
 }
 
 /*
testcases/kernel/containers/sysvipc/shmnstest.c +5 -10
Index: ltp-full-20090430/testcases/kernel/containers/sysvipc/shmnstest.c
===================================================================
@@ -57,10 +57,8 @@ int check_shmid(void *vtest)
               write(p2[1], "exists", 7);
               shmctl(id, IPC_RMID, NULL);
       }
-      tst_exit(0);
 
-      /* NOT REACHED */
-      return 0;
+      tst_exit();
 }
 
 #define UNSHARESTR "unshare"
@@ -76,7 +74,7 @@ int main(int argc, char *argv[])
       if (argc != 2) {
               tst_resm(TFAIL, "Usage: %s <clone|unshare|none>\n", argv[0]);
               tst_resm(TFAIL, " where clone, unshare, or fork specifies unshare method.");
-              tst_exit(2);
+              tst_exit();
       }
       if (pipe(p1) == -1) { perror("pipe"); exit(EXIT_FAILURE); }
       if (pipe(p2) == -1) { perror("pipe"); exit(EXIT_FAILURE); }
@@ -94,7 +92,7 @@ int main(int argc, char *argv[])
       if (id == -1) {
               perror("shmget");
               tst_resm(TFAIL, "shmget failed\n");
-              tst_exit(3);
+              tst_exit();
       }
 
       tst_resm(TINFO, "shmid namespaces test : %s\n",tsttype);
@@ -102,7 +100,7 @@ int main(int argc, char *argv[])
       r = do_clone_unshare_test(use_clone, CLONE_NEWIPC, check_shmid, NULL);
       if (r < 0) {
               tst_resm(TFAIL, "%s failed\n", tsttype);
-              tst_exit(1);
+              tst_exit();
       }
 
       close(p1[0]);
@@ -126,8 +124,5 @@ int main(int argc, char *argv[])
       /* destroy the key */
       shmctl(id, IPC_RMID, NULL);
 
-      tst_exit(0);
-
-      /* NOT REACHED */
-      return 0;
+      tst_exit();
 }
testcases/kernel/mem/mmapstress/mmapstress01.c +2 -2
Index: ltp-full-20090430/testcases/kernel/mem/mmapstress/mmapstress01.c
===================================================================
@@ -166,7 +166,7 @@ main(int argc, char *argv[])
 	tst_tmpdir();
 	if (argc < 2) {
 		tst_resm(TBROK, "usage: %s %s\n", progname, usage);
-                tst_exit(0);
+                tst_exit();
 	}
 
 	while ((c = getopt(argc, argv, "S:omdlrf:p:t:")) != -1) {
@@ -218,7 +218,7 @@ main(int argc, char *argv[])
 			break;
 		default:
 			(void)fprintf(stderr,"usage: %s %s\n", progname, usage);
-                        tst_exit(0);
+                        tst_exit();
 		}
 	}
 
testcases/kernel/security/cap_bound/cap_bounds_r.c +4 -4
Index: ltp-full-20090430/testcases/kernel/security/cap_bound/cap_bounds_r.c
===================================================================
@@ -60,13 +60,13 @@ int main(int argc, char *argv[])
 			tst_resm(TFAIL, "prctl(CAP_BSET_READ, %d) returned %d\n", i, ret);
 			if (ret == -1)
 				tst_resm(TINFO, "errno was %d\n", errno);
-			tst_exit(1);
+			tst_exit();
 		}
 	}
 	ret = prctl(CAP_BSET_READ, -1);
 	if (ret != -1) {
 		tst_resm(TFAIL, "prctl(CAP_BSET_READ, -1) returned %d\n", -1, ret);
-		tst_exit(1);
+		tst_exit();
 	}
 
 	/* Ideally I'd check CAP_LAST_CAP+1, but userspace
@@ -79,8 +79,8 @@ int main(int argc, char *argv[])
 	if (ret != -1) {
 		tst_resm(TFAIL, "prctl(CAP_BSET_READ, %d) returned %d\n", CAP_LAST_CAP+1, ret);
 		tst_resm(TINFO, " %d is CAP_LAST_CAP+1 and should not exist\n", CAP_LAST_CAP+1);
-		tst_exit(1);
+		tst_exit();
 	}
 	tst_resm(TPASS, "CAP_BSET_READ tests passed\n");
-	tst_exit(0);
+	tst_exit();
 }
testcases/kernel/security/cap_bound/cap_bounds_rw.c +8 -8
Index: ltp-full-20090430/testcases/kernel/security/cap_bound/cap_bounds_rw.c
===================================================================
@@ -57,7 +57,7 @@ int check_remaining_caps(int lastdropped
 		ret = prctl(CAP_BSET_READ, i);
 		if (ret == -1) {
 			tst_resm(TBROK, "Failed to read bounding set during sanity check\n");
-			tst_exit(1);
+			tst_exit();
 		}
 		if (ret == 1) {
 			tst_resm(TFAIL, "Bit %d should have been dropped but wasn't\n", i);
@@ -68,7 +68,7 @@ int check_remaining_caps(int lastdropped
 		ret = prctl(CAP_BSET_READ, i);
 		if (ret == -1) {
 			tst_resm(TBROK, "Failed to read bounding set during sanity check\n");
-			tst_exit(1);
+			tst_exit();
 		}
 		if (ret == 0) {
 			tst_resm(TFAIL, "Bit %d wasn't yet dropped, but isn't in bounding set\n", i);
@@ -86,7 +86,7 @@ int main(int argc, char *argv[])
 	ret = prctl(CAP_BSET_DROP, -1);
 	if (ret != -1) {
 		tst_resm(TFAIL, "prctl(CAP_BSET_DROP, -1) returned %d\n", ret);
-		tst_exit(1);
+		tst_exit();
 	}
 	/* Ideally I'd check CAP_LAST_CAP+1, but userspace
 	 * tends to be far too unreliable to trust CAP_LAST_CAP>
@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
 	if (ret != -1) {
 		tst_resm(TFAIL, "prctl(CAP_BSET_DROP, %d) returned %d\n", max(INSANE, CAP_LAST_CAP+1), ret);
 		tst_resm(TINFO, " %d is should not exist\n", max(INSANE, CAP_LAST_CAP+1));
-		tst_exit(1);
+		tst_exit();
 	}
 	for (i=0; i<=CAP_LAST_CAP; i++) {
 		ret = prctl(CAP_BSET_DROP, i);
@@ -106,19 +106,19 @@ int main(int argc, char *argv[])
 			tst_resm(TFAIL, "prctl(CAP_BSET_DROP, %d) returned %d\n", i, ret);
 			if (ret == -1)
 				tst_resm(TINFO, "errno was %d\n", errno);
-			tst_exit(1);
+			tst_exit();
 		}
 		ret = check_remaining_caps(i);
 		if (ret > 0) {
 			tst_resm(TFAIL, "after dropping bits 0..%d, %d was still in bounding set\n",
 				i, ret);
-			tst_exit(1);
+			tst_exit();
 		} else if (ret < 0) {
 			tst_resm(TFAIL, "after dropping bits 0..%d, %d was not in bounding set\n",
 				i, -ret);
-			tst_exit(1);
+			tst_exit();
 		}
 	}
 	tst_resm(TPASS, "CAP_BSET_DROP tests passed\n");
-	tst_exit(0);
+	tst_exit();
 }
testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c +10 -10
Index: ltp-full-20090430/testcases/kernel/security/cap_bound/cap_bset_inh_bounds.c
===================================================================
@@ -63,27 +63,27 @@ int main(int argc, char *argv[])
 	ret = prctl(CAP_BSET_READ, CAP_SYS_ADMIN);
 	if (ret != 1) {
 		tst_resm(TBROK, "Not starting with CAP_SYS_ADMIN\n");
-		tst_exit(1);
+		tst_exit();
 	}
 
 	/* Make sure it's in pI */
 	cur = cap_from_text("all=eip");
 	if (!cur) {
 		tst_resm(TBROK, "Failed to create cap_sys_admin+i cap_t (errno %d)\n", errno);
-		tst_exit(1);
+		tst_exit();
 	}
 	ret = cap_set_proc(cur);
 	if (ret) {
 		tst_resm(TBROK, "Failed to cap_set_proc with cap_sys_admin+i (ret %d errno %d)\n",
 			ret, errno);
-		tst_exit(1);
+		tst_exit();
 	}
 	cap_free(cur);
 	cur = cap_get_proc();
 	ret = cap_get_flag(cur, CAP_SYS_ADMIN, CAP_INHERITABLE, &f);
 	if (ret || f != CAP_SET) {
 		tst_resm(TBROK, "Failed to add CAP_SYS_ADMIN to pI\n");
-		tst_exit(1);
+		tst_exit();
 	}
 	cap_free(cur);
 
@@ -92,7 +92,7 @@ int main(int argc, char *argv[])
 	if (ret) {
 		tst_resm(TFAIL, "Failed to drop CAP_SYS_ADMIN from bounding set.\n");
 		tst_resm(TINFO, "(ret=%d, errno %d)\n", ret, errno);
-		tst_exit(1);
+		tst_exit();
 	}
 
 	/* test 1: is CAP_SYS_ADMIN still in pI? */
@@ -100,7 +100,7 @@ int main(int argc, char *argv[])
 	ret = cap_get_flag(cur, CAP_SYS_ADMIN, CAP_INHERITABLE, &f);
 	if (ret || f != CAP_SET) {
 		tst_resm(TFAIL, "CAP_SYS_ADMIN not in pI after dropping from bounding set\n");
-		tst_exit(1);
+		tst_exit();
 	}
 	tst_resm(TPASS, "CAP_SYS_ADMIN remains in pI after removing from bounding set\n");
 
@@ -109,12 +109,12 @@ int main(int argc, char *argv[])
 	ret = cap_set_flag(tmpcap, CAP_INHERITABLE, 1, v, CAP_CLEAR);
 	if (ret) {
 		tst_resm(TFAIL, "Failed to drop CAP_SYS_ADMIN from cap_t\n");
-		tst_exit(1);
+		tst_exit();
 	}
 	ret = cap_set_proc(tmpcap);
 	if (ret) {
 		tst_resm(TFAIL, "Failed to drop CAP_SYS_ADMIN from pI\n");
-		tst_exit(1);
+		tst_exit();
 	}
 	cap_free(tmpcap);
 
@@ -122,10 +122,10 @@ int main(int argc, char *argv[])
 	ret = cap_set_proc(cur);
 	if (ret == 0) { /* success means pI was not bounded by X */
 		tst_resm(TFAIL, "Managed to put CAP_SYS_ADMIN back into pI though not in X\n");
-		tst_exit(1);
+		tst_exit();
 	}
 	cap_free(cur);
 
 	tst_resm(TPASS, "Couldn't put CAP_SYS_ADMIN back into pI when not in bounding set\n");
-	tst_exit(0);
+	tst_exit();
 }
testcases/kernel/security/cap_bound/check_pe.c +7 -7
Index: ltp-full-20090430/testcases/kernel/security/cap_bound/check_pe.c
===================================================================
@@ -46,35 +46,35 @@ int main(int argc, char *argv[])
 
 	if (argc != 2) {
 		tst_resm(TBROK, "Usage: check_pe [0|1]\n");
-		tst_exit(1);
+		tst_exit();
 	}
 	n = atoi(argv[1]);
 	if (n != 0 && n != 1) {
 		tst_resm(TBROK, "Usage: check_pe [0|1]\n");
-		tst_exit(1);
+		tst_exit();
 	}
 
 	cur = cap_get_proc();
 	ret = cap_get_flag(cur, CAP_SYS_ADMIN, CAP_EFFECTIVE, &f);
 	if (ret) {
 		tst_resm(TBROK, "cap_get_flag failed (errno %d)\n", errno);
-		tst_exit(1);
+		tst_exit();
 	}
 	
 	cap_free(cur);
 	if (n == 1) {
 		if (f == CAP_SET) {
 			tst_resm(TPASS, "cap is in pE\n");
-			tst_exit(0);
+			tst_exit();
 		}
 		tst_resm(TFAIL, "Cap is not in pE\n");
-		tst_exit(1);
+		tst_exit();
 	}
 	if (f == CAP_CLEAR) {
 		tst_resm(TPASS, "cap is not in pE\n");
-		tst_exit(0);
+		tst_exit();
 	}
 	tst_resm(TFAIL, "Cap is in pE\n");
-	tst_exit(1);
+	tst_exit();
 
 }
testcases/kernel/security/cap_bound/exec_with_inh.c +5 -5
Index: ltp-full-20090430/testcases/kernel/security/cap_bound/exec_with_inh.c
===================================================================
@@ -61,20 +61,20 @@ int main(int argc, char *argv[])
 	cur = cap_from_text("all=eip");
 	if (!cur) {
 		tst_resm(TBROK, "Failed to create cap_sys_admin+i cap_t (errno %d)\n", errno);
-		tst_exit(1);
+		tst_exit();
 	}
 	ret = cap_set_proc(cur);
 	if (ret) {
 		tst_resm(TBROK, "Failed to cap_set_proc with cap_sys_admin+i (ret %d errno %d)\n",
 			ret, errno);
-		tst_exit(1);
+		tst_exit();
 	}
 	cap_free(cur);
 	cur = cap_get_proc();
 	ret = cap_get_flag(cur, CAP_SYS_ADMIN, CAP_INHERITABLE, &f);
 	if (ret || f != CAP_SET) {
 		tst_resm(TBROK, "Failed to add CAP_SYS_ADMIN to pI\n");
-		tst_exit(1);
+		tst_exit();
 	}
 	cap_free(cur);
 
@@ -83,11 +83,11 @@ int main(int argc, char *argv[])
 	if (ret) {
 		tst_resm(TFAIL, "Failed to drop CAP_SYS_ADMIN from bounding set.\n");
 		tst_resm(TINFO, "(ret=%d, errno %d)\n", ret, errno);
-		tst_exit(1);
+		tst_exit();
 	}
 
 	/* execute "check_pe 1" */
 	execl("check_pe", "check_pe", "1", NULL);
 	tst_resm(TBROK, "Failed to execute check_pe (errno %d)\n", errno);
-	tst_exit(1);
+	tst_exit();
 }
testcases/kernel/security/cap_bound/exec_without_inh.c +3 -3
Index: ltp-full-20090430/testcases/kernel/security/cap_bound/exec_without_inh.c
===================================================================
@@ -68,7 +68,7 @@ int main(int argc, char *argv[])
 			ret = cap_set_proc(cur);
 		if (ret) {
 			tst_resm(TBROK, "Failed to drop cap_sys_admin from pI\n");
-			tst_exit(1);
+			tst_exit();
 		}
 	}
 	cap_free(cur);
@@ -78,11 +78,11 @@ int main(int argc, char *argv[])
 	if (ret) {
 		tst_resm(TFAIL, "Failed to drop CAP_SYS_ADMIN from bounding set.\n");
 		tst_resm(TINFO, "(ret=%d, errno %d)\n", ret, errno);
-		tst_exit(1);
+		tst_exit();
 	}
 
 	/* execute "check_pe 0" */
 	execl("check_pe", "check_pe", "0", NULL);
 	tst_resm(TBROK, "Failed to execute check_pe (errno %d)\n", errno);
-	tst_exit(1);
+	tst_exit();
 }
testcases/kernel/syscalls/madvise/madvise03.c +2 -2
Index: ltp-full-20090430/testcases/kernel/syscalls/madvise/madvise03.c
===================================================================
@@ -137,13 +137,13 @@ int main(int argc, char *argv[])
 #define MADV_DOFORK     11
 		tst_resm(TCONF, "This test can only run on kernels that are ");
 		tst_resm(TCONF, "2.6.16 and higher");
-		tst_exit(0);
+		tst_exit();
 	}
 
 	if ((msg =
 	     parse_opts(argc, argv, (option_t *) NULL, NULL)) != (char *)NULL) {
 		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
-		tst_exit(0);
+		tst_exit();
 	}
 
 	/**************************************************
testcases/kernel/syscalls/sbrk/sbrk01.c +1 -1
Index: ltp-full-20090430/testcases/kernel/syscalls/sbrk/sbrk01.c
===================================================================
@@ -140,7 +140,7 @@ int main(int ac, char **av)
      ***************************************************************/
 	if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *)NULL) {
 		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
-		tst_exit(0);
+		tst_exit();
 	}
 
     /***************************************************************
testcases/kernel/syscalls/setpgrp/setpgrp01.c +1 -1
Index: ltp-full-20090430/testcases/kernel/syscalls/setpgrp/setpgrp01.c
===================================================================
@@ -135,7 +135,7 @@ int main(int ac, char **av)
      ***************************************************************/
 	if ((msg = parse_opts(ac, av, (option_t *) NULL, NULL)) != (char *)NULL) {
 		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
-		tst_exit(0);
+		tst_exit();
 	}
 
     /***************************************************************

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list