Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/fs/vfs chdir() once per process is enough, no need to ...



details:   https://anonhg.NetBSD.org/src/rev/dcedfa98d14d
branches:  trunk
changeset: 757368:dcedfa98d14d
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Aug 26 18:06:44 2010 +0000

description:
chdir() once per process is enough, no need to do it for every
thread (and doing so would cause occasional failures when some
thread would cd out of the test mountpoint while another thread
was still running in there).

diffstat:

 tests/fs/vfs/t_renamerace.c |  23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

diffs (100 lines):

diff -r 9b12309ee4a3 -r dcedfa98d14d tests/fs/vfs/t_renamerace.c
--- a/tests/fs/vfs/t_renamerace.c       Thu Aug 26 17:24:14 2010 +0000
+++ b/tests/fs/vfs/t_renamerace.c       Thu Aug 26 18:06:44 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_renamerace.c,v 1.10 2010/08/26 15:07:16 pooka Exp $  */
+/*     $NetBSD: t_renamerace.c,v 1.11 2010/08/26 18:06:44 pooka Exp $  */
 
 /*
  * Modified for rump and atf from a program supplied
@@ -32,7 +32,6 @@
        int fd;
 
        rump_pub_lwp_alloc_and_switch(0, 10);
-       rump_sys_chdir(arg);
 
        while (!quittingtime) {
                fd = rump_sys_open("rename.test1",
@@ -43,8 +42,6 @@
                rump_sys_close(fd);
        }
 
-       rump_sys_chdir("/");
-
        return NULL;
 }
 
@@ -53,7 +50,6 @@
 {
 
        rump_pub_lwp_alloc_and_switch(0, 10);
-       rump_sys_chdir(arg);
 
        while (!quittingtime) {
                if (rump_sys_mkdir("rename.test1", 0777) == -1)
@@ -61,8 +57,6 @@
                rump_sys_rmdir("rename.test1");
        }
 
-       rump_sys_chdir("/");
-
        return NULL;
 }
 
@@ -71,14 +65,11 @@
 {
 
        rump_pub_lwp_alloc_and_switch(0, 11);
-       rump_sys_chdir(arg);
 
        while (!quittingtime) {
                rump_sys_rename("rename.test1", "rename.test2");
        }
 
-       rump_sys_chdir("/");
-
        return NULL;
 }
 
@@ -95,11 +86,12 @@
        if (FSTYPE_MSDOS(tc))
                atf_tc_skip("test fails in some setups, reason unknown");
 
+       RL(rump_sys_chdir(mp));
        for (i = 0; i < NWRK; i++)
-               pthread_create(&pt1[i], NULL, w1, __UNCONST(mp));
+               pthread_create(&pt1[i], NULL, w1, NULL);
 
        for (i = 0; i < NWRK; i++)
-               pthread_create(&pt2[i], NULL, w2, __UNCONST(mp));
+               pthread_create(&pt2[i], NULL, w2, NULL);
 
        sleep(5);
        quittingtime = 1;
@@ -108,6 +100,7 @@
                pthread_join(pt1[i], NULL);
        for (i = 0; i < NWRK; i++)
                pthread_join(pt2[i], NULL);
+       RL(rump_sys_chdir("/"));
 
        /*
         * XXX: does not always fail on LFS, especially for unicpu
@@ -130,14 +123,16 @@
            FSTYPE_MSDOS(tc))
                atf_tc_expect_signal(-1, "PR kern/43626");
 
-       pthread_create(&pt1, NULL, w1_dirs, __UNCONST(mp));
-       pthread_create(&pt2, NULL, w2, __UNCONST(mp));
+       RL(rump_sys_chdir(mp));
+       pthread_create(&pt1, NULL, w1_dirs, NULL);
+       pthread_create(&pt2, NULL, w2, NULL);
 
        sleep(5);
        quittingtime = 1;
 
        pthread_join(pt1, NULL);
        pthread_join(pt2, NULL);
+       RL(rump_sys_chdir("/"));
 
        /*
         * Doesn't always trigger when run on a slow backend



Home | Main Index | Thread Index | Old Index