Author: mvidner Date: Fri Feb 3 16:57:39 2012 New Revision: 67362 URL: http://svn.opensuse.org/viewcvs/yast?rev=67362&view=rev Log: Better test cases for section_private (bnc#743355). Added: trunk/core/agent-ini/testsuite/multi/private.in.0 trunk/core/agent-ini/testsuite/multi/private.in.1 trunk/core/agent-ini/testsuite/multi/private.in.3 Modified: trunk/core/agent-ini/testsuite/multi/private.err trunk/core/agent-ini/testsuite/multi/private.in.2 trunk/core/agent-ini/testsuite/multi/private.out trunk/core/agent-ini/testsuite/multi/private.scr trunk/core/agent-ini/testsuite/multi/private.ycp Modified: trunk/core/agent-ini/testsuite/multi/private.err URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-ini/testsuite/multi/private.err?rev=67362&r1=67361&r2=67362&view=diff ============================================================================== --- trunk/core/agent-ini/testsuite/multi/private.err (original) +++ trunk/core/agent-ini/testsuite/multi/private.err Fri Feb 3 16:57:39 2012 @@ -1,11 +1,45 @@ +[agent-ini] IniParser.cc(parse):XXX Rewriting multi/private.in.0.test to 0 +[agent-ini] IniParser.cc(parse):XXX Rewriting multi/private.in.1.test to 1 [agent-ini] IniParser.cc(parse):XXX Rewriting multi/private.in.2.test to 2 -[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively 1 to .v."1"."Totalise"."Password" -[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively Totalise to .v."1"."Totalise"."Password" -[agent-ini] IniFile.cc(setMyValue):XXX Adding value .v."1"."Totalise"."Password" = "Secret password" -[agent-ini] IniFile.cc(setMyValue):XXX Adding value .v."2"."arcor"."Password" = "Public password" +[agent-ini] IniParser.cc(parse):XXX Rewriting multi/private.in.3.test to 3 +[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively Section to .v."0".Section.Key +[agent-ini] IniFile.cc(setMyValue):XXX Adding value .v."0".Section.Key = "existing public implicit" +[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively Section to .v."1".Section.Key +[agent-ini] IniFile.cc(setMyValue):XXX Adding value .v."1".Section.Key = "existing public explicit" +[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively Section to .v."2".Section.Key +[agent-ini] IniFile.cc(setMyValue):XXX Adding value .v."2".Section.Key = "existing private implicit" +[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively Section to .v."3".Section.Key +[agent-ini] IniFile.cc(setMyValue):XXX Adding value .v."3".Section.Key = "existing private explicit" +[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively 4 to .v."4".Section.Key +[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively Section to .v."4".Section.Key +[agent-ini] IniFile.cc(setMyValue):XXX Adding value .v."4".Section.Key = "new public implicit" +[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively 5 to .v."5".Section.Key +[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively Section to .v."5".Section.Key +[agent-ini] IniFile.cc(setMyValue):XXX Adding value .v."5".Section.Key = "new public explicit" +[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively 6 to .v."6".Section.Key +[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively Section to .v."6".Section.Key +[agent-ini] IniFile.cc(setMyValue):XXX Adding value .v."6".Section.Key = "new private implicit" +[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively 7 to .v."7".Section.Key +[agent-ini] IniFile.cc(setValue):XXX Write: adding recursively Section to .v."7".Section.Key +[agent-ini] IniFile.cc(setMyValue):XXX Adding value .v."7".Section.Key = "new private explicit" +[agent-ini] IniParser.cc(parse):XXX Rewriting multi/private.in.0.test to 0 +[agent-ini] IniParser.cc(parse):XXX Rewriting multi/private.in.1.test to 1 [agent-ini] IniParser.cc(parse):XXX Rewriting multi/private.in.2.test to 2 -[agent-ini] IniParser.cc(getFileName):XXX Rewriting 2 to multi/private.in.2.test +[agent-ini] IniParser.cc(parse):XXX Rewriting multi/private.in.3.test to 3 +[agent-ini] IniParser.cc(getFileName):XXX Rewriting 0 to multi/private.in.0.test [agent-ini] IniParser.cc(getFileName):XXX Rewriting 1 to multi/private.in.1.test -[YCP] multi/private.ycp:XXX secret file mode: $["exit":0, "stderr":"", "stdout":"600\n"] -[YCP] multi/private.ycp:XXX public file mode: $["exit":0, "stderr":"", "stdout":"644\n"] +[agent-ini] IniParser.cc(getFileName):XXX Rewriting 2 to multi/private.in.2.test +[agent-ini] IniParser.cc(getFileName):XXX Rewriting 3 to multi/private.in.3.test +[agent-ini] IniParser.cc(getFileName):XXX Rewriting 4 to multi/private.in.4.test +[agent-ini] IniParser.cc(getFileName):XXX Rewriting 5 to multi/private.in.5.test +[agent-ini] IniParser.cc(getFileName):XXX Rewriting 6 to multi/private.in.6.test +[agent-ini] IniParser.cc(getFileName):XXX Rewriting 7 to multi/private.in.7.test +[YCP] multi/private.ycp:XXX existing public implicit file mode: 644 +[YCP] multi/private.ycp:XXX existing public explicit file mode: 644 +[YCP] multi/private.ycp:XXX existing private implicit file mode: 600 +[YCP] multi/private.ycp:XXX existing private explicit file mode: 600 +[YCP] multi/private.ycp:XXX new public implicit file mode: 644 +[YCP] multi/private.ycp:XXX new public explicit file mode: 644 +[YCP] multi/private.ycp:XXX new private implicit file mode: 644 +[YCP] multi/private.ycp:XXX new private explicit file mode: 600 [agent-ini] IniParser.cc(write):XXX File multi/private.in.*.test did not change. Not saving. Added: trunk/core/agent-ini/testsuite/multi/private.in.0 URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-ini/testsuite/multi/private.in.0?rev=67362&view=auto ============================================================================== (empty) Added: trunk/core/agent-ini/testsuite/multi/private.in.1 URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-ini/testsuite/multi/private.in.1?rev=67362&view=auto ============================================================================== (empty) Modified: trunk/core/agent-ini/testsuite/multi/private.in.2 URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-ini/testsuite/multi/private.in.2?rev=67362&r1=67361&r2=67362&view=diff ============================================================================== --- trunk/core/agent-ini/testsuite/multi/private.in.2 (original) +++ trunk/core/agent-ini/testsuite/multi/private.in.2 Fri Feb 3 16:57:39 2012 @@ -1,11 +0,0 @@ -[Dialer arcor] -Compuserve = 0 -Provider = Arcor -[End] - -[Dialer mobilcom] -Compuserve = 0 -Provider = Mobilcom -Phone = 0101901929 -[End] - Added: trunk/core/agent-ini/testsuite/multi/private.in.3 URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-ini/testsuite/multi/private.in.3?rev=67362&view=auto ============================================================================== (empty) Modified: trunk/core/agent-ini/testsuite/multi/private.out URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-ini/testsuite/multi/private.out?rev=67362&r1=67361&r2=67362&view=diff ============================================================================== --- trunk/core/agent-ini/testsuite/multi/private.out (original) +++ trunk/core/agent-ini/testsuite/multi/private.out Fri Feb 3 16:57:39 2012 @@ -1,17 +1,25 @@ (nil) +multi/private.in.0.test ------------------------------- +[Section] +Key = existing public implicit multi/private.in.1.test ------------------------------- -[Dialer Totalise] - Password = Secret password -[End] +[Section] +Key = existing public explicit multi/private.in.2.test ------------------------------- -[Dialer arcor] - Compuserve = 0 - Provider = Arcor - Password = Public password -[End] - -[Dialer mobilcom] - Compuserve = 0 - Provider = Mobilcom - Phone = 0101901929 -[End] +[Section] +Key = existing private implicit +multi/private.in.3.test ------------------------------- +[Section] +Key = existing private explicit +multi/private.in.4.test ------------------------------- +[Section] +Key = new public implicit +multi/private.in.5.test ------------------------------- +[Section] +Key = new public explicit +multi/private.in.6.test ------------------------------- +[Section] +Key = new private implicit +multi/private.in.7.test ------------------------------- +[Section] +Key = new private explicit Modified: trunk/core/agent-ini/testsuite/multi/private.scr URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-ini/testsuite/multi/private.scr?rev=67362&r1=67361&r2=67362&view=diff ============================================================================== --- trunk/core/agent-ini/testsuite/multi/private.scr (original) +++ trunk/core/agent-ini/testsuite/multi/private.scr Fri Feb 3 16:57:39 2012 @@ -6,12 +6,11 @@ "rewrite" : [ [ "multi/private\.in\.(.)\.test$", "multi/private.in.%s.test"], ], - "subindent" : " ", + "subindent" : "", "comments": [ "^[ \t]*#.*", "^[ \t]*$" ], "sections" : [ $[ - "begin" : [ "[ \t]*\\[Dialer[ \t]+(.*[^ \t])[ \t]*\\][ \t]*", "[Dialer %s]" ], - "end" : [ "^[ \t]*\\[End\\][ \t]*$", "[End]", ], + "begin" : [ "[ \t]*\\[(.*[^ \t])[ \t]*\\][ \t]*", "[%s]" ], ], ], "params" : [ Modified: trunk/core/agent-ini/testsuite/multi/private.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/agent-ini/testsuite/multi/private.ycp?rev=67362&r1=67361&r2=67362&view=diff ============================================================================== --- trunk/core/agent-ini/testsuite/multi/private.ycp (original) +++ trunk/core/agent-ini/testsuite/multi/private.ycp Fri Feb 3 16:57:39 2012 @@ -1,26 +1,49 @@ -// -// Multiple files test -// -// providers.rpm -// - +// test private files, bnc#743355 { SCR::RegisterAgent (.target, `ag_system ()); - any out = nil; - - SCR::Write (.v."1"."Totalise"."Password", "Secret password"); - SCR::Write (.section_private."1", true); - - SCR::Write (.v."2"."arcor"."Password", "Public password"); + // 8 combinations to test + // bitmask: + // 4: new file, 0: existing file + // 2: secret 0: public + // 1: explicit with section_private 0: implicit with permisions of existing file + + // #2, existing private implicit, was the one reported about sssd.conf + // #6, new private implicit, is a contradiciton in requirements, XFAIL + + string description(integer i) { + string new_s = ((i & 4) != 0)? + "new ": + "existing "; + string private_s = ((i & 2) != 0)? + "private ": + "public "; + string explicit_s = ((i & 1) != 0)? + "explicit": + "implicit"; + return new_s + private_s + explicit_s; + } + + // fix permissions of fixtures from svn/git + foreach(integer i, [2, 3], { + SCR::Execute (.target.bash, sformat("chmod 600 multi/private.in.%1.test", i)); + }); + + foreach(integer i, [0, 1, 2, 3, 4, 5, 6, 7], { + string i_str = tostring(i); + SCR::Write (add(add(.v, i_str), .Section.Key), description(i)); + + if ((i & 1) != 0) { + SCR::Write (add(.section_private, i_str), (i & 2) != 0); + } + }); SCR::Write (., nil); //flush - out = SCR::Execute (.target.bash_output, "stat -c %a multi/private.in.1.test"); - y2milestone("secret file mode: %1", out); - - out = SCR::Execute (.target.bash_output, "stat -c %a multi/private.in.2.test"); - y2milestone("public file mode: %1", out); + foreach(integer i, [0, 1, 2, 3, 4, 5, 6, 7], { + map out = (map) SCR::Execute (.target.bash_output, sformat("stat -c %%a multi/private.in.%1.test", i)); + y2milestone("%1 file mode: %2", description(i), out["stdout"]:""); + }); return nil; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org