svn commit: r266870 - in user/pho/stress2/testcases: . badcode creat link lockf lockf2 mkdir mkfifo mmap openat rw shm socket swap symlink syscall tcp thr1 thr2

Peter Holm pho at FreeBSD.org
Fri May 30 06:34:34 UTC 2014


Author: pho
Date: Fri May 30 06:34:29 2014
New Revision: 266870
URL: http://svnweb.freebsd.org/changeset/base/266870

Log:
  Added new MK_MAN to Makefile. Fixed whitespace issues.
  
  Sponsored by:	EMC / Isilon storage division

Modified:
  user/pho/stress2/testcases/Makefile.inc
  user/pho/stress2/testcases/badcode/badcode.c
  user/pho/stress2/testcases/creat/creat.c
  user/pho/stress2/testcases/link/link.c
  user/pho/stress2/testcases/lockf/lockf.c
  user/pho/stress2/testcases/lockf2/lockf2.c
  user/pho/stress2/testcases/mkdir/mkdir.c
  user/pho/stress2/testcases/mkfifo/mkfifo.c
  user/pho/stress2/testcases/mmap/mmap.c
  user/pho/stress2/testcases/openat/doat.c
  user/pho/stress2/testcases/openat/openat.c
  user/pho/stress2/testcases/rw/rw.c
  user/pho/stress2/testcases/shm/shm.c
  user/pho/stress2/testcases/socket/socket.c
  user/pho/stress2/testcases/swap/swap.c
  user/pho/stress2/testcases/symlink/symlink.c
  user/pho/stress2/testcases/syscall/syscall.c
  user/pho/stress2/testcases/tcp/tcp.c
  user/pho/stress2/testcases/thr1/thr1.c
  user/pho/stress2/testcases/thr2/thr2.c

Modified: user/pho/stress2/testcases/Makefile.inc
==============================================================================
--- user/pho/stress2/testcases/Makefile.inc	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/Makefile.inc	Fri May 30 06:34:29 2014	(r266870)
@@ -6,3 +6,4 @@ LDADD+= -L../../lib -lstress -lutil
 DPADD+= ../../lib/libstress.a
 CFLAGS =-g -Wall -Wextra -O2 -I../../include -I../include
 NOMAN=	sorry
+MK_MAN=no

Modified: user/pho/stress2/testcases/badcode/badcode.c
==============================================================================
--- user/pho/stress2/testcases/badcode/badcode.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/badcode/badcode.c	Fri May 30 06:34:29 2014	(r266870)
@@ -128,7 +128,7 @@ test(void)
 			if (waitpid(pid, NULL, 0) == -1)
 				warn("waitpid(%d)", pid);
 			alarm(0);
-		} else 
+		} else
 			err(1, "fork(), %s:%d",  __FILE__, __LINE__);
 	}
 

Modified: user/pho/stress2/testcases/creat/creat.c
==============================================================================
--- user/pho/stress2/testcases/creat/creat.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/creat/creat.c	Fri May 30 06:34:29 2014	(r266870)
@@ -51,7 +51,7 @@ setup(int nb)
 	int64_t bl;
 	int64_t reserve_in;
 	int64_t reserve_bl;
-	
+
 
 	umask(0);
 	path[0] = 0;
@@ -134,7 +134,7 @@ test(void)
 		sprintf(file,"p%05d.%05d", pid, i);
 		if (unlink(file) == -1)
 			warn("unlink(%s)", file);
-		
+
 	}
 
 	return (0);

Modified: user/pho/stress2/testcases/link/link.c
==============================================================================
--- user/pho/stress2/testcases/link/link.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/link/link.c	Fri May 30 06:34:29 2014	(r266870)
@@ -142,7 +142,7 @@ test(void)
 		sprintf(file,"p%05d.%05d", pid, i);
 		if (unlink(file) == -1)
 			err(3, "unlink(%s)", file);
-		
+
 	}
 
 	return (0);

Modified: user/pho/stress2/testcases/lockf/lockf.c
==============================================================================
--- user/pho/stress2/testcases/lockf/lockf.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/lockf/lockf.c	Fri May 30 06:34:29 2014	(r266870)
@@ -124,7 +124,7 @@ test(void)
 	int sem = 0;
 
 	sprintf(file, "lockf.0.%d", getpid());
-	if ((fd = open(file,O_CREAT | O_TRUNC | O_RDWR, 0600)) == -1) 
+	if ((fd = open(file,O_CREAT | O_TRUNC | O_RDWR, 0600)) == -1)
 		err(1, "creat(%s)", file);
 	if (write(fd, &sem, sizeof(sem)) != sizeof(sem))
 		err(1, "write");

Modified: user/pho/stress2/testcases/lockf2/lockf2.c
==============================================================================
--- user/pho/stress2/testcases/lockf2/lockf2.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/lockf2/lockf2.c	Fri May 30 06:34:29 2014	(r266870)
@@ -84,7 +84,7 @@ setup(int nb)
 		exit (0);
 
 	sprintf(file, "lockf.%d", getpid());
-	if ((fd = open(file,O_CREAT | O_TRUNC | O_RDWR, 0600)) == -1) 
+	if ((fd = open(file,O_CREAT | O_TRUNC | O_RDWR, 0600)) == -1)
 		err(1, "creat(%s)", file);
 	bzero(buf, sizeof(buf));
 	for (i = 0; i < 1024; i++)
@@ -109,7 +109,7 @@ test(void)
 
 	if ((fd = open(file, O_RDWR, 0600)) == -1)
 		err(1, "open(%s)", file);
-	
+
 	for (i = 0; i < 1024 && done_testing == 0; i++) {
 		pos = random_int(0, 1024 * 1024 - 1);
 		if (lseek(fd, pos, SEEK_SET) == -1)

Modified: user/pho/stress2/testcases/mkdir/mkdir.c
==============================================================================
--- user/pho/stress2/testcases/mkdir/mkdir.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/mkdir/mkdir.c	Fri May 30 06:34:29 2014	(r266870)
@@ -97,7 +97,7 @@ mkDir(char *path, int level) {
 	char newPath[MAXPATHLEN + 1];
 
 	if (mkdir(path, 0770) == -1) {
-		warn("mkdir(%s), %s:%d", path, __FILE__, __LINE__);
+		warn("mkdir(%s), level %d. %s:%d", path, level, __FILE__, __LINE__);
 		size = level;
 	} else
 		chdir(path);

Modified: user/pho/stress2/testcases/mkfifo/mkfifo.c
==============================================================================
--- user/pho/stress2/testcases/mkfifo/mkfifo.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/mkfifo/mkfifo.c	Fri May 30 06:34:29 2014	(r266870)
@@ -179,7 +179,7 @@ test(void)
 		kill(pid, SIGINT);
 		if (waitpid(pid, &status, 0) == -1)
 			warn("waitpid(%d)", pid);
-	} else 
+	} else
 		err(1, "fork(), %s:%d",  __FILE__, __LINE__);
 
 	unlink(path);

Modified: user/pho/stress2/testcases/mmap/mmap.c
==============================================================================
--- user/pho/stress2/testcases/mmap/mmap.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/mmap/mmap.c	Fri May 30 06:34:29 2014	(r266870)
@@ -93,7 +93,7 @@ cleanup(void)
 	if (rmdir(path) == -1) {
 		warn("rmdir(%s), %s:%d", path, __FILE__, __LINE__);
 	}
-	
+
 }
 
 int

Modified: user/pho/stress2/testcases/openat/doat.c
==============================================================================
--- user/pho/stress2/testcases/openat/doat.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/openat/doat.c	Fri May 30 06:34:29 2014	(r266870)
@@ -61,7 +61,7 @@ struct test {
 	int	num_of_cases;
 	char	*name;
 	struct testcase	tests[10];	// no more than 10 tests
-	
+
 };
 
 struct test *tests;
@@ -104,7 +104,7 @@ setup()
 	tests = calloc(NUM_OF_TESTS, sizeof(struct test));
 	if (tests == NULL) {
 		perror("");
-		exit(0);		
+		exit(0);
 	}
 
 	absolute_path = getcwd(NULL, 0);
@@ -191,7 +191,7 @@ setup()
 		perror("symlink");
 		exit(0);
 	}
-	
+
 	// faccessat
 	tests[0].syscall = SYS_faccessat;
 	tests[0].num_of_cases = 6;
@@ -327,17 +327,17 @@ setup()
 	tests[3].tests[2].params[1].cp = relative_file;
 	tests[3].tests[2].params[2].vp = &buf;
 	tests[3].tests[2].params[3].i = 0;
-	tests[3].tests[2].result = 0; 
+	tests[3].tests[2].result = 0;
 	tests[3].tests[2].params[0].i = rel_fd;
 	tests[3].tests[2].params[1].cp = file;
 	tests[3].tests[2].params[2].vp = &buf;
 	tests[3].tests[2].params[3].i = 0;
-	tests[3].tests[3].result = 0; 
+	tests[3].tests[3].result = 0;
 	tests[3].tests[3].params[0].i = AT_FDCWD;
 	tests[3].tests[3].params[1].cp = symlinkf;
 	tests[3].tests[3].params[2].vp = &buf;
 	tests[3].tests[3].params[3].i = AT_SYMLINK_NOFOLLOW;
-	tests[3].tests[4].result = 0; 
+	tests[3].tests[4].result = 0;
 	tests[3].tests[4].params[0].i = notd_fd;
 	tests[3].tests[4].params[1].cp = absolute_file;
 	tests[3].tests[4].params[2].vp = &buf;
@@ -503,17 +503,17 @@ setup()
 	tests[10].tests[0].params[0].i = 106;	// invalid fd
 	tests[10].tests[0].params[1].cp = relative_file;
 	tests[10].tests[0].params[2].vp = cbuf;
-	tests[10].tests[0].params[3].i = PATH_MAX; 
+	tests[10].tests[0].params[3].i = PATH_MAX;
 	tests[10].tests[1].result = ENOTDIR;
 	tests[10].tests[1].params[0].i = notd_fd;
 	tests[10].tests[1].params[1].cp = relative_file;
 	tests[10].tests[1].params[2].vp = cbuf;
-	tests[10].tests[1].params[3].i = PATH_MAX; 
+	tests[10].tests[1].params[3].i = PATH_MAX;
 	tests[10].tests[2].result = strlen(absolute_file);
 	tests[10].tests[2].params[0].i = AT_FDCWD;
 	tests[10].tests[2].params[1].cp = symlinkf;
 	tests[10].tests[2].params[2].vp = cbuf;
-	tests[10].tests[2].params[3].i = PATH_MAX; 
+	tests[10].tests[2].params[3].i = PATH_MAX;
 
 	// renameat
 	tests[11].syscall = SYS_renameat;
@@ -544,7 +544,6 @@ setup()
 	tests[11].tests[4].params[1].cp = newfile;
 	tests[11].tests[4].params[2].i = AT_FDCWD;
 	tests[11].tests[4].params[3].cp = newfile;
-	
 	// symlinkat
 	tests[12].syscall = SYS_symlinkat;
 	tests[12].num_of_cases = 3;
@@ -629,7 +628,7 @@ cleanup()
 		}
 	}
 	if (!dir_exist) {
-   		error = rmdir(absolute_path);
+		error = rmdir(absolute_path);
 		if (error) {
 			perror("rmdir");
 			exit(0);
@@ -658,7 +657,7 @@ main(int argc, char *argv[])
 	setup();
 
 	for (i = 0; i < NUM_OF_TESTS; i++) {
-	   	printf("\nTest: %s\n", tests[i].name);
+		printf("\nTest: %s\n", tests[i].name);
 		for (j = 0; j < tests[i].num_of_cases; j++) {
 			error = syscall(tests[i].syscall,
 				tests[i].tests[j].params[0],
@@ -668,19 +667,19 @@ main(int argc, char *argv[])
 				tests[i].tests[j].params[4]);
 			if (error == 0) {
 				if (tests[i].tests[j].result == 0)
-   					printf("#%i ... OK\n", j);
+					printf("#%i ... OK\n", j);
 				else {
 					printf("#%i ... BAD: ", j);
 					printf("expected %i, but got %i\n", tests[i].tests[j].result, error);
 				}
-			} else 	{
+			} else	{
 				if (tests[i].tests[j].result == errno)
 					printf("#%i ... OK\n", j);
 				else {
-				   	if (error != tests[i].tests[j].result) {
+					if (error != tests[i].tests[j].result) {
 						printf("#%i ... BAD: ", j);
 						printf("expected %i, but got %i\n", tests[i].tests[j].result, error);
-					} else 
+					} else
 						printf("#%i ... OK\n", j);
 				}
 			}

Modified: user/pho/stress2/testcases/openat/openat.c
==============================================================================
--- user/pho/stress2/testcases/openat/openat.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/openat/openat.c	Fri May 30 06:34:29 2014	(r266870)
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
 #include "stress.h"
 
 static char path1[128];
-static char path2[] = "tmp";		
+static char path2[] = "tmp";
 
 static char rpath[128];
 static char apath[128];

Modified: user/pho/stress2/testcases/rw/rw.c
==============================================================================
--- user/pho/stress2/testcases/rw/rw.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/rw/rw.c	Fri May 30 06:34:29 2014	(r266870)
@@ -134,7 +134,7 @@ test(void)
 	char file[128];
 
 	sprintf(file,"p%05d", getpid());
-	if ((fd = creat(file, 0660)) == -1) 
+	if ((fd = creat(file, 0660)) == -1)
 		err(1, "creat(%s)", file);
 
 	to = sizeof(buf);

Modified: user/pho/stress2/testcases/shm/shm.c
==============================================================================
--- user/pho/stress2/testcases/shm/shm.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/shm/shm.c	Fri May 30 06:34:29 2014	(r266870)
@@ -51,7 +51,7 @@ char	*shm_buf;
 
 int	semid = -1;
 key_t	semkey;
-struct	sembuf sop[2]; 
+struct	sembuf sop[2];
 
 size_t	pgsize;
 pid_t	pid;
@@ -110,9 +110,9 @@ cleanup(void)
 
 static void
 Wait(int i) {
-   		sop[0].sem_num = i;
-   		sop[0].sem_op = -1;
-   		if (semop(semid, sop, 1) == -1) {
+		sop[0].sem_num = i;
+		sop[0].sem_op = -1;
+		if (semop(semid, sop, 1) == -1) {
 			if (errno != EINTR && errno != EIDRM && errno != EINVAL)
 				warn("Wait: semop (%s:%d)", __FILE__, __LINE__);
 			done_testing = 1;
@@ -121,9 +121,9 @@ Wait(int i) {
 
 static void
 Sig(int i) {
-   		sop[0].sem_num = i;
-   		sop[0].sem_op = 1;
-   		if (semop(semid, sop, 1) == -1) {
+		sop[0].sem_num = i;
+		sop[0].sem_op = 1;
+		if (semop(semid, sop, 1) == -1) {
 			if (errno != EINTR && errno != EIDRM && errno != EINVAL)
 			warn("Sig: semop (%s:%d)", __FILE__, __LINE__);
 			done_testing = 1;
@@ -149,7 +149,7 @@ test(void)
 				break;
 			if (shm_buf[i] != (i % 128)) {
 				fprintf(stderr,
-					"child %d: expected %d, got %d\n", 
+					"child %d: expected %d, got %d\n",
 					getpid(), i % 128, shm_buf[i]);
 				break;
 			}
@@ -172,7 +172,7 @@ test(void)
 				break;
 			if (shm_buf[i] != (i % 128)) {
 				fprintf(stderr,
-					"parent(%d): expected %d, got %d\n", 
+					"parent(%d): expected %d, got %d\n",
 					getpid(), i % 128, shm_buf[i]);
 				break;
 			}

Modified: user/pho/stress2/testcases/socket/socket.c
==============================================================================
--- user/pho/stress2/testcases/socket/socket.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/socket/socket.c	Fri May 30 06:34:29 2014	(r266870)
@@ -115,7 +115,7 @@ test(void)
 	} else if (pid > 0) {
 		reader();
 		kill(pid, SIGINT);
-	} else 
+	} else
 		err(1, "fork(), %s:%d",  __FILE__, __LINE__);
 
 	return (0);

Modified: user/pho/stress2/testcases/swap/swap.c
==============================================================================
--- user/pho/stress2/testcases/swap/swap.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/swap/swap.c	Fri May 30 06:34:29 2014	(r266870)
@@ -61,13 +61,13 @@ setup(int nb)
 
 		if (op->hog == 0)
 			pct = random_int(80, 100);
-		
+
 		if (op->hog == 1)
 			pct = random_int(100, 110);
-		
+
 		if (op->hog == 2)
 			pct = random_int(110, 120);
-		
+
 		if (op->hog >= 3)
 			pct = random_int(120, 130);
 
@@ -92,7 +92,7 @@ setup(int nb)
 			err(1,"getrlimit");
 		rlp.rlim_cur -= 1024 * 1024;
 
-		if (size > (unsigned long)rlp.rlim_cur) 
+		if (size > (unsigned long)rlp.rlim_cur)
 			size = rlp.rlim_cur;
 		putval(size);
 

Modified: user/pho/stress2/testcases/symlink/symlink.c
==============================================================================
--- user/pho/stress2/testcases/symlink/symlink.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/symlink/symlink.c	Fri May 30 06:34:29 2014	(r266870)
@@ -62,8 +62,8 @@ setup(int nb)
 			pct = random_int(1, 90);
 		size = size / 100 * pct + 1;
 
-		if (size > 32000)
-			size = 32000;	/* arbitrary limit number of files pr. dir */
+		if (size > 16000)
+			size = 16000;	/* arbitrary limit number of files pr. dir */
 
 		/* Resource requirements: */
 		while (size > 0) {

Modified: user/pho/stress2/testcases/syscall/syscall.c
==============================================================================
--- user/pho/stress2/testcases/syscall/syscall.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/syscall/syscall.c	Fri May 30 06:34:29 2014	(r266870)
@@ -62,6 +62,7 @@ static int ignore[] = {
 	SYS_mac_syscall,
 	SYS_sigtimedwait,
 	SYS_sigwaitinfo,
+	SYS_pdfork,
 };
 
 int

Modified: user/pho/stress2/testcases/tcp/tcp.c
==============================================================================
--- user/pho/stress2/testcases/tcp/tcp.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/tcp/tcp.c	Fri May 30 06:34:29 2014	(r266870)
@@ -175,7 +175,7 @@ test(void)
 	} else if (pid > 0) {
 		reader();
 		kill(pid, SIGINT);
-	} else 
+	} else
 		err(1, "fork(), %s:%d",  __FILE__, __LINE__);
 
 	return (0);

Modified: user/pho/stress2/testcases/thr1/thr1.c
==============================================================================
--- user/pho/stress2/testcases/thr1/thr1.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/thr1/thr1.c	Fri May 30 06:34:29 2014	(r266870)
@@ -65,7 +65,7 @@ test(void)
 	pthread_t threads[NTHREADS];
 	int i;
 	int r;
-	
+
 	for (i = 0; i < NTHREADS; i++)
 		if ((r = pthread_create(&threads[i], NULL, thr_routine, 0)) != 0)
 			err(1, "pthread_create(): %s\n", strerror(r));

Modified: user/pho/stress2/testcases/thr2/thr2.c
==============================================================================
--- user/pho/stress2/testcases/thr2/thr2.c	Fri May 30 06:26:30 2014	(r266869)
+++ user/pho/stress2/testcases/thr2/thr2.c	Fri May 30 06:34:29 2014	(r266870)
@@ -74,7 +74,7 @@ test(void)
 	pthread_t threads[NTHREADS];
 	int i;
 	int r;
-	
+
 	for (i = 0; i < NTHREADS; i++)
 		if ((r = pthread_create(&threads[i], NULL, thr1, 0)) != 0)
 			err(1, "pthread_create(): %s\n", strerror(r));


More information about the svn-src-user mailing list