Changeset 84560 in webkit


Ignore:
Timestamp:
Apr 21, 2011 4:24:13 PM (13 years ago)
Author:
ojan@chromium.org
Message:

2011-04-21 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

ValidateChangeLogs doesn't work on SVN
https://bugs.webkit.org/show_bug.cgi?id=59115

svn-create-patch lies about the diff in the working copy by moving
ChangeLog entries to the top of the diff. That's fine on most cases,
but causes problems for ValidateChangeLogs, which is trying validate
the where the ChangeLog entry appears.

I haven't added a test for this change because I couldn't figure out
how to write one. The issue is more of an integration issue, which
we're not really set up to test in our unit testing framework. If this
patch had worked around the output from svn-create-patch, then I could
have tested that we behave correctly on sample svn-create-patch output,
but, in this case, I've removed the dependency on svn-create-patch. I
could test that we behave correctly on "svn diff" output, but we
already have those tests.

  • Scripts/webkitpy/tool/commands/download_unittest.py:
  • Scripts/webkitpy/tool/mocktool.py:
  • Scripts/webkitpy/tool/steps/validatechangelogs.py:
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r84549 r84560  
    3737        * Scripts/webkitpy/layout_tests/port/test.py: Update passing pngs to include a checksum.
    3838        * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:
     39
     402011-04-21  Ojan Vafai  <ojan@chromium.org>
     41
     42        Reviewed by Tony Chang.
     43
     44        final tests for results.html file
     45        https://bugs.webkit.org/show_bug.cgi?id=59150
     46
     47        This gets us close to 100% code coverage. Once this is
     48        checked in, I'll move this file over to LayoutTests/fast/harness
     49        and make it a proper layout test.
     50
     51        * Scripts/webkitpy/layout_tests/layout_package/json_results.html:
     52        * Scripts/webkitpy/layout_tests/layout_package/json_results_test.js:
    3953
    40542011-04-21  Ojan Vafai  <ojan@chromium.org>
  • trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results.html

    r84543 r84560  
    298298            continue;
    299299        }
    300 
    301         // FIXME: put unexpected passes in a separate table.
    302300
    303301        var row = '<td>' + testLink(test) + '</td>';
     
    492490var PixelZoomer = {};
    493491
     492PixelZoomer.showOnDelay = true;
     493
    494494PixelZoomer._createContainer = function(e)
    495495{
     
    541541   
    542542    if (!container) {
    543         PixelZoomer._mouseMoveTimeout = setTimeout(function() {
    544             PixelZoomer._createContainer(e);
    545         }, 200);
     543        if (PixelZoomer.showOnDelay) {
     544            PixelZoomer._mouseMoveTimeout = setTimeout(function() {
     545                PixelZoomer._createContainer(e);
     546            }, 200);
     547            return;
     548        }
     549
     550        PixelZoomer._createContainer(e);
    546551        return;
    547552    }
  • trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_test.js

    r84543 r84560  
    22// You should see a series of PASS lines.
    33
     4var testStyles = document.createElement('style');
     5testStyles.innerText = ".test-pass { color: green; } .test-fail { color: red; }";
     6document.querySelector('head').appendChild(testStyles);
     7
    48var g_testIndex = 0;
    59var g_log = ["You should see a serios of PASS lines."];
    6 var g_currentTestSucceeded;
    710
    811// Make async actually be sync for the sake of simpler testing.
     
    2225        "fixable": 0,
    2326        "num_flaky": 0,
    24         "layout_tests_dir":"/WEBKITROOT",
    25         "uses_expectations_file":true,
    26         "has_pretty_patch":true,
    27         "has_wdiff":true
     27        "layout_tests_dir": "/WEBKITROOT",
     28        "uses_expectations_file": true,
     29        "has_pretty_patch": false,
     30        "has_wdiff": false
    2831    };
    2932}
     
    3942}
    4043
    41 function log(msg)
    42 {
    43     g_log.push('TEST-' + g_testIndex + ': ' + msg);
     44function logPass(msg)
     45{
     46    g_log.push('TEST-' + g_testIndex + ': <span class="test-pass">' + msg + '</span>')
     47}
     48
     49function logFail(msg)
     50{
     51    g_log.push('TEST-' + g_testIndex + ': <span class="test-fail">' + msg + '</span>')
    4452}
    4553
    4654function assertTrue(bool)
    4755{
    48     g_currentTestSucceeded &= bool;
    49     log(bool ? 'PASS' : 'FAIL')
     56    if (bool)
     57        logPass('PASS');
     58    else
     59        logFail('FAIL');
    5060}
    5161
     
    5969        ADD_RESULTS(results);
    6070        originalGeneratePage();
    61         g_currentTestSucceeded = true;
    6271    } catch (e) {
    63         log("FAIL: uncaught exception " + e.toString());
    64         g_currentTestSucceeded = false;
     72        logFail("FAIL: uncaught exception " + e.toString());
    6573    }
    6674   
     
    6876        assertions();
    6977    } catch (e) {
    70         log("FAIL: uncaught exception executing assertions " + e.toString());
    71         g_currentTestSucceeded = false;
     78        logFail("FAIL: uncaught exception executing assertions " + e.toString());
    7279    }
    73 
    74     if (g_currentTestSucceeded)
    75         log('PASS');
     80}
     81
     82function runDefaultSingleRowTest(test, expected, actual, isExpected, textResults, imageResults)
     83{
     84    results = mockResults();
     85    results.tests[test] = mockExpectation(expected, actual);
     86    runSingleRowTest(results, isExpected, textResults, imageResults);
     87}
     88
     89function runSingleRowTest(results, isExpected, textResults, imageResults)
     90{
     91    for (var key in results.tests)
     92        var test = key;
     93    var expected = results.tests[test].expected;
     94    var actual = results.tests[test].actual;
     95    runTest(results, function() {
     96        if (isExpected)
     97            assertTrue(document.querySelector('tbody').className == 'expected');
     98        else
     99            assertTrue(document.querySelector('tbody').className.indexOf('expected') == -1);
     100
     101        assertTrue(document.querySelector('tbody td:nth-child(1)').textContent == '+' + test);
     102        assertTrue(document.querySelector('tbody td:nth-child(2)').textContent == textResults);
     103        assertTrue(document.querySelector('tbody td:nth-child(3)').textContent == imageResults);
     104        assertTrue(document.querySelector('tbody td:nth-child(4)').textContent == actual);
     105        assertTrue(document.querySelector('tbody td:nth-child(5)').textContent == expected);
     106    });
     107   
    76108}
    77109
     
    175207        assertTrue(document.querySelectorAll('.results-row').length == 2);
    176208    });
    177    
     209 
     210    runDefaultSingleRowTest('foo/bar-skip.html', 'TEXT', 'SKIP', true, '', '');
     211    runDefaultSingleRowTest('foo/bar-flaky-fail.html', 'PASS FAIL', 'TEXT', true, 'expected actual diff ', '');
     212    runDefaultSingleRowTest('foo/bar-flaky-fail-unexpected.html', 'PASS TEXT', 'IMAGE', false, '', 'expected actual diff ');
     213    runDefaultSingleRowTest('foo/bar-crash.html', 'TEXT', 'CRASH', false, 'stack ', '');
     214    runDefaultSingleRowTest('foo/bar-audio.html', 'TEXT', 'AUDIO', false, 'expected actual ', '');
     215    runDefaultSingleRowTest('foo/bar-timeout.html', 'TEXT', 'TIMEOUT', false, 'expected actual diff ', '');
     216    runDefaultSingleRowTest('foo/bar-image.html', 'TEXT', 'IMAGE', false, '', 'expected actual diff ');
     217    runDefaultSingleRowTest('foo/bar-image-plus-text.html', 'TEXT', 'IMAGE+TEXT', false, 'expected actual diff ', 'expected actual diff ');
     218
     219    results = mockResults();
     220    results.tests['foo/bar-reftest.html'] = mockExpectation('PASS', 'IMAGE');
     221    results.tests['foo/bar-reftest.html'].is_reftest = true;
     222    runSingleRowTest(results, false, '', 'ref html expected actual diff ');
     223
     224    results = mockResults();
     225    results.tests['foo/bar-reftest-mismatch.html'] = mockExpectation('PASS', 'IMAGE');
     226    results.tests['foo/bar-reftest-mismatch.html'].is_mismatch_reftest = true;
     227    runSingleRowTest(results, false, '', 'ref mismatch html actual ');
     228
     229    results = mockResults();
     230    results.tests['foo/bar-flaky-pass.html'] = mockExpectation('PASS FAIL', 'PASS');
     231    runTest(results, function() {
     232        // FIXME: should a PASS FAIL test that passes go in the unexpected passes table?
     233        assertTrue(document.body.textContent.indexOf('foo/bar-flaky-pass.html') == -1);
     234    });
     235
     236    results = mockResults();
     237    results.tests['foo/bar.html'] = mockExpectation('TEXT', 'TEXT');
     238    results.uses_expectations_file = false;
     239    runTest(results, function() {
     240        assertTrue(document.querySelectorAll('tbody td').length == 4);
     241        assertTrue(document.querySelector('tbody').className.indexOf('expected') == -1);
     242    });
     243
     244    results = mockResults();
     245    results.tests['foo/bar.html'] = mockExpectation('TEXT', 'TEXT');
     246    results.has_pretty_patch = true;
     247    runTest(results, function() {
     248        assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.indexOf('pretty diff') != -1);
     249        assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.indexOf('wdiff') == -1);
     250    });
     251
     252    results = mockResults();
     253    results.tests['foo/bar.html'] = mockExpectation('TEXT', 'TEXT');
     254    results.has_wdiff = true;
     255    runTest(results, function() {
     256        assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.indexOf('wdiff') != -1);
     257        assertTrue(document.querySelector('tbody td:nth-child(2)').textContent.indexOf('pretty diff') == -1);
     258    });
     259   
     260    results = mockResults();
     261    results.tests['foo/bar.html'] = mockExpectation('TEXT', 'PASS');
     262    results.tests['foo/bar-1.html'] = mockExpectation('TEXT', 'CRASH');
     263    results.tests['foo/bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT');
     264    results.tests['foo/bar-3.html'] = mockExpectation('PASS', 'TEXT');
     265    results.tests['foo/bar-2.html'] = mockExpectation('PASS', 'IMAGE');
     266    runTest(results, function() {
     267        // FIXME: This just ensures we don't get a JS error.
     268        // Verify that the sort is correct and that inline expanded expectations
     269        // move along with the test they're attached to.
     270        TableSorter.sortColumn(0);
     271        TableSorter.sortColumn(0);
     272        TableSorter.sortColumn(1);
     273        TableSorter.sortColumn(1);
     274        TableSorter.sortColumn(2);
     275        TableSorter.sortColumn(2);
     276        TableSorter.sortColumn(3);
     277        TableSorter.sortColumn(3);
     278        TableSorter.sortColumn(4);
     279        TableSorter.sortColumn(4);
     280        TableSorter.sortColumn(0);
     281        logPass('PASS');
     282    });
     283
     284    results = mockResults();
     285    results.tests['foo/bar-5.html'] = mockExpectation('TEXT', 'IMAGE+TEXT');
     286    runTest(results, function() {
     287        expandAllExpectations();
     288        var png = document.querySelector('[src*="bar-5-expected.png"]');
     289        var x = png.offsetLeft + 1;
     290        var y = png.offsetTop + 1;
     291        var mockEvent = {
     292            target: png,
     293            clientX: x,
     294            clientY: y
     295        }
     296        PixelZoomer.showOnDelay = false;
     297        PixelZoomer.handleMouseMove(mockEvent);
     298        assertTrue(!!document.querySelector('.pixel-zoom-container'));
     299        assertTrue(document.querySelectorAll('.zoom-image-container').length == 3);
     300    });
     301
    178302    document.body.innerHTML = '<pre>' + g_log.join('\n') + '</pre>';
    179303}
Note: See TracChangeset for help on using the changeset viewer.