Title: [248965] trunk/Tools
Revision
248965
Author
[email protected]
Date
2019-08-21 14:49:00 -0700 (Wed, 21 Aug 2019)

Log Message

[GTK][WPE] Make debug-test-runner work
https://bugs.webkit.org/show_bug.cgi?id=193576

Reviewed by Michael Catanzaro.

* Scripts/webkitdirs.pm:
(wrapperPrefixIfNeeded): Only add the wrapper prefix when not running inside a Flatpak sandbox.
(setupUnixWebKitEnvironment): Added, sets TEST_RUNNER_INJECTED_BUNDLE_FILENAME and
TEST_RUNNER_TEST_PLUGIN_PATH in the environment.
(execUnixAppForDebugging): Added.
(debugWebKitTestRunner): Alternatively, use execUnixAppForDebugging() for the WPE and GTK+ ports.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (248964 => 248965)


--- trunk/Tools/ChangeLog	2019-08-21 21:38:22 UTC (rev 248964)
+++ trunk/Tools/ChangeLog	2019-08-21 21:49:00 UTC (rev 248965)
@@ -1,3 +1,17 @@
+2019-08-21  Adrian Perez de Castro  <[email protected]>
+
+        [GTK][WPE] Make debug-test-runner work
+        https://bugs.webkit.org/show_bug.cgi?id=193576
+
+        Reviewed by Michael Catanzaro.
+
+        * Scripts/webkitdirs.pm:
+        (wrapperPrefixIfNeeded): Only add the wrapper prefix when not running inside a Flatpak sandbox.
+        (setupUnixWebKitEnvironment): Added, sets TEST_RUNNER_INJECTED_BUNDLE_FILENAME and
+        TEST_RUNNER_TEST_PLUGIN_PATH in the environment.
+        (execUnixAppForDebugging): Added.
+        (debugWebKitTestRunner): Alternatively, use execUnixAppForDebugging() for the WPE and GTK+ ports.
+
 2019-08-20  Ryosuke Niwa  <[email protected]>
 
         Put keygen element behind a runtime flag and disable it by default

Modified: trunk/Tools/Scripts/webkitdirs.pm (248964 => 248965)


--- trunk/Tools/Scripts/webkitdirs.pm	2019-08-21 21:38:22 UTC (rev 248964)
+++ trunk/Tools/Scripts/webkitdirs.pm	2019-08-21 21:49:00 UTC (rev 248965)
@@ -88,6 +88,7 @@
        &sdkPlatformDirectory
        &setConfiguration
        &setupMacWebKitEnvironment
+       &setupUnixWebKitEnvironment
        &sharedCommandLineOptions
        &sharedCommandLineOptionsUsage
        &shutDownIOSSimulatorDevice
@@ -2054,7 +2055,7 @@
     if (isAppleCocoaWebKit()) {
         return ("xcrun");
     }
-    if (-e getJhbuildPath()) {
+    if (shouldUseJhbuild() and ! shouldUseFlatpak()) {
         my @prefix = (File::Spec->catfile(sourceDir(), "Tools", "jhbuild", "jhbuild-wrapper"));
         if (isGtk()) {
             push(@prefix, "--gtk");
@@ -2494,6 +2495,14 @@
     setUpGuardMallocIfNeeded();
 }
 
+sub setupUnixWebKitEnvironment($)
+{
+    my ($productDir) = @_;
+
+    $ENV{TEST_RUNNER_INJECTED_BUNDLE_FILENAME} = File::Spec->catfile($productDir, "lib", "libTestRunnerInjectedBundle.so");
+    $ENV{TEST_RUNNER_TEST_PLUGIN_PATH} = File::Spec->catdir($productDir, "lib", "plugins");
+}
+
 sub setupIOSWebKitEnvironment($)
 {
     my ($dyldFrameworkPath) = @_;
@@ -2837,6 +2846,24 @@
     exec { $debuggerPath } $debuggerPath, @architectureFlags, $argumentsSeparator, $appPath, argumentsForRunAndDebugMacWebKitApp() or die;
 }
 
+sub execUnixAppForDebugging($)
+{
+    my ($appPath) = @_;
+
+    my $debuggerPath = `which gdb | head -1`;
+    chomp $debuggerPath;
+    die "Can't find the gdb executable.\n" unless -x $debuggerPath;
+
+    my $productDir = productDir();
+    setupUnixWebKitEnvironment($productDir);
+
+    my @cmdline = wrapperPrefixIfNeeded();
+    push @cmdline, $debuggerPath, "--args", $appPath;
+
+    print "Starting @{[basename($appPath)]} under gdb with build WebKit in $productDir.\n";
+    exec @cmdline, @ARGV or die;
+}
+
 sub debugSafari
 {
     if (isAppleMacWebKit()) {
@@ -2900,6 +2927,8 @@
 {
     if (isAppleMacWebKit()) {
         execMacWebKitAppForDebugging(File::Spec->catfile(productDir(), "WebKitTestRunner"));
+    } elsif (isGtk() or isWPE()) {
+        execUnixAppForDebugging(File::Spec->catfile(productDir(), "bin", "WebKitTestRunner"));
     }
 
     return 1;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to