From: apn Date: Thu, 19 Feb 2015 11:57:12 +0000 (+0300) Subject: 0025803: Defective tests contaminating current directory X-Git-Tag: V6_9_0_beta~99 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=7a7e8cf1747f73d230f7772f20aa3a310ab0cf6c 0025803: Defective tests contaminating current directory Test cases save results in directory pointed by ${imagedir} Tcl variable. File names are initialized in scripts and passed to DRAW command as argument. Tests User Guide was updated. Remarks were corrected --- diff --git a/dox/dev_guides/tests/tests.md b/dox/dev_guides/tests/tests.md index 5534383d02..d0b13748db 100644 --- a/dox/dev_guides/tests/tests.md +++ b/dox/dev_guides/tests/tests.md @@ -452,7 +452,7 @@ If the test cannot be implemented using available DRAW commands, consider the fo * Otherwise the new command implementing the actions needed for this particular test should be added in *QABugs* package. The command name should be formed by the Mantis issue ID prefixed by *bug*, e.g. *bug12345*. Note that a DRAW command is expected to return 0 in case of a normal completion, and 1 (Tcl exception) if it is incorrectly used (e.g. a wrong number of input arguments). Thus if the new command needs to report a test error, this should be done by outputting an appropriate error message rather than by returning a non-zero value. - +Also file names must not be encoded in DRAW command but in script, and passed to DRAW command as argument. @subsection testmanual_3_4 Script Implementation diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx index 54f2ff569d..bac962b386 100755 --- a/src/QABugs/QABugs_19.cxx +++ b/src/QABugs/QABugs_19.cxx @@ -1802,7 +1802,7 @@ struct QABugs_NHandleClass #include static Standard_Integer OCC23951 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { - if (argc != 1) { + if (argc != 2) { di << "Usage: " << argv[0] << " invalid number of arguments" << "\n"; return 1; } @@ -1824,7 +1824,7 @@ static Standard_Integer OCC23951 (Draw_Interpretor& di, Standard_Integer argc, c return 1; } - writer.Write("test_box.step"); + writer.Write(argv[1]); return 0; } @@ -2247,11 +2247,11 @@ static TopoDS_Shape CreateTestShape (int& theShapeNb) #include static Standard_Integer OCC24931 (Draw_Interpretor& di, Standard_Integer argc, const char** argv) { - if (argc != 1) { + if (argc != 2) { di << "Usage: " << argv[0] << " invalid number of arguments"<<"\n"; return 1; } - TCollection_ExtendedString aFileName ("testdocument.xml"); + TCollection_ExtendedString aFileName (argv[1]); PCDM_StoreStatus aSStatus = PCDM_SS_Failure; Handle(TDocStd_Application) anApp = new AppStd_Application; @@ -3593,8 +3593,8 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) { theCommands.Add ("OCC24755", "OCC24755", __FILE__, OCC24755, group); theCommands.Add ("OCC24834", "OCC24834", __FILE__, OCC24834, group); theCommands.Add ("OCC24889", "OCC24889", __FILE__, OCC24889, group); - theCommands.Add ("OCC23951", "OCC23951", __FILE__, OCC23951, group); - theCommands.Add ("OCC24931", "OCC24931", __FILE__, OCC24931, group); + theCommands.Add ("OCC23951", "OCC23951 path to saved step file", __FILE__, OCC23951, group); + theCommands.Add ("OCC24931", "OCC24931 path to saved xml file", __FILE__, OCC24931, group); theCommands.Add ("OCC24945", "OCC24945", __FILE__, OCC24945, group); theCommands.Add ("OCC23950", "OCC23950 step_file", __FILE__, OCC23950, group); theCommands.Add ("OCC25004", "OCC25004", __FILE__, OCC25004, group); diff --git a/tests/bugs/fclasses/bug24931 b/tests/bugs/fclasses/bug24931 index cd55837515..7ccdf2d36c 100644 --- a/tests/bugs/fclasses/bug24931 +++ b/tests/bugs/fclasses/bug24931 @@ -8,7 +8,10 @@ puts "" pload QAcommands -set info [OCC24931] +set FilePath ${imagedir}/bug24931_testdocument.xml + +file delete -force ${FilePath} +set info [OCC24931 ${FilePath}] if { [regexp "OK" $info] != 1 } { puts "Error: Stack is overflow" diff --git a/tests/bugs/vis/bug2883_2 b/tests/bugs/vis/bug2883_2 index 202ae50404..17b2ab3d74 100644 --- a/tests/bugs/vis/bug2883_2 +++ b/tests/bugs/vis/bug2883_2 @@ -6,6 +6,12 @@ puts "" # It is impossible to set material, color and transparency to compound ######################################################################## +set FilePath_v1 ${imagedir}/bug2883_2_v1.png +set FilePath_v2 ${imagedir}/bug2883_2_v2.png + +file delete -force ${FilePath_v1} +file delete -force ${FilePath_v2} + box b1 0 0 0 1 2 3 box b2 4 0 0 3 1 2 vinit drv1/v1/v1 @@ -18,10 +24,10 @@ vdisplay b1 b2 vfit vsetcolor b1 RED vactivate drv1/v1/v1 -vdump v1.png +vdump ${FilePath_v1} vactivate drv1/v2/v1 -vdump v2.png -set info [diffimage v1.png v2.png 0 0 0] +vdump ${FilePath_v2} +set info [diffimage ${FilePath_v1} ${FilePath_v2} 0 0 0] if { $info != 0 } { puts "Error: images v1 and v2 are different" } else { diff --git a/tests/bugs/xde/bug23951 b/tests/bugs/xde/bug23951 index 72c6f837e5..0a27fdb1d2 100644 --- a/tests/bugs/xde/bug23951 +++ b/tests/bugs/xde/bug23951 @@ -8,7 +8,10 @@ puts "" pload QAcommands -set info [OCC23951] +set FilePath ${imagedir}/bug23951_test_box.step + +file delete -force ${FilePath} +set info [OCC23951 ${FilePath}] if { [regexp "Write Done" $info] != 1 } { puts "Error: file was not written" @@ -16,7 +19,7 @@ if { [regexp "Write Done" $info] != 1 } { puts "OK: file was written" } -stepread test_box.step a * +stepread ${FilePath} a * axo fit