ia64/xen-unstable

changeset 5869:f9a3f32a129b

Fix testsuite to ignore tool/ dir.
Signed-off-by: Rusty Russel <rusty@rustcorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Jul 26 15:08:22 2005 +0000 (2005-07-26)
parents 71271a3f41a9
children 99366b44c421
files tools/xenstore/Makefile tools/xenstore/testsuite/02directory.sh tools/xenstore/testsuite/08transaction.sh tools/xenstore/testsuite/09domain.sh tools/xenstore/testsuite/12readonly.sh tools/xenstore/xs_random.c
line diff
     1.1 --- a/tools/xenstore/Makefile	Tue Jul 26 14:02:33 2005 +0000
     1.2 +++ b/tools/xenstore/Makefile	Tue Jul 26 15:08:22 2005 +0000
     1.3 @@ -86,9 +86,9 @@ randomcheck: xs_random xenstored_test
     1.4  	$(TESTENV) ./xs_random --fail /tmp/xs_random 10000 $(RANDSEED)
     1.5  
     1.6  stresstest: xs_stress xs_watch_stress xenstored_test
     1.7 -	rm -rf $(TESTDIR)/store
     1.8 +	rm -rf $(TESTDIR)/store $(TESTDIR)/transactions
     1.9  	export $(TESTENV); PID=`./xenstored_test --output-pid --trace-file=/tmp/trace`; ./xs_stress 5000; ret=$$?; kill $$PID; exit $$ret
    1.10 -	rm -rf $(TESTDIR)/store
    1.11 +	rm -rf $(TESTDIR)/store $(TESTDIR)/transactions
    1.12  	export $(TESTENV); PID=`./xenstored_test --output-pid`; ./xs_watch_stress; ret=$$?; kill $$PID; exit $$ret
    1.13  
    1.14  xs_dom0_test: xs_dom0_test.o utils.o
     2.1 --- a/tools/xenstore/testsuite/02directory.sh	Tue Jul 26 14:02:33 2005 +0000
     2.2 +++ b/tools/xenstore/testsuite/02directory.sh	Tue Jul 26 15:08:22 2005 +0000
     2.3 @@ -1,22 +1,23 @@
     2.4  #! /bin/sh
     2.5  
     2.6 -# Root directory has nothing in it.
     2.7 -[ "`echo -e 'dir /' | ./xs_test 2>&1`" = "" ]
     2.8 +# Root directory has only tool dir in it.
     2.9 +[ "`echo -e 'dir /' | ./xs_test 2>&1`" = "tool" ]
    2.10  
    2.11  # Create a file.
    2.12  [ "`echo -e 'write /test create contents' | ./xs_test 2>&1`" = "" ]
    2.13  
    2.14  # Directory shows it.
    2.15 -[ "`echo -e 'dir /' | ./xs_test 2>&1`" = "test" ]
    2.16 +[ "`echo -e 'dir /' | ./xs_test 2>&1 | sort`" = "test
    2.17 +tool" ]
    2.18  
    2.19  # Make a new directory.
    2.20  [ "`echo -e 'mkdir /dir' | ./xs_test 2>&1`" = "" ]
    2.21  
    2.22  # Check it's there.
    2.23 -DIR="`echo -e 'dir /' | ./xs_test 2>&1`"
    2.24 -[ "$DIR" = "test
    2.25 -dir" ] || [ "$DIR" = "dir
    2.26 -test" ]
    2.27 +DIR="`echo -e 'dir /' | ./xs_test 2>&1 | sort`"
    2.28 +[ "$DIR" = "dir
    2.29 +test
    2.30 +tool" ]
    2.31  
    2.32  # Check it's empty.
    2.33  [ "`echo -e 'dir /dir' | ./xs_test 2>&1`" = "" ]
     3.1 --- a/tools/xenstore/testsuite/08transaction.sh	Tue Jul 26 14:02:33 2005 +0000
     3.2 +++ b/tools/xenstore/testsuite/08transaction.sh	Tue Jul 26 15:08:22 2005 +0000
     3.3 @@ -1,79 +1,81 @@
     3.4  #! /bin/sh
     3.5  # Test transactions.
     3.6  
     3.7 +echo mkdir /test | ./xs_test
     3.8 +
     3.9  # Simple transaction: create a file inside transaction.
    3.10 -[ "`echo -e '1 start /
    3.11 -1 write /entry1 create contents
    3.12 -2 dir /
    3.13 -1 dir /
    3.14 +[ "`echo -e '1 start /test
    3.15 +1 write /test/entry1 create contents
    3.16 +2 dir /test
    3.17 +1 dir /test
    3.18  1 commit
    3.19 -2 read /entry1' | ./xs_test`" = "1:entry1
    3.20 +2 read /test/entry1' | ./xs_test`" = "1:entry1
    3.21  2:contents" ]
    3.22 -echo rm /entry1 | ./xs_test
    3.23 +echo rm /test/entry1 | ./xs_test
    3.24  
    3.25  # Create a file and abort transaction.
    3.26 -[ "`echo -e '1 start /
    3.27 -1 write /entry1 create contents
    3.28 -2 dir /
    3.29 -1 dir /
    3.30 +[ "`echo -e '1 start /test
    3.31 +1 write /test/entry1 create contents
    3.32 +2 dir /test
    3.33 +1 dir /test
    3.34  1 abort
    3.35 -2 dir /' | ./xs_test`" = "1:entry1" ]
    3.36 +2 dir /test' | ./xs_test`" = "1:entry1" ]
    3.37  
    3.38 -echo write /entry1 create contents | ./xs_test
    3.39 +echo write /test/entry1 create contents | ./xs_test
    3.40  # Delete in transaction, commit
    3.41 -[ "`echo -e '1 start /
    3.42 -1 rm /entry1
    3.43 -2 dir /
    3.44 -1 dir /
    3.45 +[ "`echo -e '1 start /test
    3.46 +1 rm /test/entry1
    3.47 +2 dir /test
    3.48 +1 dir /test
    3.49  1 commit
    3.50 -2 dir /' | ./xs_test`" = "2:entry1" ]
    3.51 +2 dir /test' | ./xs_test`" = "2:entry1" ]
    3.52  
    3.53  # Delete in transaction, abort.
    3.54 -echo write /entry1 create contents | ./xs_test
    3.55 -[ "`echo -e '1 start /
    3.56 -1 rm /entry1
    3.57 -2 dir /
    3.58 -1 dir /
    3.59 +echo write /test/entry1 create contents | ./xs_test
    3.60 +[ "`echo -e '1 start /test
    3.61 +1 rm /test/entry1
    3.62 +2 dir /test
    3.63 +1 dir /test
    3.64  1 abort
    3.65 -2 dir /' | ./xs_test`" = "2:entry1
    3.66 +2 dir /test' | ./xs_test`" = "2:entry1
    3.67  2:entry1" ]
    3.68  
    3.69  # Transactions can take as long as the want...
    3.70 -[ "`echo -e 'start /
    3.71 +[ "`echo -e 'start /test
    3.72  sleep 1
    3.73 -rm /entry1
    3.74 +rm /test/entry1
    3.75  commit
    3.76 -dir /' | ./xs_test`" = "" ]
    3.77 +dir /test' | ./xs_test`" = "" ]
    3.78  
    3.79  # ... as long as noone is waiting.
    3.80 -[ "`echo -e '1 start /
    3.81 -2 mkdir /dir
    3.82 -1 mkdir /dir
    3.83 -1 dir /
    3.84 +[ "`echo -e '1 start /test
    3.85 +2 mkdir /test/dir
    3.86 +1 mkdir /test/dir
    3.87 +1 dir /test
    3.88  1 commit' | ./xs_test 2>&1`" = "1:dir
    3.89  FATAL: 1: commit: Connection timed out" ]
    3.90  
    3.91  # Events inside transactions don't trigger watches until (successful) commit.
    3.92 -[ "`echo -e '1 watch / token 100
    3.93 -2 start /
    3.94 -2 mkdir /dir/sub
    3.95 +[ "`echo -e '1 watch /test token 100
    3.96 +2 start /test
    3.97 +2 mkdir /test/dir/sub
    3.98  1 waitwatch' | ./xs_test 2>&1`" = "1:waitwatch timeout" ]
    3.99 -[ "`echo -e '1 watch / token 100
   3.100 -2 start /
   3.101 -2 mkdir /dir/sub
   3.102 +[ "`echo -e '1 watch /test token 100
   3.103 +2 start /test
   3.104 +2 mkdir /test/dir/sub
   3.105  2 abort
   3.106  1 waitwatch' | ./xs_test 2>&1`" = "1:waitwatch timeout" ]
   3.107 -[ "`echo -e '1 watch / token 100
   3.108 -2 start /
   3.109 -2 mkdir /dir/sub
   3.110 +[ "`echo -e '1 watch /test token 100
   3.111 +2 start /test
   3.112 +2 mkdir /test/dir/sub
   3.113  2 commit
   3.114  1 waitwatch
   3.115 -1 ackwatch token' | ./xs_test 2>&1`" = "1:/dir/sub:token" ]
   3.116 +1 ackwatch token' | ./xs_test 2>&1`" = "1:/test/dir/sub:token" ]
   3.117  
   3.118  # Rm inside transaction works like rm outside: children get notified.
   3.119 -[ "`echo -e '1 watch /dir/sub token 100
   3.120 -2 start /
   3.121 -2 rm /dir
   3.122 +[ "`echo -e '1 watch /test/dir/sub token 100
   3.123 +2 start /test
   3.124 +2 rm /test/dir
   3.125  2 commit
   3.126  1 waitwatch
   3.127 -1 ackwatch token' | ./xs_test 2>&1`" = "1:/dir/sub:token" ]
   3.128 +1 ackwatch token' | ./xs_test 2>&1`" = "1:/test/dir/sub:token" ]
     4.1 --- a/tools/xenstore/testsuite/09domain.sh	Tue Jul 26 14:02:33 2005 +0000
     4.2 +++ b/tools/xenstore/testsuite/09domain.sh	Tue Jul 26 15:08:22 2005 +0000
     4.3 @@ -4,8 +4,9 @@
     4.4  # Create a domain, write an entry.
     4.5  [ "`echo -e 'introduce 1 100 7 /my/home
     4.6  1 write /entry1 create contents
     4.7 -dir /' | ./xs_test 2>&1`" = "handle is 1
     4.8 -entry1" ]
     4.9 +dir /' | ./xs_test 2>&1 | sort`" = "entry1
    4.10 +handle is 1
    4.11 +tool" ]
    4.12  
    4.13  # Release that domain.
    4.14  [ "`echo -e 'release 1' | ./xs_test`" = "" ]
     5.1 --- a/tools/xenstore/testsuite/12readonly.sh	Tue Jul 26 14:02:33 2005 +0000
     5.2 +++ b/tools/xenstore/testsuite/12readonly.sh	Tue Jul 26 15:08:22 2005 +0000
     5.3 @@ -4,16 +4,17 @@
     5.4  [ "`echo 'write /test create contents' | ./xs_test 2>&1`" = "" ]
     5.5  
     5.6  # These are all valid.
     5.7 -[ "`echo 'dir /
     5.8 -read /test
     5.9 +[ "`echo dir / | ./xs_test --readonly 2>&1 | sort`" = "test
    5.10 +tool" ]
    5.11 +
    5.12 +[ "`echo 'read /test
    5.13  getperm /test
    5.14  watch /test token 0
    5.15  unwatch /test token 
    5.16  start /
    5.17  commit
    5.18  start /
    5.19 -abort' | ./xs_test --readonly 2>&1`" = "test
    5.20 -contents
    5.21 +abort' | ./xs_test --readonly 2>&1`" = "contents
    5.22  0 READ" ]
    5.23  
    5.24  # These don't work
     6.1 --- a/tools/xenstore/xs_random.c	Tue Jul 26 14:02:33 2005 +0000
     6.2 +++ b/tools/xenstore/xs_random.c	Tue Jul 26 15:08:22 2005 +0000
     6.3 @@ -987,6 +987,8 @@ static void setup_file_ops(const char *d
     6.4  	char *cmd = talloc_asprintf(NULL, "echo -n r0 > %s/.perms", dir);
     6.5  	if (mkdir(dir, 0700) != 0)
     6.6  		barf_perror("Creating directory %s", dir);
     6.7 +	if (mkdir(talloc_asprintf(cmd, "%s/tool", dir), 0700) != 0)
     6.8 +		barf_perror("Creating directory %s/tool", dir);
     6.9  	do_command(cmd);
    6.10  	talloc_free(cmd);
    6.11  }
    6.12 @@ -1211,6 +1213,10 @@ static bool ops_equal(struct ops *a, voi
    6.13  	char *nodename;
    6.14  	bool ret = false;
    6.15  
    6.16 +	/* Ignore tool/ dir. */
    6.17 +	if (streq(node, "/tool"))
    6.18 +		return true;
    6.19 +
    6.20  	/* FILE backend expects talloc'ed pointer. */
    6.21  	nodename = talloc_strdup(NULL, node);
    6.22  	permsa = a->get_perms(ah, nodename, &numpermsa);