0025803: Defective tests contaminating current directory
authorapn <apn@opencascade.com>
Thu, 19 Feb 2015 11:57:12 +0000 (14:57 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 19 Feb 2015 11:58:24 +0000 (14:58 +0300)
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

dox/dev_guides/tests/tests.md
src/QABugs/QABugs_19.cxx
tests/bugs/fclasses/bug24931
tests/bugs/vis/bug2883_2
tests/bugs/xde/bug23951

index 5534383..d0b1374 100644 (file)
@@ -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
 
index 54f2ff5..bac962b 100755 (executable)
@@ -1802,7 +1802,7 @@ struct QABugs_NHandleClass
 #include <STEPCAFControl_Writer.hxx>
 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 <TNaming_Builder.hxx>
 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);
index cd55837..7ccdf2d 100644 (file)
@@ -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"
index 202ae50..17b2ab3 100644 (file)
@@ -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 {
index 72c6f83..0a27fdb 100644 (file)
@@ -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