| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2017 the V8 project authors. All rights reserved. | 2 # Copyright 2017 the V8 project authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import os | 6 import os |
| 7 import shutil | 7 import shutil |
| 8 import subprocess | 8 import subprocess |
| 9 import sys | 9 import sys |
| 10 import tempfile | 10 import tempfile |
| 11 import unittest | 11 import unittest |
| 12 | 12 |
| 13 import update_node | 13 import update_node |
| 14 | 14 |
| 15 # Base paths. | 15 # Base paths. |
| 16 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | 16 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 17 TEST_DATA = os.path.join(BASE_DIR, 'testdata') | 17 TEST_DATA = os.path.join(BASE_DIR, 'testdata') |
| 18 | 18 |
| 19 # Expectations. | 19 # Expectations. |
| 20 EXPECTED_GITIGNORE = """ | 20 EXPECTED_GITIGNORE = """ |
| 21 /testing/gtest/* | 21 /third_party/googletest/* |
| 22 !/testing/gtest/include | 22 !/third_party/googletest/src |
| 23 /testing/gtest/include/* | 23 /third_party/googletest/src/* |
| 24 !/testing/gtest/include/gtest | 24 !/third_party/googletest/src/googletest |
| 25 /testing/gtest/include/gtest/* | 25 /third_party/googletest/src/googletest/* |
| 26 !/testing/gtest/include/gtest/gtest_prod.h | 26 !/third_party/googletest/src/googletest/include |
| 27 /third_party/googletest/src/googletest/include/* |
| 28 !/third_party/googletest/src/googletest/include/gtest |
| 29 /third_party/googletest/src/googletest/include/gtest/* |
| 30 !/third_party/googletest/src/googletest/include/gtest/gtest_prod.h |
| 27 !/third_party/jinja2 | 31 !/third_party/jinja2 |
| 28 !/third_party/markupsafe | 32 !/third_party/markupsafe |
| 29 /unrelated | 33 /unrelated |
| 30 """ | 34 """ |
| 31 | 35 |
| 32 EXPECTED_GIT_DIFF = """ | 36 EXPECTED_GIT_DIFF = """ |
| 33 create mode 100644 deps/v8/base/trace_event/common/common | 37 create mode 100644 deps/v8/base/trace_event/common/common |
| 34 rename deps/v8/baz/{delete_me => v8_new} (100%) | 38 rename deps/v8/baz/{delete_me => v8_new} (100%) |
| 39 delete mode 100644 deps/v8/include/v8-version.h |
| 35 rename deps/v8/{delete_me => new/v8_new} (100%) | 40 rename deps/v8/{delete_me => new/v8_new} (100%) |
| 41 create mode 100644 deps/v8/third_party/googletest/src/googletest/include/gtest/
gtest_prod.h |
| 36 create mode 100644 deps/v8/third_party/jinja2/jinja2 | 42 create mode 100644 deps/v8/third_party/jinja2/jinja2 |
| 37 create mode 100644 deps/v8/third_party/markupsafe/markupsafe | 43 create mode 100644 deps/v8/third_party/markupsafe/markupsafe |
| 38 create mode 100644 deps/v8/v8_new | 44 create mode 100644 deps/v8/v8_new |
| 39 """ | 45 """ |
| 40 | 46 |
| 41 ADDED_FILES = [ | 47 ADDED_FILES = [ |
| 42 'v8_new', | 48 'v8_new', |
| 43 'new/v8_new', | 49 'new/v8_new', |
| 44 'baz/v8_new', | 50 'baz/v8_new', |
| 45 'testing/gtest/gtest_new', | 51 '/third_party/googletest/src/googletest/include/gtest/gtest_new', |
| 46 'testing/gtest/new/gtest_new', | 52 '/third_party/googletest/src/googletest/include/gtest/new/gtest_new', |
| 47 'testing/gtest/baz/gtest_new', | 53 '/third_party/googletest/src/googletest/include/gtest/baz/gtest_new', |
| 48 'third_party/jinja2/jinja2', | 54 'third_party/jinja2/jinja2', |
| 49 'third_party/markupsafe/markupsafe' | 55 'third_party/markupsafe/markupsafe' |
| 50 ] | 56 ] |
| 51 | 57 |
| 52 REMOVED_FILES = [ | 58 REMOVED_FILES = [ |
| 53 'delete_me', | 59 'delete_me', |
| 54 'baz/delete_me', | 60 'baz/delete_me', |
| 55 'testing/gtest/delete_me', | 61 'testing/gtest/delete_me', |
| 56 'testing/gtest/baz/delete_me', | 62 'testing/gtest/baz/delete_me', |
| 57 ] | 63 ] |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 for f in ADDED_FILES: | 105 for f in ADDED_FILES: |
| 100 added_file = os.path.join(node_cwd, 'deps', 'v8', *f.split('/')) | 106 added_file = os.path.join(node_cwd, 'deps', 'v8', *f.split('/')) |
| 101 self.assertTrue(os.path.exists(added_file)) | 107 self.assertTrue(os.path.exists(added_file)) |
| 102 for f in REMOVED_FILES: | 108 for f in REMOVED_FILES: |
| 103 removed_file = os.path.join(node_cwd, 'deps', 'v8', *f.split('/')) | 109 removed_file = os.path.join(node_cwd, 'deps', 'v8', *f.split('/')) |
| 104 self.assertFalse(os.path.exists(removed_file)) | 110 self.assertFalse(os.path.exists(removed_file)) |
| 105 gitlog = subprocess.check_output( | 111 gitlog = subprocess.check_output( |
| 106 ['git', 'diff', 'master', '--summary'], | 112 ['git', 'diff', 'master', '--summary'], |
| 107 cwd=node_cwd, | 113 cwd=node_cwd, |
| 108 ) | 114 ) |
| 115 print |
| 116 print EXPECTED_GIT_DIFF |
| 109 self.assertEquals(EXPECTED_GIT_DIFF.strip(), gitlog.strip()) | 117 self.assertEquals(EXPECTED_GIT_DIFF.strip(), gitlog.strip()) |
| 110 | 118 |
| 111 # Check patch. | 119 # Check patch. |
| 112 gitlog = subprocess.check_output( | 120 gitlog = subprocess.check_output( |
| 113 ['git', 'diff', 'master', '--cached', '--', 'deps/v8/v8_foo'], | 121 ['git', 'diff', 'master', '--cached', '--', 'deps/v8/v8_foo'], |
| 114 cwd=node_cwd, | 122 cwd=node_cwd, |
| 115 ) | 123 ) |
| 116 self.assertIn('+zonk', gitlog.strip()) | 124 self.assertIn('+zonk', gitlog.strip()) |
| 117 | 125 |
| 118 if __name__ == "__main__": | 126 if __name__ == "__main__": |
| 119 unittest.main() | 127 unittest.main() |
| OLD | NEW |