Update tools and configurations after renaming Source/WebKit to Source/WebKitLegacy.
[WebKit-https.git] / Tools / BuildSlaveSupport / build.webkit.org-config / wkbuild_unittest.py
1 # Copyright (C) 2010, 2015 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         (["Websites/bugs.webkit.org/foo", "Source/WebCore/bar"], ["*"]),
31         (["Websites/bugs.webkit.org/foo"], []),
32         (["Source/JavaScriptCore/JavaScriptCore.xcodeproj/foo"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra", "ios-10", "ios-simulator-10"]),
33         (["Source/JavaScriptCore/Configurations/Base.xcconfig"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra", "ios-10", "ios-simulator-10"]),
34         (["Source/JavaScriptCore/JavaScriptCore.vcproj/foo", "Source/WebKit2/win/WebKit2.vcproj", "Source/WebKitLegacy/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-yosemite/foo"], ["mac-yosemite"]),
39         (["LayoutTests/platform/mac-elcapitan/foo"], ["mac-yosemite", "mac-elcapitan"]),
40         (["LayoutTests/platform/mac-sierra/foo"], ["mac-yosemite", "mac-elcapitan", "mac-sierra"]),
41         (["LayoutTests/platform/mac-highsierra/foo"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra"]),
42         (["LayoutTests/platform/ios-simulator/foo"], ["ios-10", "ios-simulator-10"]),
43         (["LayoutTests/platform/ios-simulator-wk1/foo"], ["ios-10", "ios-simulator-10"]),
44         (["LayoutTests/platform/ios-simulator-wk2/foo"], ["ios-10", "ios-simulator-10"]),
45         (["LayoutTests/platform/wk2/Skipped"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra", "ios-10", "ios-simulator-10"]),
46         (["LayoutTests/platform/mac-wk2/Skipped"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra"]),
47         (["LayoutTests/platform/mac-wk1/compositing/tiling/transform-origin-tiled-expected.txt"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra"]),
48         (["LayoutTests/platform/mac/foo"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra", "win"]),
49         (["LayoutTests/platform/mac-wk2/platform/mac/editing/spelling/autocorrection-contraction-expected.txt"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra"]),
50         (["LayoutTests/platform/win-xp/foo"], ["win"]),
51         (["LayoutTests/platform/win-wk1/foo"], ["win"]),
52         (["LayoutTests/platform/win/foo"], ["win"]),
53         (["LayoutTests/platform/spi/cocoa/foo"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra", "ios-10", "ios-simulator-10"]),
54         (["LayoutTests/platform/spi/cf/foo"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra", "win", "ios-10", "ios-simulator-10"]),
55         (["Source/WebKitLegacy/mac/WebKit.mac.exp"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra"]),
56         (["Source/WebKitLegacy/ios/WebKit.iOS.exp"], ["ios-10", "ios-simulator-10"]),
57         (["Source/Dummy/foo.exp"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra", "ios-10", "ios-simulator-10"]),
58         (["Source/WebCore/ios/foo"], ["ios-10", "ios-simulator-10"]),
59         (["Source/WebCore/mac/foo"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra"]),
60         (["Source/WebCore/win/foo"], ["win"]),
61         (["Source/WebCore/bridge/objc/objc_class.mm"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra", "ios-10", "ios-simulator-10"]),
62         (["Source/WebCore/platform/wx/wxcode/win/foo"], []),
63         (["Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm"], ["ios-10", "ios-simulator-10"]),
64         (["Source/WebCore/rendering/RenderThemeMac.mm", "Source/WebCore/rendering/RenderThemeMac.h"], ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra"]),
65         (["Source/WebCore/rendering/RenderThemeIOS.mm", "Source/WebCore/rendering/RenderThemeIOS.h"], ["ios-10", "ios-simulator-10"]),
66         (["Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/LeaksViewer.js"], []),
67     ]
68
69     def test_should_build(self):
70         for files, platforms in self._should_build_tests:
71             # FIXME: We should test more platforms here once
72             # wkbuild._should_file_trigger_build is implemented for them.
73             for platform in ["mac-yosemite", "mac-elcapitan", "mac-sierra", "mac-highsierra", "win", "ios-10", "ios-simulator-10"]:
74                 should_build = platform in platforms or "*" in platforms
75                 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)))
76
77 # FIXME: We should run this file as part of test-rm .
78 # Unfortunately test-rm  currently requires that unittests
79 # be located in a directory with a valid module name.
80 # 'build.webkit.org-config' is not a valid module name (due to '.' and '-')
81 # so for now this is a stand-alone test harness.
82 if __name__ == '__main__':
83     unittest.main()