Module Name: src
Committed By: pooka
Date: Wed Apr 8 08:57:25 UTC 2009
Modified Files:
src/tests/fs/tmpfs: t_renamerace.c
Log Message:
make test duration bound by time instead of by number of rounds
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/fs/tmpfs/t_renamerace.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/fs/tmpfs/t_renamerace.c
diff -u src/tests/fs/tmpfs/t_renamerace.c:1.1 src/tests/fs/tmpfs/t_renamerace.c:1.2
--- src/tests/fs/tmpfs/t_renamerace.c:1.1 Tue Apr 7 20:51:46 2009
+++ src/tests/fs/tmpfs/t_renamerace.c Wed Apr 8 08:57:24 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: t_renamerace.c,v 1.1 2009/04/07 20:51:46 pooka Exp $ */
+/* $NetBSD: t_renamerace.c,v 1.2 2009/04/08 08:57:24 pooka Exp $ */
/*
* Modified for rump and atf from a program supplied
@@ -23,8 +23,6 @@
#include <fs/tmpfs/tmpfs_args.h>
-#define NROUND (1<<16) /* usually triggered with this amount of rounds */
-
ATF_TC(renamerace);
ATF_TC_HEAD(renamerace, tc)
{
@@ -35,9 +33,9 @@
void *
w1(void *arg)
{
- int fd, i;
+ int fd;
- for (i = 0; i < NROUND; i++) {
+ for (;;) {
fd = rump_sys_open("/rename.test1", O_WRONLY|O_CREAT|O_TRUNC, 0666);
rump_sys_unlink("/rename.test1");
rump_sys_close(fd);
@@ -45,11 +43,21 @@
return NULL;
}
+void *
+w2(void *arg)
+{
+
+ for (;;) {
+ rump_sys_rename("/rename.test1", "/rename.test2");
+ }
+ return NULL;
+}
+
ATF_TC_BODY(renamerace, tc)
{
struct tmpfs_args args;
struct ukfs *fs;
- pthread_t pt;
+ pthread_t pt1, pt2;
int fail = 0, succ = 0, i;
memset(&args, 0, sizeof(args));
@@ -61,24 +69,10 @@
if (fs == NULL)
err(1, "ukfs_mount");
- pthread_create(&pt, NULL, w1, fs);
-
- for (i = 0; i < NROUND; i++) {
- int rv;
- rv = rump_sys_rename("/rename.test1", "/rename.test2");
-#if 0
- if (rv == 0) {
- if (succ++ % 10000 == 0)
- printf("success\n");
- } else {
- if (fail++ % 10000 == 0)
- printf("fail\n");
- }
-#endif
- }
+ pthread_create(&pt1, NULL, w1, fs);
+ pthread_create(&pt2, NULL, w2, fs);
- pthread_join(pt, NULL);
- ukfs_release(fs, 0);
+ sleep(10);
}
ATF_TP_ADD_TCS(tp)