Browse Source

Failing integration test for folders + readonly (ref #231)

Jakob Borg 11 years ago
parent
commit
d7df11e724
4 changed files with 17 additions and 12 deletions
  1. 3 3
      integration/f1/config.xml
  2. 2 2
      integration/f2/config.xml
  3. 4 4
      integration/folders.sh
  4. 8 3
      integration/md5r.go

+ 3 - 3
integration/f1/config.xml

@@ -1,15 +1,15 @@
 <configuration version="1">
     <repository directory="s1" ro="true">
-        <node id="I6KAH7666SLLL5PFXSOAUFJCDZYAOMLEKCP2GB3BV5RQST3PSROA" name="s1">
+        <node id="I6KAH7666SLLL5PFXSOAUFJCDZYAOMLEKCP2GB3BV5RQST3PSROA" name="f1">
             <address>127.0.0.1:22001</address>
         </node>
-        <node id="JMFJCXBGZDE4BOCJE3VF65GYZNAIVJRET3J6HMRAUQIGJOFKNHMQ" name="s2">
+        <node id="JMFJCXBGZDE4BOCJE3VF65GYZNAIVJRET3J6HMRAUQIGJOFKNHMQ" name="f2">
             <address>127.0.0.1:22002</address>
         </node>
     </repository>
     <options>
         <listenAddress>127.0.0.1:22001</listenAddress>
-        <readOnly>false</readOnly>
+        <readOnly>true</readOnly>
         <allowDelete>true</allowDelete>
         <followSymlinks>true</followSymlinks>
         <guiEnabled>true</guiEnabled>

+ 2 - 2
integration/f2/config.xml

@@ -1,9 +1,9 @@
 <configuration version="1">
     <repository directory="s2">
-        <node id="I6KAH7666SLLL5PFXSOAUFJCDZYAOMLEKCP2GB3BV5RQST3PSROA" name="s1">
+        <node id="I6KAH7666SLLL5PFXSOAUFJCDZYAOMLEKCP2GB3BV5RQST3PSROA" name="f1">
             <address>127.0.0.1:22001</address>
         </node>
-        <node id="JMFJCXBGZDE4BOCJE3VF65GYZNAIVJRET3J6HMRAUQIGJOFKNHMQ" name="s2">
+        <node id="JMFJCXBGZDE4BOCJE3VF65GYZNAIVJRET3J6HMRAUQIGJOFKNHMQ" name="f2">
             <address>127.0.0.1:22002</address>
         </node>
     </repository>

+ 4 - 4
integration/folders.sh

@@ -11,7 +11,7 @@ go build json.go
 start() {
 	echo "Starting..."
 	for i in 1 2 ; do
-		STPROFILER=":909$i" syncthing -home "f$i" &
+		STTRACE=linenumbers STPROFILER=":909$i" syncthing -home "f$i" &
 	done
 }
 
@@ -51,11 +51,11 @@ testConvergence() {
 	echo "Verifying..."
 
 	pushd s1 >/dev/null
-	find . -type d | sort > ../dirs-1
+	../md5r -d | grep -v ' . ' > ../dirs-1
 	popd >/dev/null
 
 	pushd s2 >/dev/null
-	find . -type d | sort > ../dirs-2
+	../md5r -d | grep -v ' . ' > ../dirs-2
 	popd >/dev/null
 
 	if ! cmp dirs-1 dirs-2 ; then
@@ -66,7 +66,7 @@ testConvergence() {
 }
 
 rm -rf s? s??-?
-rm -f h?/*.idx.gz
+rm -f f?/*.idx.gz
 
 setup
 start

+ 8 - 3
integration/md5r.go

@@ -11,10 +11,14 @@ import (
 	"path/filepath"
 )
 
-var long bool
+var (
+	long bool
+	dirs bool
+)
 
 func main() {
 	flag.BoolVar(&long, "l", false, "Long output")
+	flag.BoolVar(&dirs, "d", false, "Check dirs")
 	flag.Parse()
 	args := flag.Args()
 
@@ -37,14 +41,15 @@ func walker(path string, info os.FileInfo, err error) error {
 		return err
 	}
 
-	if !info.IsDir() {
+	if dirs && info.IsDir() {
+		fmt.Printf("%s  %s 0%03o %d\n", "-", path, info.Mode(), info.ModTime().Unix())
+	} else if !info.IsDir() {
 		sum, err := md5file(path)
 		if err != nil {
 			return err
 		}
 		if long {
 			fmt.Printf("%s  %s 0%03o %d\n", sum, path, info.Mode(), info.ModTime().Unix())
-
 		} else {
 			fmt.Printf("%s  %s\n", sum, path)
 		}