Author: jsuchome Date: Wed Jun 22 12:58:44 2011 New Revision: 64540 URL: http://svn.opensuse.org/viewcvs/yast?rev=64540&view=rev Log: - added testsuite - 2.21.7 Added: trunk/snapper/testsuite/tests/GetFileMode.err trunk/snapper/testsuite/tests/GetFileMode.out trunk/snapper/testsuite/tests/GetFileMode.ycp (with props) trunk/snapper/testsuite/tests/GetFileModification.err trunk/snapper/testsuite/tests/GetFileModification.out trunk/snapper/testsuite/tests/GetFileModification.ycp (with props) trunk/snapper/testsuite/tests/GetSnapshotPath.err trunk/snapper/testsuite/tests/GetSnapshotPath.out trunk/snapper/testsuite/tests/GetSnapshotPath.ycp (with props) trunk/snapper/testsuite/tests/ReadSnapshots.err trunk/snapper/testsuite/tests/ReadSnapshots.out trunk/snapper/testsuite/tests/ReadSnapshots.ycp (with props) Modified: trunk/snapper/VERSION trunk/snapper/package/yast2-snapper.changes trunk/snapper/src/Snapper.ycp Modified: trunk/snapper/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/VERSION?rev=64540&r1=64539&r2=64540&view=diff ============================================================================== --- trunk/snapper/VERSION (original) +++ trunk/snapper/VERSION Wed Jun 22 12:58:44 2011 @@ -1 +1 @@ -2.21.6 +2.21.7 Modified: trunk/snapper/package/yast2-snapper.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/package/yast2-snapper.changes?rev=64540&r1=64539&r2=64540&view=diff ============================================================================== --- trunk/snapper/package/yast2-snapper.changes (original) +++ trunk/snapper/package/yast2-snapper.changes Wed Jun 22 12:58:44 2011 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Jun 22 12:58:17 CEST 2011 - jsuchome@suse.cz + +- added testsuite +- 2.21.7 + +------------------------------------------------------------------- Mon May 30 14:55:11 CEST 2011 - jsuchome@suse.cz - ask snapper library for snapshot paths Modified: trunk/snapper/src/Snapper.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/src/Snapper.ycp?rev=64540&r1=64539&r2=64540&view=diff ============================================================================== --- trunk/snapper/src/Snapper.ycp (original) +++ trunk/snapper/src/Snapper.ycp Wed Jun 22 12:58:44 2011 @@ -89,9 +89,11 @@ map ret = $[]; string file1 = sformat ("%1%2", GetSnapshotPath (old), file); - string file2 = sformat ("%1%2", GetSnapshotPath (new), file); - if (new == 0) - file2 = file; + string file2 = file; + if (new != 0) + { + file2 = sformat ("%1%2", GetSnapshotPath (new), file); + } y2milestone ("comparing '%1' and '%2'", file1, file2); @@ -250,10 +252,13 @@ /** * Return the given file mode as octal number */ -integer GetFileMode (string file) { +global integer GetFileMode (string file) { map out = (map) SCR::Execute (.target.bash_output, "/bin/stat --printf=%a " + file); - return tointeger (out["stdout"]:"755"); + string mode = out["stdout"]:""; + if (mode == nil || mode == "") + return 644; + return tointeger (mode); } /** Added: trunk/snapper/testsuite/tests/GetFileMode.err URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/testsuite/tests/GetFileMode.err?rev=64540&view=auto ============================================================================== (empty) Added: trunk/snapper/testsuite/tests/GetFileMode.out URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/testsuite/tests/GetFileMode.out?rev=64540&view=auto ============================================================================== --- trunk/snapper/testsuite/tests/GetFileMode.out (added) +++ trunk/snapper/testsuite/tests/GetFileMode.out Wed Jun 22 12:58:44 2011 @@ -0,0 +1,4 @@ +Execute .target.bash_output "/bin/stat --printf=%a /tmp/1" $["stdout":"755"] +Return 755 +Execute .target.bash_output "/bin/stat --printf=%a /tmp/2" $["stderr":"/bin/stat: cannot stat `/tmp/2': No such file or directory\n", "stdout":""] +Return 644 Added: trunk/snapper/testsuite/tests/GetFileMode.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/testsuite/tests/GetFileMode.ycp?rev=64540&view=auto ============================================================================== --- trunk/snapper/testsuite/tests/GetFileMode.ycp (added) +++ trunk/snapper/testsuite/tests/GetFileMode.ycp Wed Jun 22 12:58:44 2011 @@ -0,0 +1,23 @@ +{ + // testedfiles: Snapper.ycp + + import "Snapper"; + import "Testsuite"; + + map EX = $[ + "target" : $[ + "bash_output" : $[ + "stdout" : "755" + ], + ] + ]; + Testsuite::Test (``(Snapper::GetFileMode ("/tmp/1")), [ $[], $[], EX ], 0); + + EX["target","bash_output"] = $[ + "stdout" : "", + "stderr" : "/bin/stat: cannot stat `/tmp/2': No such file or directory\n" + ]; + + Testsuite::Test (``(Snapper::GetFileMode ("/tmp/2")), [ $[], $[], EX ], 0); + +} Added: trunk/snapper/testsuite/tests/GetFileModification.err URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/testsuite/tests/GetFileModification.err?rev=64540&view=auto ============================================================================== (empty) Added: trunk/snapper/testsuite/tests/GetFileModification.out URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/testsuite/tests/GetFileModification.out?rev=64540&view=auto ============================================================================== --- trunk/snapper/testsuite/tests/GetFileModification.out (added) +++ trunk/snapper/testsuite/tests/GetFileModification.out Wed Jun 22 12:58:44 2011 @@ -0,0 +1,13 @@ +Read .snapper.path $["num":1] "/snapshots/1/snapshot" +Execute .target.bash_output "/usr/bin/diff -u /snapshots/1/snapshot/etc/passwd /etc/passwd" $["stderr":"error while diffing"] +Log out: $["stderr":"error while diffing"] +Execute .target.bash_output "ls -ld /snapshots/1/snapshot/etc/passwd /etc/passwd | cut -f 1,3,4 -d ' '" $["stderr":"error while diffing"] +Return $["diff":"error while diffing", "status":["no_change"]] +Read .snapper.path $["num":1] "/snapshots/1/snapshot" +Read .snapper.path $["num":2] "/snapshots/1/snapshot" +Execute .target.bash_output "/usr/bin/diff -u /snapshots/1/snapshot/etc/passwd /snapshots/1/snapshot/etc/passwd" $["stdout":"+new user line"] +Execute .target.bash_output "ls -ld /snapshots/1/snapshot/etc/passwd /snapshots/1/snapshot/etc/passwd | cut -f 1,3,4 -d ' '" $["stdout":"+new user line"] +Return $["diff":"+new user line", "group1":"line", "group2":"", "mode1":"+new", "mode2":"", "status":["diff", "mode", "user", "group"], "user1":"user", "user2":""] +Read .snapper.path $["num":1] "/snapshots/1/snapshot" +Read .snapper.path $["num":2] "/snapshots/1/snapshot" +Return $["status":["none"]] Added: trunk/snapper/testsuite/tests/GetFileModification.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/testsuite/tests/GetFileModification.ycp?rev=64540&view=auto ============================================================================== --- trunk/snapper/testsuite/tests/GetFileModification.ycp (added) +++ trunk/snapper/testsuite/tests/GetFileModification.ycp Wed Jun 22 12:58:44 2011 @@ -0,0 +1,35 @@ +{ + // testedfiles: Snapper.ycp + + import "Snapper"; + import "Testsuite"; + + map READ = $[ + "snapper" : $[ + "path" : "/snapshots/1/snapshot" + ], + "target" : $[ + "stat" : $[ + 1 : 2 + ] + ], + ]; + map EX = $[ + "target" : $[ + "bash_output" : $[ + "stderr" : "error while diffing" + ] + ], + ]; + Testsuite::Test (``(Snapper::GetFileModification ("/etc/passwd", 1, 0)), [ READ, $[], EX ], 0); + + EX["target","bash_output"] = $[ + "stdout" : "+new user line" + ]; + // status map is wrong, due to 2 calls of target.bash_output with same result... + Testsuite::Test (``(Snapper::GetFileModification ("/etc/passwd", 1, 2)), [ READ, $[], EX ], 0); + + READ["target","stat"] = $[]; + + Testsuite::Test (``(Snapper::GetFileModification ("/etc/passwd", 1, 2)), [ READ, $[], EX ], 0); +} Added: trunk/snapper/testsuite/tests/GetSnapshotPath.err URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/testsuite/tests/GetSnapshotPath.err?rev=64540&view=auto ============================================================================== (empty) Added: trunk/snapper/testsuite/tests/GetSnapshotPath.out URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/testsuite/tests/GetSnapshotPath.out?rev=64540&view=auto ============================================================================== --- trunk/snapper/testsuite/tests/GetSnapshotPath.out (added) +++ trunk/snapper/testsuite/tests/GetSnapshotPath.out Wed Jun 22 12:58:44 2011 @@ -0,0 +1,4 @@ +Read .snapper.path $["num":0] nil +Return +Read .snapper.path $["num":0] "/snapshots/0/snapshot" +Return /snapshots/0/snapshot Added: trunk/snapper/testsuite/tests/GetSnapshotPath.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/testsuite/tests/GetSnapshotPath.ycp?rev=64540&view=auto ============================================================================== --- trunk/snapper/testsuite/tests/GetSnapshotPath.ycp (added) +++ trunk/snapper/testsuite/tests/GetSnapshotPath.ycp Wed Jun 22 12:58:44 2011 @@ -0,0 +1,17 @@ +{ + // testedfiles: Snapper.ycp + + import "Snapper"; + import "Testsuite"; + + map READ = $[ + "snapper" : $[ + "path" : nil + ] + ]; + Testsuite::Test (``(Snapper::GetSnapshotPath (0)), [ READ, $[], $[] ], 0); + + READ["snapper","path"] = "/snapshots/0/snapshot"; + + Testsuite::Test (``(Snapper::GetSnapshotPath (0)), [ READ, $[], $[] ], 0); +} Added: trunk/snapper/testsuite/tests/ReadSnapshots.err URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/testsuite/tests/ReadSnapshots.err?rev=64540&view=auto ============================================================================== (empty) Added: trunk/snapper/testsuite/tests/ReadSnapshots.out URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/testsuite/tests/ReadSnapshots.out?rev=64540&view=auto ============================================================================== --- trunk/snapper/testsuite/tests/ReadSnapshots.out (added) +++ trunk/snapper/testsuite/tests/ReadSnapshots.out Wed Jun 22 12:58:44 2011 @@ -0,0 +1,7 @@ +Read .snapper.snapshots nil +Return true +Return [] +Read .snapper.snapshots [$["date":1297364138, "description":"current system", "num":0, "type":`SINGLE], $["date":1297364138, "description":"before yast2-users", "num":1, "post_num":2, "type":`PRE]] +Return true +Return [$["date":1297364138, "description":"before yast2-users", "name":"1", "num":1, "post_num":2, "type":`PRE]] +Return $[1:0] Added: trunk/snapper/testsuite/tests/ReadSnapshots.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/testsuite/tests/ReadSnapshots.ycp?rev=64540&view=auto ============================================================================== --- trunk/snapper/testsuite/tests/ReadSnapshots.ycp (added) +++ trunk/snapper/testsuite/tests/ReadSnapshots.ycp Wed Jun 22 12:58:44 2011 @@ -0,0 +1,36 @@ +{ + // testedfiles: Snapper.ycp + + import "Testsuite"; + import "Snapper"; + + map READ = $[ + "snapper" : $[ + "snapshots" : nil + ] + ]; + + Testsuite::Test (``(Snapper::ReadSnapshots ()), [ READ, $[], $[] ], 0); + Testsuite::Test (``(Snapper::snapshots), [ READ, $[], $[] ], 0); + + READ["snapper","snapshots"] = [ + $[ + "date" : 1297364138, + "description" : "current system", + "num" : 0, + "type" : `SINGLE + ], + $[ + "date" : 1297364138, + "description" : "before yast2-users", + "num" : 1, + "post_num" : 2, + "type" : `PRE + ] + ]; + + Testsuite::Test (``(Snapper::ReadSnapshots ()), [ READ, $[], $[] ], 0); + Testsuite::Test (``(Snapper::snapshots), [ READ, $[], $[] ], 0); + Testsuite::Test (``(Snapper::id2index), [ READ, $[], $[] ], 0); + +} -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org