| #!/usr/bin/env python3 |
| # |
| # Copyright (C) 2017, 2021 Igalia S.L. |
| # |
| # This library is free software; you can redistribute it and/or |
| # modify it under the terms of the GNU Library General Public |
| # License as published by the Free Software Foundation; either |
| # version 2 of the License, or (at your option) any later version. |
| # |
| # This library is distributed in the hope that it will be useful, |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| # Library General Public License for more details. |
| # |
| # You should have received a copy of the GNU Library General Public License |
| # along with this library; see the file COPYING.LIB. If not, write to |
| # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| # Boston, MA 02110-1301, USA. |
| |
| import logging |
| import os |
| import sys |
| |
| from webkitpy.port.linux_container_sdk_utils import maybe_use_container_sdk_root_dir |
| maybe_use_container_sdk_root_dir() |
| |
| top_level_directory = os.path.normpath(os.path.join(os.path.dirname(__file__), "..", "..")) |
| sys.path.insert(0, os.path.join(top_level_directory, "Tools", "jhbuild")) |
| sys.path.insert(0, os.path.join(top_level_directory, "Tools", "glib")) |
| import common |
| import jhbuildutils |
| from api_test_runner import TestRunner, create_option_parser, get_runner_args |
| |
| class WPETestRunner(TestRunner): |
| TestRunner.TEST_TARGETS = [ "WPE", "WPEPlatform", "WPEQt", "TestWebKit", "TestJSC", "TestWTF", "TestWebCore", "TestJavaScriptCore" ] |
| |
| def __init__(self, options, tests=[]): |
| super(WPETestRunner, self).__init__("wpe", options, tests) |
| |
| def is_glib_test(self, test_program): |
| return os.path.basename(os.path.dirname(test_program)) in ["WPE", "WPEPlatform"] or os.path.basename(test_program) in ["TestJSC"] |
| |
| def is_google_test(self, test_program): |
| return os.path.basename(test_program) in ["TestWebKit", "TestWTF", "TestWebCore", "TestJavaScriptCore"] |
| |
| def is_qt_test(self, test_program): |
| return os.path.basename(os.path.dirname(test_program)) == "WPEQt" |
| |
| def is_wpe_platform_test(self, test_program): |
| return os.path.basename(os.path.dirname(test_program)) == "WPEPlatform" |
| |
| def is_wpe_platform_wayland_test(self, test_program): |
| return self.is_wpe_platform_test(test_program) and "Wayland" in os.path.basename(test_program) |
| |
| if __name__ == "__main__": |
| runner_args = get_runner_args(sys.argv) |
| if not jhbuildutils.enter_jhbuild_environment_if_available("wpe") and os.environ.get('WEBKIT_BUILD_USE_SYSTEM_LIBRARIES') != '1': |
| print('***') |
| print('*** Warning: jhbuild environment not present.') |
| print('*** Run update-webkitwpe-libs before build-webkit to ensure proper testing.') |
| print('***') |
| |
| option_parser = create_option_parser() |
| option_parser.add_option('--display-server', choices=['headless', 'wayland'], default='headless', |
| help='"headless": Use headless view backend. "wayland": Use the current wayland session.') |
| option_parser.add_option('--wpe-legacy-api', action="store_true", default=False, |
| help='Use WPE legacy API.') |
| |
| args = sys.argv[1:] |
| options, args = option_parser.parse_args(args) |
| |
| logging.basicConfig(level=logging.INFO, format="%(message)s") |
| |
| runner = WPETestRunner(options, args) |
| sys.exit(runner.run_tests()) |