DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (27a812186ff4)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->

<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
     <title>Layout Regression tests</title>
<style type="text/css">
  body {font-family:arial}
.screen {background-color:silver; color:blue}
pre.screen {display:table-cell}
 </style>

</head>
<body>

<h1>Table Regression Tests</h1>
<h6>Bernd Mielke</h6>
<h2>About This Document</h2>
<p>
This document describes my guerrilla approach to successfully  running the table layout regression tests. It should encourage more people to run those tests.

<h2>Subject Overview</h2>
<p>
The table element and its children are one of the major layout components that can create some structure on the screen. They are widely (ab)used  by page authors. Every small change in the table code can generate a bunch of bugzilla entries and a lot of seemingly unrelated dupes. With the high frequency of checkins in to the source tree  it is difficult and time consuming to track the regression down to a single checkin. The risk of becoming very infamous can be reduced by running the layout regression tests.

<h2>Prerequisites</h2>
<p>
In order to run these tests, you will need to have:
<ol>
<li>a debug build with a working viewer, an optimized build will not work!
<li>a mozilla tree with the testfiles at <code>%MOZ_SRC%/layout/html/tests</code>,
<li> <code>DISABLE_TESTS</code> should not be defined,
<li>patience and time.
</ol>

<h2>Test Runs</h2>

<ul>
<li>Go to the <code>%MOZ_SRC%/layout/html/tests/block</code>  directory.
<li> Avoid the nasty assertions to pop up by <code>set XPCOM_DEBUG_BREAK=warn</code>, the world would be a much better place if we could <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=152015">first fix those assertions</a>.
<li>The following shell scripts need a <code>sh</code> before the command under WinXX.
<li>Execute  <code>rtest.sh baseline</code>
<li>Execute  <code>rtest.sh verify&gt;outputfile.txt</code>
<li>Make a note which tests have failed (these are  false positives. If you are in bad mood file a bug against Chris Waterson about them)
<li>you can grep the failures by:<br>
<code>grep 'rgd failed' &lt;outputfile.txt &gt;false_positive.txt</code> 
<li> Make a copy of <code>gklayout.dll</code> and <code>gkcontent.dll</code> in the <code>dist</code> directory. If you would like to switch back, you will need them.
<li>Make your changes to the source, compile and install.
<li>execute in the <code>layout/html/tests/block</code>  directory <code>rtest.sh verify &gt;regression.txt</code>
<li>Check how many tests have failed and analyse your results:
<ul>
<li>If the regression tests have failed at the same place as the previous diagnosed false positives =&gt; ignore
<ol>
<li>copy  <code>rtest.sh</code>  to <code>my_rtest.sh</code> 
<li>create a new directory <code>my_files</code>. 
<li>create in this directory a file <code>file_list.txt</code>, where you put the url's of your remaining test failures
<li>change <code>my_rtest.sh</code> to use only directory <code>my_files</code>
<li>go back to the original gklayout.dll and gkcontent.dll and repeat the regression test procedure on a much smaller set now.
</ol>
<li>Try to figure out what the other regressions are: Are they
     improving the picture or are they regressions?
<li>Note the difficult to explain testfailures.
</ul>
<li> Change the source if necessary until the regression tests indicate that your patch does not hork the block and table layout
<li> Submit your patch and lists the remaining differences in the bug
</ul>

<p>Be prepared to cycle.

<h2>How the layout regression tests work</h2>

<p>First the URL's to test are red from <code>file_list.txt</code>.<p>
<table><caption>snippet from file_list.txt</caption><tr><td>
<pre>file:///s|/mozilla/layout/html/tests/table/dom/appendCells1.html
file:///s|/mozilla/layout/html/tests/table/dom/appendCellsRebuild1.html
file:///s|/mozilla/layout/html/tests/table/dom/appendCol1.html
file:///s|/mozilla/layout/html/tests/table/dom/appendCol2.html
file:///s|/mozilla/layout/html/tests/table/dom/appendColGroup1.html
file:///s|/mozilla/layout/html/tests/table/dom/appendRowsExpand1.html</pre>
</td></tr></table>
<p>The regression tests compare the frame tree dumps recorded at two different times. The URL's to test are red from <code>file_list.txt</code>
For every file in <code>file_list.txt</code>viewer takes the root frame and dumps the whole tree via 
<a href="http://lxr.mozilla.org/seamonkey/search?string=nsFrame%3A%3ADumpRegression">
nsFrame::DumpRegression</a>.
<p>
 The frame tree dumps are  invoked by the <code>-o</code> switch to the <code>viewer</code> (see <a href="http://lxr.mozilla.org/seamonkey/ident?i=PrintHelpInfo">commandline arguments </a>). 
When <code>-o</code> is specified  together with a output directory for instance (<code>-o s:\mozilla\layout\html\tests\table\dom\</code>),  
the frame trees are dumped to separate files in that directory for all URL's in <code>file_list.txt</code> (see: 
<a href="http://lxr.mozilla.org/seamonkey/search?string=nsWebCrawler%3A%3ADumpRegression">
nsWebCrawler::DumpRegressionData</a>) . 
<p>Their name is generated by replacing the old extension <code>.html</code> or <code>.xml</code> with <code>.rgd</code>.  For <code>file:///s|/mozilla/layout/html/tests/table/dom/appendCells1.html</code> a file <code>appendCells1.rgd</code> will be created in the <code>s:\mozilla\layout\html\tests\table\dom\</code> directory.

<p>
 There is a special type of frame dumps - the printing regression tests, they are invoked by the <code>-Prt</code> command line argument to the <code>viewer</code> and include first a display then a frame dump taking into account the printer pages. A typical beginning of a dump (<code>*.rgd</code> file) looks like:<p>
<pre class="screen">
&lt;frame va="15022440" type="Viewport(-1)" state="270340" parent="0"&gt;
  &lt;view va="47171904"&gt;
  &lt;/view&gt;
  &lt;stylecontext va="15022232"&gt;
    &lt;font serif 240 240 0 /&gt;
    &lt;color data="-16777216"/&gt;
    &lt;background data="0 2 3 -1 0 0 "/&gt;
    &lt;spacing data="left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  left: 1[0x1]enum top: 1[0x1]enum right: 1[0x1]enum bottom: 1[0x1]enum  left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  1[0x1]enum 0" /&gt;
    &lt;list data="100 100 " /&gt;
    &lt;position data="left: Auto top: Auto right: Auto bottom: Auto  Auto  0[0x0]tw  Null  Auto  0[0x0]tw  Null  0 Auto  " /&gt;
    &lt;text data="0 0 0 Normal  Normal  0[0x0]tw  Normal  " /&gt;
    &lt;textreset data="0 10[0xa]enum  " /&gt;
    &lt;display data="0 1 0 0 0 0 0 0 0 0 0 0 " /&gt;
    &lt;visibility data="0 1 1.000000" /&gt;
    &lt;table data="0 0 4 -1 1 " /&gt;
    &lt;tableborder data="1 Null  Null  0 2 " /&gt;
    &lt;content data="0 0 0 Null  " /&gt;
    &lt;quotes data="0 " /&gt;
    &lt;ui data="3 0 0 1 " /&gt;
    &lt;uireset data="7 0 4" /&gt;
    &lt;xul data="0 0 0 0 0 1    &lt;svg data="0 1.000000 1.000000 0 1.000000" /&gt;
  &lt;/stylecontext&gt;</pre>
<p>The first run of the regression tests is started with the argument <code>baseline</code> and it creates the reference frame dumps. 
<p>The <code>baseline</code> log will look like:
<pre class="screen">
Type Manifest File: C:\MOZ_SOUR\MOZILLA\MOZILLA\DIST\WIN32_D.OBJ\BIN\components\xpti.dat
nsNativeComponentLoader: autoregistering begins.
nsNativeComponentLoader: autoregistering succeeded
Going to create the event queue
WEBSHELL+ = 1
Note: verifyreflow is disabled
Note: styleverifytree is disabled
Note: frameverifytree is disabled
+++ file:///s|/mozilla/layout/html/tests/table/dom/appendCells1.html: done loading (11810 msec)
appendCells1.rgd - being written
+++ file:///s|/mozilla/layout/html/tests/table/dom/appendCellsRebuild1.html: done loading (1260 msec)
appendCellsRebuild1.rgd - being written
+++ file:///s|/mozilla/layout/html/tests/table/dom/appendCol1.html: done loading (270 msec)
appendCol1.rgd - being written
+++ file:///s|/mozilla/layout/html/tests/table/dom/appendCol2.html: done loading (220 msec)
appendCol2.rgd - being written
+++ file:///s|/mozilla/layout/html/tests/table/dom/appendColGroup1.html: done loading (390 msec)
appendColGroup1.rgd - being written
+++ file:///s|/mozilla/layout/html/tests/table/dom/appendRowsExpand1.html: done loading (220 msec)
appendRowsExpand1.rgd - being written
</pre>
<p>
The second run with the argument <code>verify</code> creates first the frame dumps in a subdirectory (<code>verify</code>) and <a href="http://lxr.mozilla.org/seamonkey/search?string=nsFrameUtil%3A%3ACompareTrees">compares</a> each frame dump with the corresponding reference frame dump. If they differ in critical points the test fails. 
<p>A  typical part of the <code>verify</code> log would look like:
<pre class="screen">
Type Manifest File: C:\MOZ_SOUR\MOZILLA\MOZILLA\DIST\WIN32_D.OBJ\BIN\components\xpti.dat
nsNativeComponentLoader: autoregistering begins.
nsNativeComponentLoader: autoregistering succeeded
Going to create the event queue
WEBSHELL+ = 1
Note: verifyreflow is disabled
Note: styleverifytree is disabled
Note: frameverifytree is disabled
+++ file:///s|/mozilla/layout/html/tests/table/dom/appendCells1.html: done loading (2200 msec)
frame bbox mismatch: 0,285,930,435 vs. 0,285,1305,435
Node 1:
  TableOuter(table)(1) 0x10004 0,285,930,435, |null attr|-16777216|left: 0[0x0]tw top: 0[0x0]tw right: 0[0x0]tw bottom: 0[0x0]tw  left: 0[0x0]tw top: 0[0x0]tw right: 0[0x0]tw bottom: 0[0x0]tw  left: 1[0x1]enum top: 1[0x1]enum right: 1[0x1]enum bottom: 1[0x1]enum  left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  1[0x1]enum 0|100 100 |left: Inherit top: Inherit right: Inherit bottom: Inherit  0[0x0]tw  0[0x0]tw  Null  0[0x0]tw  0[0x0]tw  Null  0 Auto  |0 0 0 Normal  Normal  0[0x0]tw  Normal  |0 8 0 0 0 0 0 1 0 0 0 0 |0 0 4 -1 1 |0 0 0 Null
Node 2:
  TableOuter(table)(1) 0x10004 0,285,1305,435, |null attr|-16777216|left: 0[0x0]tw top: 0[0x0]tw right: 0[0x0]tw bottom: 0[0x0]tw  left: 0[0x0]tw top: 0[0x0]tw right: 0[0x0]tw bottom: 0[0x0]tw  left: 1[0x1]enum top: 1[0x1]enum right: 1[0x1]enum bottom: 1[0x1]enum  left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  1[0x1]enum 0|100 100 |left: Inherit top: Inherit right: Inherit bottom: Inherit  0[0x0]tw  0[0x0]tw  Null  0[0x0]tw  0[0x0]tw  Null  0 Auto  |0 0 0 Normal  Normal  0[0x0]tw  Normal  |0 8 0 0 0 0 0 1 0 0 0 0 |0 0 4 -1 1 |0 0 0 Null  
frame bbox mismatch: 0,0,930,435 vs. 0,0,1305,435
Node 1:
  Table(table)(1) 0x10004 0,0,930,435, |null attr|-16777216|left: Null top: 0[0x0]tw right: Null bottom: 0[0x0]tw  left: Null top: Null right: Null bottom: Null  left: 15[0xf]tw top: 15[0xf]tw right: 15[0xf]tw bottom: 15[0xf]tw  left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  1[0x1]enum 0|100 100 |left: Auto top: Auto right: Auto bottom: Auto  Auto  0[0x0]tw  Null  Auto  0[0x0]tw  Null  2 Auto  |0 0 0 Normal  Normal  0[0x0]tw  Normal  |0 8 0 0 0 0 0 0 0 0 0 0 |0 8 4 -1 1 |0 0 0 Null 
Node 2:
  Table(table)(1) 0x10004 0,0,1305,435, |null attr|-16777216|left: Null top: 0[0x0]tw right: Null bottom: 0[0x0]tw  left: Null top: Null right: Null bottom: Null  left: 15[0xf]tw top: 15[0xf]tw right: 15[0xf]tw bottom: 15[0xf]tw  left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  1[0x1]enum 0|100 100 |left: Auto top: Auto right: Auto bottom: Auto  Auto  0[0x0]tw  Null  Auto  0[0x0]tw  Null  2 Auto  |0 0 0 Normal  Normal  0[0x0]tw  Normal  |0 8 0 0 0 0 0 0 0 0 0 0 |0 8 4 -1 1 |0 0 0 Null 
frame bbox mismatch: 45,15,840,405 vs. 45,15,1215,405
Node 1:
  TableColGroup(table)(1) 0x80010004 45,15,840,405, |null attr|-16777216|left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  left: 1[0x1]enum top: 1[0x1]enum right: 1[0x1]enum bottom: 1[0x1]enum  left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  1[0x1]enum 0|100 100 |left: Auto top: Auto right: Auto bottom: Auto  Auto  0[0x0]tw  Null  Auto  0[0x0]tw  Null  0 Auto  |0 0 0 Normal  Normal  0[0x0]tw  Normal  |0 12 0 0 0 0 0 0 0 0 0 0 |0 0 4 -1 1 |0 0 0 Null 
Node 2:
  TableColGroup(table)(1) 0x80010004 45,15,1215,405, |null attr|-16777216|left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  left: 1[0x1]enum top: 1[0x1]enum right: 1[0x1]enum bottom: 1[0x1]enum  left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  1[0x1]enum 0|100 100 |left: Auto top: Auto right: Auto bottom: Auto  Auto  0[0x0]tw  Null  Auto  0[0x0]tw  Null  0 Auto  |0 0 0 Normal  Normal  0[0x0]tw  Normal  |0 12 0 0 0 0 0 0 0 0 0 0 |0 0 4 -1 1 |0 0 0 Null 
frame state mismatch: 0x30010406 vs. 0x30010004
Node 1:
  TableCol(table)(1) 0x30010406 0,0,0,0, |null attr|-16777216|left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  left: 1[0x1]enum top: 1[0x1]enum right: 1[0x1]enum bottom: 1[0x1]enum  left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  1[0x1]enum 0|100 100 |left: Auto top: Auto right: Auto bottom: Auto  Auto  0[0x0]tw  Null  Auto  0[0x0]tw  Null  0 Auto  |0 0 0 Normal  Normal  0[0x0]tw  Normal  |0 11 0 0 0 0 0 0 0 0 0 0 |0 0 4 -1 1 |0 0 0 Null 
Node 2:
  TableCol(table)(1) 0x30010004 870,0,345,405, |null attr|-16777216|left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  left: 1[0x1]enum top: 1[0x1]enum right: 1[0x1]enum bottom: 1[0x1]enum  left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  1[0x1]enum 0|100 100 |left: Auto top: Auto right: Auto bottom: Auto  Auto  0[0x0]tw  Null  Auto  0[0x0]tw  Null  0 Auto  |0 0 0 Normal  Normal  0[0x0]tw  Normal  |0 11 0 0 0 0 0 0 0 0 0 0 |0 0 4 -1 1 |0 0 0 Null  
frame bbox mismatch: 0,0,0,0 vs. 870,0,345,405
Node 1:
  TableCol(table)(1) 0x30010406 0,0,0,0, |null attr|-16777216|left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  left: 1[0x1]enum top: 1[0x1]enum right: 1[0x1]enum bottom: 1[0x1]enum  left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  1[0x1]enum 0|100 100 |left: Auto top: Auto right: Auto bottom: Auto  Auto  0[0x0]tw  Null  Auto  0[0x0]tw  Null  0 Auto  |0 0 0 Normal  Normal  0[0x0]tw  Normal  |0 11 0 0 0 0 0 0 0 0 0 0 |0 0 4 -1 1 |0 0 0 Null 
Node 2:
  TableCol(table)(1) 0x30010004 870,0,345,405, |null attr|-16777216|left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null left: 1[0x1]enum top: 1[0x1]enum right: 1[0x1]enum bottom: 1[0x1]enum  left: Null top: Null right: Null bottom: Null  left: Null top: Null right: Null bottom: Null  1[0x1]enum 0|100 100 |left: Auto top: Auto right: Auto bottom: Auto  Auto  0[0x0]tw  Null  Auto  0[0x0]tw  Null  0 Auto  |0 0 0 Normal  Normal  0[0x0]tw  Normal  |0 11 0 0 0 0 0 0 0 0 0 0 |0 0 4 -1 1 |0 0 0 Null  
regression test s:\mozilla\layout\html\tests\table\dom\verify\appendCells1.rgd failed
+++ file:///s|/mozilla/layout/html/tests/table/dom/appendCellsRebuild1.html: done loading (390 msec)
044regression test s:\mozilla\layout\html\tests\table\dom\verify\appendCellsRebuild1.rgd passed
+++ file:///s|/mozilla/layout/html/tests/table/dom/appendCol1.html: done loading (280 msec)
regression test s:\mozilla\layout\html\tests\table\dom\verify\appendCol1.rgd passed
+++ file:///s|/mozilla/layout/html/tests/table/dom/appendCol2.html: done loading (220 msec)
regression test s:\mozilla\layout\html\tests\table\dom\verify\appendCol2.rgd passed
+++ file:///s|/mozilla/layout/html/tests/table/dom/appendColGroup1.html: done loading (220 msec)
regression test s:\mozilla\layout\html\tests\table\dom\verify\appendColGroup1.rgd passed
</pre>
<p>
The first regression test has failed and it is marked so. 


<h2>Adding new regression tests</h2>
<p>
Once you have checked in the code:
<ul>
<li> please add your testcase for the bug to the regression tests.  
<li>A testcase should only contain local files. 
<li>Place the images in <code>table/images</code> (don't forget <code> cvs commit -kb </code>) 
<li>and the testfile in the <code>table/bugs</code> directory. 
<li>Update the <code>file_list<b>x</b>.txt</code> in order to include your file.
</ul>
<p>I would like to thank Chris Karnaze for his guidance and fantasai for his language support.
<div style="text-align:right"><i>&lt;regression.html&gt;&nbsp; &lt;Last updated:
2002-06-16 <a href="mailto:bernd.mielke@snafu.de">Bernd Mielke</a></i></div>

</body>
</html>