wiki:LayoutTestsSearchPath

The Layout Tests Search Path

Or, how and why we look for expected test results the way that we do

See also

Here's the logic behind the layout test paths:

Assume you have three tests called foo, bar, and baz, we're running tests on the Apple Mac port, and suppose it's a couple of years ago, when Leopard was the most recent version of the Mac. The generic version of a platform always contains the "future" or "latest" version of the results, so:

LayoutTests/platform/mac contains:

  • foo-expected.txt r1.1
  • bar-expected.txt r.1.1
  • baz-expected.txt r.1.1

Now Snow Leopard comes out, and foo produces different results for some reason. When running on Snow Leopard, you want to find the new version of the file, but the same (old) version of the other two files. On the other hand, you want to make sure that when running on Leopard, you get the same (old) versions of all three files.

We put the new file in the "future" version, and move the older file into the directory matching the last platform that passed it:

LayoutTests/platform/mac contains:

  • foo-expected.txt r1.2
  • bar-expected.txt r1.1
  • baz-expected.txt r1.1

platform/mac-leopard contains:

  • foo-expected.txt r1.1

Snow Leopard will only look in the platform/mac dir (and then next to the test, in the generic directories, of course), and Leopard will look in platform/mac-leopard, then platform/mac.

Now Lion comes out, bar produces different output, and foo also produces different output (again). We can leave the platform/mac-leopard directory alone, and create a new platform/mac-snowleopard directory, and only have to move the two failing tests there:

platform/mac contains:

  • foo-expected.txt r1.3
  • bar-expected.txt r1.2
  • baz-expected.txt r1.1

platform/mac-snowleopard contains:

  • foo-expected.txt r1.2
  • bar-expected.txt r1.1

platform/mac-leopard contains (as before):

  • foo-expected.txt r1.1

Lion only looks in platform/mac, SL looks in platform/mac-snowleopard, then platform/mac, and Leopard looks in platform/mac-leopard, then platform/mac-snowleopard, then platform/mac.

If Leopard didn't look in the snowleopard directory, then we would have to copy versions of files more places every time a new release came out. This approach minimizes the amount of file shuffling we have to do, and keeps most of the files in platform/chromium-mac. But, it means that version X needs to look in every newer version in order to find the right files.

Another way to think of it is that directory X-1 contains all and only the files that were different between versions X-1 and X, and then realize that this is, in a sense, associative (but not commutative). So, if you want to find the differences between Leopard (Lion-2) and Lion, you can look for delta(Lion-2, Lion-1) then delta(Lion-1, Lion) (but you can't reverse the order).

Last modified 13 years ago Last modified on Apr 27, 2012, 3:36:41 PM
Note: See TracWiki for help on using the wiki.