prepare-ChangeLog should whine about not having tests in WebKit-only patches
https://bugs.webkit.org/show_bug.cgi?id=203027

Reviewed by Ryosuke Niwa.

* Scripts/prepare-ChangeLog:
(generateNewChangeLogs):
Put the "No new tests" or list of newly added tests in the deeper
of the WebCore or WebKit ChangeLogs, depending on which directories
the patch touches.

This is mostly intended to encourage tests for WebKit-only changes.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251476 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index ffe8880..e1221ec 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,18 @@
+2019-10-23  Tim Horton  <timothy_horton@apple.com>
+
+        prepare-ChangeLog should whine about not having tests in WebKit-only patches
+        https://bugs.webkit.org/show_bug.cgi?id=203027
+
+        Reviewed by Ryosuke Niwa.
+
+        * Scripts/prepare-ChangeLog:
+        (generateNewChangeLogs):
+        Put the "No new tests" or list of newly added tests in the deeper
+        of the WebCore or WebKit ChangeLogs, depending on which directories
+        the patch touches.
+
+        This is mostly intended to encourage tests for WebKit-only changes.
+
 2019-10-22  Aakash Jain  <aakash_jain@apple.com>
 
         [ews] Status bubble should show previous failures if any in case patch is skipped
diff --git a/Tools/Scripts/prepare-ChangeLog b/Tools/Scripts/prepare-ChangeLog
index c6341fb..cd7bc47 100755
--- a/Tools/Scripts/prepare-ChangeLog
+++ b/Tools/Scripts/prepare-ChangeLog
@@ -642,6 +642,13 @@
 {
     my ($prefixes, $filesInChangeLog, $addedRegressionTests, $requiresTests, $functionLists, $bugURL, $bugDescription, $bugRadarURL, $name, $emailAddress, $gitReviewer, $gitCommit, $writeChangeLogs, $delimiters) = @_;
 
+    my $hasWebCoreChange = 0;
+    foreach my $prefix (@$prefixes) {
+        if (unixPath($prefix) =~ m|/WebCore/$|) {
+            $hasWebCoreChange = 1;
+        }
+    }
+
     # Generate new ChangeLog entries and (optionally) write out new ChangeLog files.
     foreach my $prefix (@$prefixes) {
         my $endl = "\n";
@@ -688,7 +695,11 @@
         print CHANGE_LOG normalizeLineEndings("        Reviewed by $reviewer.\n\n", $endl);
         print CHANGE_LOG normalizeLineEndings($description . "\n", $endl) if $description;
 
-        if (unixPath($prefix) =~ m|/WebCore/$| || @$requiresTests) {
+        my $shouldMentionTests = @$requiresTests;
+        $shouldMentionTests |= !$hasWebCoreChange && unixPath($prefix) =~ m|/WebKit/$|;
+        $shouldMentionTests |= unixPath($prefix) =~ m|/WebCore/$|;
+
+        if ($shouldMentionTests) {
             if (@$addedRegressionTests) {
                 print CHANGE_LOG normalizeLineEndings(testListForChangeLog(sort @$addedRegressionTests), $endl);
             } else {