Update messages.py codegen for String, fix tests
authorjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Mar 2018 17:30:18 +0000 (17:30 +0000)
committerjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Mar 2018 17:30:18 +0000 (17:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184179
<rdar://problem/39041352>

Reviewed by Mark Lam.

I updated some of the code in
https://trac.webkit.org/changeset/230097 and auto-magically used a
script to update copyright headers... and that broke the tests
which checked for a particular date. Update all of the headers.

Part of this change updates the code generated by messages.py

* Scripts/webkit/LegacyMessageReceiver-expected.cpp:
* Scripts/webkit/MessageReceiver-expected.cpp:
* Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
* Scripts/webkit/MessagesSuperclass-expected.h:
* Scripts/webkit/messages.py:
* Scripts/webkit/messages_unittest.py:
(GeneratedFileContentsTest.assertGeneratedFileContentsEqual):
generate a better error message

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230108 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/Scripts/webkit/LegacyMessageReceiver-expected.cpp
Source/WebKit/Scripts/webkit/MessageReceiver-expected.cpp
Source/WebKit/Scripts/webkit/MessageReceiverSuperclass-expected.cpp
Source/WebKit/Scripts/webkit/MessagesSuperclass-expected.h
Source/WebKit/Scripts/webkit/messages.py
Source/WebKit/Scripts/webkit/messages_unittest.py

index 3b83c30..929abb1 100644 (file)
@@ -1,3 +1,27 @@
+2018-03-30  JF Bastien  <jfbastien@apple.com>
+
+        Update messages.py codegen for String, fix tests
+        https://bugs.webkit.org/show_bug.cgi?id=184179
+        <rdar://problem/39041352>
+
+        Reviewed by Mark Lam.
+
+        I updated some of the code in
+        https://trac.webkit.org/changeset/230097 and auto-magically used a
+        script to update copyright headers... and that broke the tests
+        which checked for a particular date. Update all of the headers.
+
+        Part of this change updates the code generated by messages.py
+
+        * Scripts/webkit/LegacyMessageReceiver-expected.cpp:
+        * Scripts/webkit/MessageReceiver-expected.cpp:
+        * Scripts/webkit/MessageReceiverSuperclass-expected.cpp:
+        * Scripts/webkit/MessagesSuperclass-expected.h:
+        * Scripts/webkit/messages.py:
+        * Scripts/webkit/messages_unittest.py:
+        (GeneratedFileContentsTest.assertGeneratedFileContentsEqual):
+        generate a better error message
+
 2018-03-29  JF Bastien  <jfbastien@apple.com>
 
         Use Forward.h instead of forward-declaring WTF::String
index 021c3f4..a50c52f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
index 5f03492..ae51aef 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
index e545aee..5741fc3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
index 2250084..30f86c0 100644 (file)
@@ -26,6 +26,8 @@
 
 #include "ArgumentCoders.h"
 #include <wtf/Forward.h>
+#include <wtf/text/WTFString.h>
+
 
 namespace Messages {
 namespace WebPage {
index 820780b..27f05c7 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2017 Apple Inc. All rights reserved.
+# Copyright (C) 2010-2018 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -31,7 +31,7 @@ LEGACY_RECEIVER_ATTRIBUTE = 'LegacyReceiver'
 DELAYED_ATTRIBUTE = 'Delayed'
 
 _license_header = """/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -172,6 +172,7 @@ def forward_declarations_and_headers(receiver):
 
     headers = set([
         '"ArgumentCoders.h"',
+        '<wtf/Forward.h>',
     ])
 
     non_template_wtf_types = frozenset([
@@ -191,6 +192,7 @@ def forward_declarations_and_headers(receiver):
         'WebCore::ServiceWorkerOrClientIdentifier',
         'WebCore::ServiceWorkerRegistrationIdentifier',
         'WebCore::SWServerConnectionIdentifier',
+        'String',
     ])
 
     for parameter in receiver.iterparameters():
index 8c44ea5..aa00ee0 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2010-2017 Apple Inc. All rights reserved.
+# Copyright (C) 2010-2018 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -300,20 +300,24 @@ class ParsingTest(MessagesTest):
 
 class GeneratedFileContentsTest(unittest.TestCase):
     def assertGeneratedFileContentsEqual(self, actual_file_contents, expected_file_name):
-        if reset_results:
-            with open(os.path.join(script_directory, expected_file_name), mode='w') as out_file:
-                out_file.write(actual_file_contents)
-            return
-
-        with open(os.path.join(script_directory, expected_file_name), mode='r') as in_file:
-            expected_file_contents = in_file.read()
-        actual_line_list = actual_file_contents.splitlines(False)
-        expected_line_list = expected_file_contents.splitlines(False)
-
-        for index, actual_line in enumerate(actual_line_list):
-            self.assertEquals(actual_line, expected_line_list[index])
-
-        self.assertEquals(len(actual_line_list), len(expected_line_list))
+        try:
+            if reset_results:
+                with open(os.path.join(script_directory, expected_file_name), mode='w') as out_file:
+                    out_file.write(actual_file_contents)
+                return
+
+            with open(os.path.join(script_directory, expected_file_name), mode='r') as in_file:
+                expected_file_contents = in_file.read()
+            actual_line_list = actual_file_contents.splitlines(False)
+            expected_line_list = expected_file_contents.splitlines(False)
+
+            for index, actual_line in enumerate(actual_line_list):
+                self.assertEquals(actual_line, expected_line_list[index])
+
+            self.assertEquals(len(actual_line_list), len(expected_line_list))
+        except:
+            sys.stderr.write('In expected file %s\n' % expected_file_name)
+            raise
 
     def assertHeaderEqual(self, input_messages_file_contents, expected_file_name):
         actual_file_contents = messages.generate_messages_header(StringIO(input_messages_file_contents))