Changeset 101273 in webkit


Ignore:
Timestamp:
Nov 28, 2011, 12:21:23 PM (14 years ago)
Author:
fsamuel@chromium.org
Message:

[Chromium] Fix broken DRT build for Aura Linux
https://bugs.webkit.org/show_bug.cgi?id=72667

Reviewed by Tony Chang.

Source/WebKit/chromium:

  • WebKit.gyp:

Tools:

DRT now builds for Aura Linux. This, more or less, shares the same code as Android.

The following changes have been made:

  1. Renamed TestShellAndroid to TestShellLinux.
  2. Stub code moved added in TestShellStub that will only compile on non-GTK Linux builds.
  3. Code common to Gtk, Aura, and Android moved to TestShellLinux.
  • DumpRenderTree/DumpRenderTree.gypi:
  • DumpRenderTree/chromium/EventSender.cpp:

(EventSender::keyDown):

  • DumpRenderTree/chromium/TestShellAndroid.cpp: Removed.
  • DumpRenderTree/chromium/TestShellGtk.cpp:
  • DumpRenderTree/chromium/TestShellLinux.cpp: Copied from Tools/DumpRenderTree/chromium/TestShellGtk.cpp.

(AlarmHandler):
(TestShell::waitTestFinished):
(setupFontconfig):
(platformInit):

  • DumpRenderTree/chromium/TestShellStub.cpp: Added.

(checkLayoutTestSystemDependencies):
(openStartupDialog):

Location:
trunk
Files:
1 added
1 deleted
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/chromium/ChangeLog

    r101267 r101273  
     12011-11-28  Fady Samuel  <fsamuel@chromium.org>
     2
     3        [Chromium] Fix broken DRT build for Aura Linux
     4        https://bugs.webkit.org/show_bug.cgi?id=72667
     5
     6        Reviewed by Tony Chang.
     7
     8        * WebKit.gyp:
     9
    1102011-11-28  Adam Barth  <abarth@webkit.org>
    211
  • trunk/Source/WebKit/chromium/WebKit.gyp

    r101156 r101273  
    758758                }],
    759759                ['toolkit_uses_gtk == 1', {
     760                    'defines': [
     761                        'WTF_USE_GTK=1'
     762                    ],
    760763                    'dependencies': [
    761764                        '<(chromium_src_dir)/build/linux/system.gyp:gtk',
  • trunk/Tools/ChangeLog

    r101266 r101273  
     12011-11-28  Fady Samuel  <fsamuel@chromium.org>
     2
     3        [Chromium] Fix broken DRT build for Aura Linux
     4        https://bugs.webkit.org/show_bug.cgi?id=72667
     5
     6        Reviewed by Tony Chang.
     7
     8        DRT now builds for Aura Linux. This, more or less, shares the same code as Android.
     9
     10        The following changes have been made:
     11
     12          1. Renamed TestShellAndroid to TestShellLinux.
     13          2. Stub code moved added in TestShellStub that will only compile on non-GTK Linux builds.
     14          3. Code common to Gtk, Aura, and Android moved to TestShellLinux.
     15
     16        * DumpRenderTree/DumpRenderTree.gypi:
     17        * DumpRenderTree/chromium/EventSender.cpp:
     18        (EventSender::keyDown):
     19        * DumpRenderTree/chromium/TestShellAndroid.cpp: Removed.
     20        * DumpRenderTree/chromium/TestShellGtk.cpp:
     21        * DumpRenderTree/chromium/TestShellLinux.cpp: Copied from Tools/DumpRenderTree/chromium/TestShellGtk.cpp.
     22        (AlarmHandler):
     23        (TestShell::waitTestFinished):
     24        (setupFontconfig):
     25        (platformInit):
     26        * DumpRenderTree/chromium/TestShellStub.cpp: Added.
     27        (checkLayoutTestSystemDependencies):
     28        (openStartupDialog):
     29
    1302011-11-28  Eric Seidel  <eric@webkit.org>
    231
  • trunk/Tools/DumpRenderTree/DumpRenderTree.gypi

    r101065 r101273  
    3535            'chromium/TestShell.cpp',
    3636            'chromium/TestShell.h',
    37             'chromium/TestShellAndroid.cpp',
     37            'chromium/TestShellLinux.cpp',
    3838            'chromium/TestShellGtk.cpp',
    3939            'chromium/TestShellMac.mm',
     
    7474        ],
    7575        'conditions': [
     76            ['(OS=="linux" and toolkit_uses_gtk!=1) or OS=="android"', {
     77                'drt_files': [
     78                    'chromium/TestShellStub.cpp',
     79                ],
     80            }],
    7681            ['OS=="win"', {
    7782                'drt_files': [
  • trunk/Tools/DumpRenderTree/chromium/EventSender.cpp

    r100837 r101273  
    577577    eventDown.modifiers = 0;
    578578    eventDown.windowsKeyCode = code;
    579 #if OS(LINUX)
     579#if OS(LINUX) && USE(GTK)
    580580    eventDown.nativeKeyCode = webkit_support::NativeKeyCodeForWindowsKeyCode(code, needsShiftKeyModifier);
    581581#endif
  • trunk/Tools/DumpRenderTree/chromium/TestShellGtk.cpp

    r94862 r101273  
    3737#include <signal.h>
    3838
    39 static void AlarmHandler(int)
    40 {
    41     // If the alarm alarmed, kill the process since we have a really bad hang.
    42     puts("\n#TEST_TIMED_OUT\n");
    43     puts("#EOF\n");
    44     fflush(stdout);
    45     exit(0);
    46 }
    47 
    48 static void setupFontconfig()
    49 {
    50     // We wish to make the layout tests reproducable with respect to fonts. Skia
    51     // uses fontconfig to resolve font family names from WebKit into actual font
    52     // files found on the current system. This means that fonts vary based on the
    53     // system and also on the fontconfig configuration.
    54     //
    55     // To avoid this we initialise fontconfig here and install a configuration
    56     // which only knows about a few, select, fonts.
    57 
    58     // We have fontconfig parse a config file from our resources file. This
    59     // sets a number of aliases ("sans"->"Arial" etc), but doesn't include any
    60     // font directories.
    61     FcInit();
    62 
    63     char drtPath[PATH_MAX + 1];
    64     int drtPathSize = readlink("/proc/self/exe", drtPath, PATH_MAX);
    65     if (drtPathSize < 0 || drtPathSize > PATH_MAX) {
    66         fputs("Unable to resolve /proc/self/exe.", stderr);
    67         exit(1);
    68     }
    69     drtPath[drtPathSize] = 0;
    70     std::string drtDirPath(drtPath);
    71     size_t lastPathPos = drtDirPath.rfind("/");
    72     ASSERT(lastPathPos != std::string::npos);
    73     drtDirPath.erase(lastPathPos + 1);
    74 
    75     FcConfig* fontcfg = FcConfigCreate();
    76     std::string fontconfigPath = drtDirPath + "fonts.conf";
    77     if (!FcConfigParseAndLoad(fontcfg, reinterpret_cast<const FcChar8*>(fontconfigPath.c_str()), true)) {
    78         fputs("Failed to parse fontconfig config file\n", stderr);
    79         exit(1);
    80     }
    81 
    82     // This is the list of fonts that fontconfig will know about. It
    83     // will try its best to match based only on the fonts here in. The
    84     // paths are where these fonts are found on our Ubuntu boxes.
    85     static const char *const fonts[] = {
    86         "/usr/share/fonts/truetype/kochi/kochi-gothic.ttf",
    87         "/usr/share/fonts/truetype/kochi/kochi-mincho.ttf",
    88         "/usr/share/fonts/truetype/msttcorefonts/Arial.ttf",
    89         "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf",
    90         "/usr/share/fonts/truetype/msttcorefonts/Arial_Bold_Italic.ttf",
    91         "/usr/share/fonts/truetype/msttcorefonts/Arial_Italic.ttf",
    92         "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS.ttf",
    93         "/usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf",
    94         "/usr/share/fonts/truetype/msttcorefonts/Courier_New.ttf",
    95         "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold.ttf",
    96         "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Bold_Italic.ttf",
    97         "/usr/share/fonts/truetype/msttcorefonts/Courier_New_Italic.ttf",
    98         "/usr/share/fonts/truetype/msttcorefonts/Georgia.ttf",
    99         "/usr/share/fonts/truetype/msttcorefonts/Georgia_Bold.ttf",
    100         "/usr/share/fonts/truetype/msttcorefonts/Georgia_Bold_Italic.ttf",
    101         "/usr/share/fonts/truetype/msttcorefonts/Georgia_Italic.ttf",
    102         "/usr/share/fonts/truetype/msttcorefonts/Impact.ttf",
    103         "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS.ttf",
    104         "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold.ttf",
    105         "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Bold_Italic.ttf",
    106         "/usr/share/fonts/truetype/msttcorefonts/Trebuchet_MS_Italic.ttf",
    107         "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf",
    108         "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold.ttf",
    109         "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Bold_Italic.ttf",
    110         "/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman_Italic.ttf",
    111         "/usr/share/fonts/truetype/msttcorefonts/Verdana.ttf",
    112         "/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold.ttf",
    113         "/usr/share/fonts/truetype/msttcorefonts/Verdana_Bold_Italic.ttf",
    114         "/usr/share/fonts/truetype/msttcorefonts/Verdana_Italic.ttf",
    115         "/usr/share/fonts/truetype/thai/Garuda.ttf",
    116         // The DejaVuSans font is used by the css2.1 tests.
    117         "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf",
    118         "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_hi.ttf",
    119         "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_ta.ttf",
    120         "/usr/share/fonts/truetype/ttf-indic-fonts-core/MuktiNarrow.ttf",
    121     };
    122     for (size_t i = 0; i < arraysize(fonts); ++i) {
    123         if (access(fonts[i], R_OK)) {
    124             fprintf(stderr, "You are missing %s. Try re-running build/install-build-deps.sh. Also see "
    125                             "http://code.google.com/p/chromium/wiki/LayoutTestsLinux",
    126                             fonts[i]);
    127             exit(1);
    128         }
    129         if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) fonts[i])) {
    130             fprintf(stderr, "Failed to load font %s\n", fonts[i]);
    131             exit(1);
    132         }
    133     }
    134 
    135     // We special case these fonts because they're only needed in a
    136     // few layout tests.
    137     static const char* const optionalFonts[] = {
    138         "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_pa.ttf",
    139     };
    140     for (size_t i = 0; i < arraysize(optionalFonts); ++i) {
    141         const char* font = optionalFonts[i];
    142 
    143         // This font changed paths across Ubuntu releases, so try checking in both locations.
    144         if (!strcmp(font, "/usr/share/fonts/truetype/ttf-indic-fonts-core/lohit_pa.ttf")
    145             && access(font, R_OK) < 0)
    146             font = "/usr/share/fonts/truetype/ttf-punjabi-fonts/lohit_pa.ttf";
    147 
    148         if (access(font, R_OK) < 0) {
    149             fprintf(stderr, "You are missing %s. Without this, some layout tests may fail. "
    150                             "See http://code.google.com/p/chromium/wiki/LayoutTestsLinux "
    151                             "for more.\n", font);
    152         } else if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) font)) {
    153             fprintf(stderr, "Failed to load font %s\n", font);
    154             exit(1);
    155         }
    156     }
    157 
    158     // Also load the layout-test-specific "Ahem" font.
    159     std::string ahemPath = drtDirPath + "AHEM____.TTF";
    160     if (!FcConfigAppFontAddFile(fontcfg, reinterpret_cast<const FcChar8*>(ahemPath.c_str()))) {
    161         fprintf(stderr, "Failed to load font %s\n", ahemPath.c_str());
    162         exit(1);
    163     }
    164 
    165     if (!FcConfigSetCurrent(fontcfg)) {
    166         fputs("Failed to set the default font configuration\n", stderr);
    167         exit(1);
    168     }
    169 }
    170 
    171 void TestShell::waitTestFinished()
    172 {
    173     ASSERT(!m_testIsPending);
    174     m_testIsPending = true;
    175 
    176     // Install an alarm signal handler that will kill us if we time out.
    177     struct sigaction alarmAction;
    178     alarmAction.sa_handler = AlarmHandler;
    179     sigemptyset(&alarmAction.sa_mask);
    180     alarmAction.sa_flags = 0;
    181 
    182     struct sigaction oldAction;
    183     sigaction(SIGALRM, &alarmAction, &oldAction);
    184     alarm(layoutTestTimeoutForWatchDog() / 1000);
    185 
    186     // TestFinished() will post a quit message to break this loop when the page
    187     // finishes loading.
    188     while (m_testIsPending)
    189         webkit_support::RunMessageLoop();
    190 
    191     // Remove the alarm.
    192     alarm(0);
    193     sigaction(SIGALRM, &oldAction, 0);
    194 }
    195 
    196 void platformInit(int* argc, char*** argv)
    197 {
    198     // FIXME: It's better call gtk_init() only when we run plugin tests.
    199     // See http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/633ea167cde196ca#
    200     gtk_init(argc, argv);
    201 
    202     setupFontconfig();
    203 }
    20439
    20540void openStartupDialog()
  • trunk/Tools/DumpRenderTree/chromium/TestShellLinux.cpp

    r101272 r101273  
    11/*
    2  * Copyright (C) 2010 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3232#include "TestShell.h"
    3333
     34#include "SkTypeface.h"
     35#include "WebView.h"
    3436#include "webkit/support/webkit_support.h"
     37
     38#if !OS(ANDROID)
    3539#include <fontconfig/fontconfig.h>
    36 #include <gtk/gtk.h>
     40#endif
    3741#include <signal.h>
     42#include <unistd.h>
    3843
    3944static void AlarmHandler(int)
     
    4651}
    4752
     53void TestShell::waitTestFinished()
     54{
     55    ASSERT(!m_testIsPending);
     56    m_testIsPending = true;
     57
     58    // Install an alarm signal handler that will kill us if we time out.
     59    struct sigaction alarmAction;
     60    alarmAction.sa_handler = AlarmHandler;
     61    sigemptyset(&alarmAction.sa_mask);
     62    alarmAction.sa_flags = 0;
     63
     64    struct sigaction oldAction;
     65    sigaction(SIGALRM, &alarmAction, &oldAction);
     66    alarm(layoutTestTimeoutForWatchDog() / 1000);
     67
     68    // TestFinished() will post a quit message to break this loop when the page
     69    // finishes loading.
     70    while (m_testIsPending)
     71        webkit_support::RunMessageLoop();
     72
     73    // Remove the alarm.
     74    alarm(0);
     75    sigaction(SIGALRM, &oldAction, 0);
     76}
     77
     78#if !OS(ANDROID)
    4879static void setupFontconfig()
    4980{
     
    168199    }
    169200}
    170 
    171 void TestShell::waitTestFinished()
    172 {
    173     ASSERT(!m_testIsPending);
    174     m_testIsPending = true;
    175 
    176     // Install an alarm signal handler that will kill us if we time out.
    177     struct sigaction alarmAction;
    178     alarmAction.sa_handler = AlarmHandler;
    179     sigemptyset(&alarmAction.sa_mask);
    180     alarmAction.sa_flags = 0;
    181 
    182     struct sigaction oldAction;
    183     sigaction(SIGALRM, &alarmAction, &oldAction);
    184     alarm(layoutTestTimeoutForWatchDog() / 1000);
    185 
    186     // TestFinished() will post a quit message to break this loop when the page
    187     // finishes loading.
    188     while (m_testIsPending)
    189         webkit_support::RunMessageLoop();
    190 
    191     // Remove the alarm.
    192     alarm(0);
    193     sigaction(SIGALRM, &oldAction, 0);
    194 }
     201#endif // !OS(ANDROID)
    195202
    196203void platformInit(int* argc, char*** argv)
     
    198205    // FIXME: It's better call gtk_init() only when we run plugin tests.
    199206    // See http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/633ea167cde196ca#
     207#if USE(GTK)
    200208    gtk_init(argc, argv);
    201 
     209#endif
     210
     211#if !OS(ANDROID)
    202212    setupFontconfig();
    203 }
    204 
    205 void openStartupDialog()
    206 {
    207     GtkWidget* dialog = gtk_message_dialog_new(
    208         0, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Attach to me?");
    209     gtk_window_set_title(GTK_WINDOW(dialog), "DumpRenderTree");
    210     gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop.
    211     gtk_widget_destroy(dialog);
    212 }
    213 
    214 bool checkLayoutTestSystemDependencies()
    215 {
    216     return true;
    217 }
     213#endif
     214}
     215
Note: See TracChangeset for help on using the changeset viewer.