Rename some line box functions to be just about lines
[WebKit-https.git] / Tools / BuildSlaveSupport / build.webkit.org-config / wkbuild_unittest.py
1 # Copyright (C) 2010 Apple Inc. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions
5 # are met:
6 # 1.  Redistributions of source code must retain the above copyright
7 #     notice, this list of conditions and the following disclaimer.
8 # 2.  Redistributions in binary form must reproduce the above copyright
9 #     notice, this list of conditions and the following disclaimer in the
10 #     documentation and/or other materials provided with the distribution.
11 #
12 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
13 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
16 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
21 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
23 import unittest
24 import wkbuild
25
26
27 class ShouldBuildTest(unittest.TestCase):
28     _should_build_tests = [
29         (["ChangeLog", "Source/WebCore/ChangeLog", "Source/WebKit2/ChangeLog-2011-02-11"], []),
30         (["GNUmakefile.am", "Source/WebCore/GNUmakefile.am"], ["gtk"]),
31         (["Websites/bugs.webkit.org/foo", "Source/WebCore/bar"], ["*"]),
32         (["Websites/bugs.webkit.org/foo"], []),
33         (["Source/JavaScriptCore/JavaScriptCore.xcodeproj/foo"], ["mac-leopard", "mac-lion",  "mac-mountainlion", "mac-snowleopard"]),
34         (["Source/JavaScriptCore/JavaScriptCore.vcproj/foo", "Source/WebKit2/win/WebKit2.vcproj", "Source/WebKit/win/WebKit.sln", "Tools/WebKitTestRunner/Configurations/WebKitTestRunnerCommon.vsprops"], ["win"]),
35         (["LayoutTests/platform/mac/foo", "Source/WebCore/bar"], ["*"]),
36         (["LayoutTests/foo"], ["*"]),
37         (["LayoutTests/canvas/philip/tests/size.attributes.parse.exp-expected.txt", "LayoutTests/canvas/philip/tests/size.attributes.parse.exp.html"], ["*"]),
38         (["LayoutTests/platform/mac-leopard/foo"], ["mac-leopard"]),
39         (["LayoutTests/platform/mac-lion/foo"], ["mac-leopard", "mac-lion", "mac-snowleopard", "win"]),
40         (["LayoutTests/platform/mac-snowleopard/foo"], ["mac-leopard", "mac-snowleopard"]),
41         (["LayoutTests/platform/mac-wk2/Skipped"], ["mac-lion",  "mac-mountainlion", "mac-snowleopard", "win"]),
42         (["LayoutTests/platform/mac/foo"], ["mac-leopard", "mac-lion", "mac-mountainlion", "mac-snowleopard", "win"]),
43         (["LayoutTests/platform/win-xp/foo"], ["win"]),
44         (["LayoutTests/platform/win-wk2/foo"], ["win"]),
45         (["LayoutTests/platform/win/foo"], ["win"]),
46         (["Source/WebCore.exp.in", "Source/WebKit/mac/WebKit.exp"], ["mac-leopard", "mac-lion",  "mac-mountainlion", "mac-snowleopard"]),
47         (["Source/WebCore/mac/foo"], ["mac-leopard", "mac-lion",  "mac-mountainlion", "mac-snowleopard"]),
48         (["Source/WebCore/win/foo"], ["win"]),
49         (["Source/WebCore/platform/graphics/gpu/foo"], ["mac-leopard", "mac-lion",  "mac-mountainlion", "mac-snowleopard"]),
50         (["Source/WebCore/platform/wx/wxcode/win/foo"], []),
51         (["Source/WebCore/rendering/RenderThemeMac.mm", "Source/WebCore/rendering/RenderThemeMac.h"], ["mac-leopard", "mac-lion",  "mac-mountainlion", "mac-snowleopard"]),
52         (["Source/WebCore/rendering/RenderThemeWinCE.h"], []),
53         (["Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksViewer.js"], []),
54     ]
55
56     def test_should_build(self):
57         for files, platforms in self._should_build_tests:
58             # FIXME: We should test more platforms here once
59             # wkbuild._should_file_trigger_build is implemented for them.
60             for platform in ["mac-leopard", "mac-lion",  "mac-mountainlion", "mac-snowleopard", "win"]:
61                 should_build = platform in platforms or "*" in platforms
62                 self.assertEqual(wkbuild.should_build(platform, files), should_build, "%s should%s have built but did%s (files: %s)" % (platform, "" if should_build else "n't", "n't" if should_build else "", str(files)))
63
64 # FIXME: We should run this file as part of test-rm .
65 # Unfortunately test-rm  currently requires that unittests
66 # be located in a directory with a valid module name.
67 # 'build.webkit.org-config' is not a valid module name (due to '.' and '-')
68 # so for now this is a stand-alone test harness.
69 if __name__ == '__main__':
70     unittest.main()