efl.py 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. """WebKit Efl implementation of the Port interface."""
  28. import os
  29. from webkitpy.layout_tests.models.test_configuration import TestConfiguration
  30. from webkitpy.port.base import Port
  31. from webkitpy.port.pulseaudio_sanitizer import PulseAudioSanitizer
  32. from webkitpy.port.xvfbdriver import XvfbDriver
  33. class EflPort(Port):
  34. port_name = 'efl'
  35. def __init__(self, *args, **kwargs):
  36. super(EflPort, self).__init__(*args, **kwargs)
  37. self._jhbuild_wrapper_path = [self.path_from_webkit_base('Tools', 'jhbuild', 'jhbuild-wrapper'), '--efl', 'run']
  38. self.set_option_default('wrapper', ' '.join(self._jhbuild_wrapper_path))
  39. self.webprocess_cmd_prefix = self.get_option('webprocess_cmd_prefix')
  40. self._pulseaudio_sanitizer = PulseAudioSanitizer()
  41. def _port_flag_for_scripts(self):
  42. return "--efl"
  43. def setup_test_run(self):
  44. super(EflPort, self).setup_test_run()
  45. self._pulseaudio_sanitizer.unload_pulseaudio_module()
  46. def setup_environ_for_server(self, server_name=None):
  47. env = super(EflPort, self).setup_environ_for_server(server_name)
  48. # If DISPLAY environment variable is unset in the system
  49. # e.g. on build bot, remove DISPLAY variable from the dictionary
  50. if not 'DISPLAY' in os.environ:
  51. del env['DISPLAY']
  52. env['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('lib', 'libTestRunnerInjectedBundle.so')
  53. env['TEST_RUNNER_PLUGIN_PATH'] = self._build_path('lib')
  54. # Silence GIO warnings about using the "memory" GSettings backend.
  55. env['GSETTINGS_BACKEND'] = 'memory'
  56. if self.webprocess_cmd_prefix:
  57. env['WEB_PROCESS_CMD_PREFIX'] = self.webprocess_cmd_prefix
  58. return env
  59. def default_timeout_ms(self):
  60. # Tests run considerably slower under gdb
  61. # or valgrind.
  62. if self.get_option('webprocess_cmd_prefix'):
  63. return 350 * 1000
  64. return super(EflPort, self).default_timeout_ms()
  65. def clean_up_test_run(self):
  66. super(EflPort, self).clean_up_test_run()
  67. self._pulseaudio_sanitizer.restore_pulseaudio_module()
  68. def _generate_all_test_configurations(self):
  69. return [TestConfiguration(version=self._version, architecture='x86', build_type=build_type) for build_type in self.ALL_BUILD_TYPES]
  70. def _driver_class(self):
  71. return XvfbDriver
  72. def _path_to_driver(self):
  73. return self._build_path('bin', self.driver_name())
  74. def _path_to_image_diff(self):
  75. return self._build_path('bin', 'ImageDiff')
  76. def _image_diff_command(self, *args, **kwargs):
  77. return self._jhbuild_wrapper_path + super(EflPort, self)._image_diff_command(*args, **kwargs)
  78. def _path_to_webcore_library(self):
  79. static_path = self._build_path('lib', 'libwebcore_efl.a')
  80. dyn_path = self._build_path('lib', 'libwebcore_efl.so')
  81. return static_path if self._filesystem.exists(static_path) else dyn_path
  82. def _search_paths(self):
  83. search_paths = []
  84. if self.get_option('webkit_test_runner'):
  85. search_paths.append(self.port_name + '-wk2')
  86. search_paths.append('wk2')
  87. else:
  88. search_paths.append(self.port_name + '-wk1')
  89. search_paths.append(self.port_name)
  90. return search_paths
  91. def default_baseline_search_path(self):
  92. return map(self._webkit_baseline_path, self._search_paths())
  93. def _port_specific_expectations_files(self):
  94. # FIXME: We should be able to use the default algorithm here.
  95. return list(reversed([self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in self._search_paths()]))
  96. def show_results_html_file(self, results_filename):
  97. # FIXME: We should find a way to share this implmentation with Gtk,
  98. # or teach run-launcher how to call run-safari and move this down to WebKitPort.
  99. run_launcher_args = ["file://%s" % results_filename]
  100. if self.get_option('webkit_test_runner'):
  101. run_launcher_args.append('-2')
  102. # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"]
  103. # FIXME: old-run-webkit-tests converted results_filename path for cygwin.
  104. self._run_script("run-launcher", run_launcher_args)
  105. def check_sys_deps(self, needs_http):
  106. return super(EflPort, self).check_sys_deps(needs_http) and XvfbDriver.check_xvfb(self)