Author: jsuchome Date: Wed Oct 12 16:54:56 2011 New Revision: 66410 URL: http://svn.opensuse.org/viewcvs/yast?rev=66410&view=rev Log: - snaper agent: C++ optimalizations - quote strings passed to bash commands - added testsuite - escape HTML tags in diff output - use fixed font for showing the diff (bnc#723621) - 2.17.8 Added: branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileMode.err branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileMode.out branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileMode.ycp (with props) branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileModification.err branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileModification.out branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileModification.ycp (with props) branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetSnapshotPath.err branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetSnapshotPath.out branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetSnapshotPath.ycp (with props) branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/ReadSnapshots.err branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/ReadSnapshots.out branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/ReadSnapshots.ycp (with props) Modified: branches/SuSE-Code-11-SP2-Branch/snapper/VERSION branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.cc branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.h branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp branches/SuSE-Code-11-SP2-Branch/snapper/src/dialogs.ycp Modified: branches/SuSE-Code-11-SP2-Branch/snapper/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/VERSION?rev=66410&r1=66409&r2=66410&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/VERSION (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/VERSION Wed Oct 12 16:54:56 2011 @@ -1 +1 @@ -2.17.7 +2.17.8 Modified: branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.cc?rev=66410&r1=66409&r2=66410&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.cc (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.cc Wed Oct 12 16:54:56 2011 @@ -18,11 +18,11 @@ /* * search the map for value of given key; both key and value have to be strings */ -string SnapperAgent::getValue (const YCPMap map, const string key, string deflt) +string SnapperAgent::getValue (const YCPMap &map, const YCPString &key, const string &deflt) { - if (!map->value(YCPString(key)).isNull() - && map->value(YCPString(key))->isString()) - return map->value(YCPString(key))->asString()->value(); + YCPValue val = map->value(key); + if (!val.isNull() && val->isString()) + return val->asString()->value(); else return deflt; } @@ -33,15 +33,15 @@ * @param key key we are looking for * @param deflt the default value to be returned if key is not found */ -int SnapperAgent::getIntValue (const YCPMap map, const string key, int deflt) +int SnapperAgent::getIntValue (const YCPMap &map, const YCPString &key, const int deflt) { - if (!map->value(YCPString(key)).isNull() && map->value(YCPString(key))->isInteger()) { - return map->value(YCPString(key))->asInteger()->value(); + YCPValue val = map->value(key); + + if (!val.isNull() && val->isInteger()) { + return val->asInteger()->value(); } - else if (!map->value(YCPString(key)).isNull() && - map->value(YCPString(key))->isString()) { - YCPInteger i (map->value(YCPString(key))->asString()->value().c_str()); - return i->value(); + else if (!val.isNull() && val->isString()) { + return YCPInteger (val->asString()->value().c_str())->value (); } return deflt; } @@ -50,10 +50,11 @@ * Search the map for value of given key; * key is string and value is YCPList */ -YCPList SnapperAgent::getListValue (const YCPMap map, const string key) +YCPList SnapperAgent::getListValue (const YCPMap &map, const YCPString &key) { - if (!map->value(YCPString(key)).isNull() && map->value(YCPString(key))->isList()) - return map->value(YCPString(key))->asList(); + YCPValue val = map->value(key); + if (!val.isNull() && val->isList()) + return val->asList(); else return YCPList(); } @@ -110,7 +111,7 @@ */ YCPValue SnapperAgent::Read(const YCPPath &path, const YCPValue& arg, const YCPValue& opt) { - y2internal ("path in Read: '%s'.", path->toString().c_str()); + y2debug ("path in Read: '%s'.", path->toString().c_str()); YCPValue ret = YCPVoid(); YCPMap argmap; @@ -155,7 +156,7 @@ * Read (.snapper.path, $[ "num" : num]) -> returns the path to directory with given snapshot */ if (PC(0) == "path") { - unsigned int num = getIntValue (argmap, "num", 0); + unsigned int num = getIntValue (argmap, YCPString ("num"), 0); const Snapshots& snapshots = sh->getSnapshots(); Snapshots::const_iterator snap = snapshots.find(num); if (snap == snapshots.end()) @@ -197,14 +198,14 @@ s->add (YCPString ("pre_num"), YCPInteger (it->getPreNum())); } - y2internal ("snapshot %s", s.toString().c_str()); + y2debug ("snapshot %s", s.toString().c_str()); retlist->add (s); } return retlist; } - unsigned int num1 = getIntValue (argmap, "from", 0); - unsigned int num2 = getIntValue (argmap, "to", 0); + unsigned int num1 = getIntValue (argmap, YCPString ("from"), 0); + unsigned int num2 = getIntValue (argmap, YCPString ("to"), 0); /** * Read(.snapper.diff_list) -> show difference between snapnots num1 and num2 as list. @@ -293,7 +294,7 @@ YCPBoolean SnapperAgent::Write(const YCPPath &path, const YCPValue& arg, const YCPValue& arg2) { - y2internal ("path in Write: '%s'.", path->toString().c_str()); + y2debug ("path in Write: '%s'.", path->toString().c_str()); YCPBoolean ret = YCPBoolean(true); return ret; @@ -305,7 +306,7 @@ YCPValue SnapperAgent::Execute(const YCPPath &path, const YCPValue& arg, const YCPValue& arg2) { - y2internal ("path in Execute: '%s'.", path->toString().c_str()); + y2debug ("path in Execute: '%s'.", path->toString().c_str()); YCPValue ret = YCPBoolean (true); YCPMap argmap; @@ -323,8 +324,7 @@ y2milestone ("deleting existing snapper object"); deleteSnapper(sh); } - - string config_name = getValue (argmap, "config", "root"); + string config_name = getValue (argmap, YCPString ("config"), "root"); try { sh = createSnapper (config_name); } @@ -359,18 +359,18 @@ */ if (PC(0) == "rollback") { - unsigned int num1 = getIntValue (argmap, "from", 0); - unsigned int num2 = getIntValue (argmap, "to", 0); + unsigned int num1 = getIntValue (argmap, YCPString ("from"), 0); + unsigned int num2 = getIntValue (argmap, YCPString ("to"), 0); const Snapshots& snapshots = sh->getSnapshots(); Comparison comparison(sh, snapshots.find(num1), snapshots.find(num2)); Files& files = comparison.getFiles(); - YCPList selected = getListValue (argmap, "files"); + YCPList selected = getListValue (argmap, YCPString ("files")); for (int i=0; i < selected->size(); i++) { if (selected.value(i)->isString()) { string name = selected->value(i)->asString()->value(); - y2internal ("file to rollback: %s", name.c_str()); + y2debug ("file to rollback: %s", name.c_str()); Files::iterator it = files.find(name); if (it == files.end()) { Modified: branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.h?rev=66410&r1=66409&r2=66410&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.h (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/agent-snapper/src/SnapperAgent.h Wed Oct 12 16:54:56 2011 @@ -37,7 +37,7 @@ * search the map for value of given key; both key and value have to be strings * when key is not present, default value is returned */ - string getValue (const YCPMap map, const string key, string deflt); + string getValue (const YCPMap &map, const YCPString &key, const string &deflt); /** * Search the map for value of given key @@ -45,13 +45,13 @@ * @param key key we are looking for * @param deflt the default value to be returned if key is not found */ - int getIntValue ( const YCPMap map, const string key, int deflt); + int getIntValue ( const YCPMap &map, const YCPString &key, const int deflt); /** * Search the map for value of given key; * key is string and value is YCPList */ - YCPList getListValue (const YCPMap map, const string key); + YCPList getListValue (const YCPMap &map, const YCPString &key); public: /** Modified: branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes?rev=66410&r1=66409&r2=66410&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/package/yast2-snapper.changes Wed Oct 12 16:54:56 2011 @@ -1,4 +1,14 @@ ------------------------------------------------------------------- +Wed Oct 12 16:45:12 CEST 2011 - jsuchome@suse.cz + +- snaper agent: C++ optimalizations +- quote strings passed to bash commands +- added testsuite +- escape HTML tags in diff output +- use fixed font for showing the diff (bnc#723621) +- 2.17.8 + +------------------------------------------------------------------- Fri Oct 7 14:41:26 CEST 2011 - jsuchome@suse.cz - removed conflicting statusToString Modified: branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp?rev=66410&r1=66409&r2=66410&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/src/Snapper.ycp Wed Oct 12 16:54:56 2011 @@ -38,7 +38,7 @@ import "Label"; import "Progress"; import "Report"; - +import "String"; // global list of all snapshot global list<map> snapshots = []; @@ -116,7 +116,7 @@ { list<string> status = [ "no_change" ]; map out = (map) SCR::Execute (.target.bash_output, - sformat ("/usr/bin/diff -u %1 %2", file1, file2)); + sformat ("/usr/bin/diff -u '%1' '%2'", String::Quote (file1), String::Quote (file2))); if (out["stderr"]:"" != "") { y2warning ("out: %1", out); @@ -131,7 +131,8 @@ // check mode and ownerships out = (map) SCR::Execute (.target.bash_output, - sformat ("ls -ld %1 %2 | cut -f 1,3,4 -d ' '", file1, file2)); + sformat ("ls -ld -- '%1' '%2' | cut -f 1,3,4 -d ' '", + String::Quote (file1), String::Quote (file2))); list<string> parts = splitstring (out["stdout"]:""," \n"); if (parts[0]:"" != parts[3]:"") @@ -284,8 +285,12 @@ */ integer GetFileMode (string file) { - map out = (map) SCR::Execute (.target.bash_output, "/bin/stat --printf=%a " + file); - return tointeger (out["stdout"]:"755"); + map out = (map) SCR::Execute (.target.bash_output, + sformat ("/bin/stat --printf=%%a '%1'", String::Quote (file))); + string mode = out["stdout"]:""; + if (mode == nil || mode == "") + return 644; + return tointeger (mode); } /** @@ -332,12 +337,15 @@ { SCR::Execute (.target.mkdir, full_path); } - SCR::Execute (.target.bash, sformat ("/bin/chown %1:%2 '%3'", stat["uid"]:0, stat["gid"]:0, full_path)); - SCR::Execute (.target.bash, sformat ("/bin/chmod %1 '%2'", GetFileMode (orig), full_path)); + SCR::Execute (.target.bash, sformat ("/bin/chown -- %1:%2 '%3'", + stat["uid"]:0, stat["gid"]:0, String::Quote (full_path))); + SCR::Execute (.target.bash, sformat ("/bin/chmod -- %1 '%2'", + GetFileMode (orig), String::Quote (full_path))); } else { - SCR::Execute (.target.bash, sformat ("/bin/cp -a '%1' '%2'", orig, full_path)); + SCR::Execute (.target.bash, sformat ("/bin/cp -a -- '%1' '%2'", + String::Quote (orig), String::Quote (full_path))); } UI::ChangeWidget (`id (`log), `LastLine, full_path + "\n"); } Modified: branches/SuSE-Code-11-SP2-Branch/snapper/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/src/dialogs.ycp?rev=66410&r1=66409&r2=66410&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/src/dialogs.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/snapper/src/dialogs.ycp Wed Oct 12 16:54:56 2011 @@ -37,6 +37,7 @@ import "Popup"; import "Wizard"; import "Snapper"; +import "String"; include "snapper/helps.ycp"; @@ -373,8 +374,10 @@ if (haskey (modification, "diff")) { - string diff = modification["diff"]:""; + string diff = String::EscapeTags (modification["diff"]:""); diff = mergestring (splitstring (diff, "\n"), "<br>"); + // show fixed font in diff + diff = "<tt>" + diff + "</tt>"; content = add (content, `RichText (`id (`diff), diff)); } else @@ -636,7 +639,7 @@ files = filter (string file, files, { if (haskey (files_index, file)) { - to_restore = add (to_restore, Snapper::GetFileFullPath (file)); + to_restore = add (to_restore, String::EscapeTags (Snapper::GetFileFullPath (file))); return true; } else Added: branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileMode.err URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileMode.err?rev=66410&view=auto ============================================================================== (empty) Added: branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileMode.out URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileMode.out?rev=66410&view=auto ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileMode.out (added) +++ branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileMode.out Wed Oct 12 16:54:56 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: branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileMode.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileMode.ycp?rev=66410&view=auto ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileMode.ycp (added) +++ branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileMode.ycp Wed Oct 12 16:54:56 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: branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileModification.err URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileModification.err?rev=66410&view=auto ============================================================================== (empty) Added: branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileModification.out URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileModification.out?rev=66410&view=auto ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileModification.out (added) +++ branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileModification.out Wed Oct 12 16:54:56 2011 @@ -0,0 +1,14 @@ +Read .snapper.path $["num":1] "/snapshots/1/snapshot" +Read .snapper.path $["num":0] "/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: branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileModification.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileModification.ycp?rev=66410&view=auto ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileModification.ycp (added) +++ branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetFileModification.ycp Wed Oct 12 16:54:56 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: branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetSnapshotPath.err URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetSnapshotPath.err?rev=66410&view=auto ============================================================================== (empty) Added: branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetSnapshotPath.out URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetSnapshotPath.out?rev=66410&view=auto ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetSnapshotPath.out (added) +++ branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetSnapshotPath.out Wed Oct 12 16:54:56 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: branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetSnapshotPath.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetSnapshotPath.ycp?rev=66410&view=auto ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetSnapshotPath.ycp (added) +++ branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/GetSnapshotPath.ycp Wed Oct 12 16:54:56 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: branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/ReadSnapshots.err URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/ReadSnapshots.err?rev=66410&view=auto ============================================================================== (empty) Added: branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/ReadSnapshots.out URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/ReadSnapshots.out?rev=66410&view=auto ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/ReadSnapshots.out (added) +++ branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/ReadSnapshots.out Wed Oct 12 16:54:56 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: branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/ReadSnapshots.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/ReadSnapshots.ycp?rev=66410&view=auto ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/ReadSnapshots.ycp (added) +++ branches/SuSE-Code-11-SP2-Branch/snapper/testsuite/tests/ReadSnapshots.ycp Wed Oct 12 16:54:56 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