~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Tools/Scripts/webkitpy/layout_tests/port/efl.py

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2011 ProFUSION Embedded Systems. All rights reserved.
 
2
# Copyright (C) 2011 Samsung Electronics. All rights reserved.
 
3
# Copyright (C) 2012 Intel Corporation
 
4
#
 
5
# Redistribution and use in source and binary forms, with or without
 
6
# modification, are permitted provided that the following conditions are
 
7
# met:
 
8
#
 
9
#     * Redistributions of source code must retain the above copyright
 
10
# notice, this list of conditions and the following disclaimer.
 
11
#     * Redistributions in binary form must reproduce the above
 
12
# copyright notice, this list of conditions and the following disclaimer
 
13
# in the documentation and/or other materials provided with the
 
14
# distribution.
 
15
#
 
16
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 
17
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 
18
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 
19
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 
20
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
21
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 
22
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
23
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 
24
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
25
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
26
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
27
 
 
28
"""WebKit Efl implementation of the Port interface."""
 
29
 
 
30
import os
 
31
 
 
32
from webkitpy.layout_tests.models.test_configuration import TestConfiguration
 
33
from webkitpy.layout_tests.port.base import Port
 
34
from webkitpy.layout_tests.port.pulseaudio_sanitizer import PulseAudioSanitizer
 
35
from webkitpy.layout_tests.port.xvfbdriver import XvfbDriver
 
36
 
 
37
class EflPort(Port, PulseAudioSanitizer):
 
38
    port_name = 'efl'
 
39
 
 
40
    def __init__(self, *args, **kwargs):
 
41
        super(EflPort, self).__init__(*args, **kwargs)
 
42
 
 
43
        self._jhbuild_wrapper_path = self.path_from_webkit_base('Tools', 'efl', 'run-with-jhbuild')
 
44
 
 
45
        self.set_option_default('wrapper', self._jhbuild_wrapper_path)
 
46
        self.webprocess_cmd_prefix = self.get_option('webprocess_cmd_prefix')
 
47
 
 
48
    def _port_flag_for_scripts(self):
 
49
        return "--efl"
 
50
 
 
51
    def setup_test_run(self):
 
52
        self._unload_pulseaudio_module()
 
53
 
 
54
    def setup_environ_for_server(self, server_name=None):
 
55
        env = super(EflPort, self).setup_environ_for_server(server_name)
 
56
        # If DISPLAY environment variable is unset in the system
 
57
        # e.g. on build bot, remove DISPLAY variable from the dictionary
 
58
        if not 'DISPLAY' in os.environ:
 
59
            del env['DISPLAY']
 
60
        env['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('lib', 'libTestRunnerInjectedBundle.so')
 
61
        env['TEST_RUNNER_PLUGIN_PATH'] = self._build_path('lib')
 
62
        if self.webprocess_cmd_prefix:
 
63
            env['WEB_PROCESS_CMD_PREFIX'] = self.webprocess_cmd_prefix
 
64
 
 
65
        return env
 
66
 
 
67
    def default_timeout_ms(self):
 
68
        # Tests run considerably slower under gdb
 
69
        # or valgrind.
 
70
        if self.get_option('webprocess_cmd_prefix'):
 
71
            return 350 * 1000
 
72
        return super(EflPort, self).default_timeout_ms()
 
73
 
 
74
    def clean_up_test_run(self):
 
75
        super(EflPort, self).clean_up_test_run()
 
76
        self._restore_pulseaudio_module()
 
77
 
 
78
    def _generate_all_test_configurations(self):
 
79
        return [TestConfiguration(version=self._version, architecture='x86', build_type=build_type) for build_type in self.ALL_BUILD_TYPES]
 
80
 
 
81
    def _driver_class(self):
 
82
        return XvfbDriver
 
83
 
 
84
    def _path_to_driver(self):
 
85
        return self._build_path('bin', self.driver_name())
 
86
 
 
87
    def _path_to_image_diff(self):
 
88
        return self._build_path('bin', 'ImageDiff')
 
89
 
 
90
    def _image_diff_command(self, *args, **kwargs):
 
91
        return [self._jhbuild_wrapper_path] + super(EflPort, self)._image_diff_command(*args, **kwargs)
 
92
 
 
93
    def _path_to_webcore_library(self):
 
94
        static_path = self._build_path('lib', 'libwebcore_efl.a')
 
95
        dyn_path = self._build_path('lib', 'libwebcore_efl.so')
 
96
        return static_path if self._filesystem.exists(static_path) else dyn_path
 
97
 
 
98
    def _search_paths(self):
 
99
        search_paths = []
 
100
        if self.get_option('webkit_test_runner'):
 
101
            search_paths.append(self.port_name + '-wk2')
 
102
            search_paths.append('wk2')
 
103
        else:
 
104
            search_paths.append(self.port_name + '-wk1')
 
105
        search_paths.append(self.port_name)
 
106
        return search_paths
 
107
 
 
108
    def default_baseline_search_path(self):
 
109
        return map(self._webkit_baseline_path, self._search_paths())
 
110
 
 
111
    def expectations_files(self):
 
112
        # FIXME: We should be able to use the default algorithm here.
 
113
        return list(reversed([self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in self._search_paths()]))
 
114
 
 
115
    def show_results_html_file(self, results_filename):
 
116
        # FIXME: We should find a way to share this implmentation with Gtk,
 
117
        # or teach run-launcher how to call run-safari and move this down to WebKitPort.
 
118
        run_launcher_args = ["file://%s" % results_filename]
 
119
        if self.get_option('webkit_test_runner'):
 
120
            run_launcher_args.append('-2')
 
121
        # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"]
 
122
        # FIXME: old-run-webkit-tests converted results_filename path for cygwin.
 
123
        self._run_script("run-launcher", run_launcher_args)