Commit 4684b7fc authored by Stephen Roe's avatar Stephen Roe Committed by Commit Bot

Add fuchsia binary size check script.

Bug: 1126177
Change-Id: I081553be89d56a872b4bb6e8c08f32c1fbb3544b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422889
Commit-Queue: Stephen Roe <steveroe@google.com>
Reviewed-by: default avatarKevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825494}
parent 51c065fa
...@@ -1361,6 +1361,17 @@ deps = { ...@@ -1361,6 +1361,17 @@ deps = {
'dep_type': 'cipd', 'dep_type': 'cipd',
}, },
'src/third_party/zstd': {
'packages': [
{
'package': 'fuchsia/third_party/zstd/linux-amd64',
'version': 'nVy-mclpAVYv0eyAe8SDxiE1g2UuafhnjOx2wr6vd_IC'
},
],
'condition': 'host_os == "linux" and checkout_fuchsia',
'dep_type': 'cipd',
},
'src/third_party/re2/src': 'src/third_party/re2/src':
Var('chromium_git') + '/external/github.com/google/re2.git' + '@' + 'a84f9718f35f62ae2a7a32abb016a1fa9862346a', Var('chromium_git') + '/external/github.com/google/re2.git' + '@' + 'a84f9718f35f62ae2a7a32abb016a1fa9862346a',
......
This diff is collapsed.
#!/usr/bin/python
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import copy
import math
import os
import shutil
import subprocess
import tempfile
import time
import unittest
import binary_sizes
from common import DIR_SOURCE_ROOT
class TestBinarySizes(unittest.TestCase):
tmpdir = None
@classmethod
def setUpClass(cls):
cls.tmpdir = tempfile.mkdtemp()
@classmethod
def tearDownClass(cls):
shutil.rmtree(cls.tmpdir)
# TODO(crbug.com/1145648): Add tests covering FAR file input and histogram
# output.
def testCommitFromBuildProperty(self):
commit_position = binary_sizes.CommitPositionFromBuildProperty(
'refs/heads/master@{#819458}')
self.assertEqual(commit_position, 819458)
def testCompressedSize(self):
"""Verifies that the compressed file size can be extracted from the zstd
stderr output."""
uncompressed_file = tempfile.NamedTemporaryFile(delete=False)
for line in range(200):
uncompressed_file.write(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. '
'Sed eleifend')
uncompressed_file.close()
compressed_path = uncompressed_file.name + '.zst'
devnull = open(os.devnull)
zstd_path = os.path.join(DIR_SOURCE_ROOT, 'third_party', 'zstd', 'bin',
'zstd')
subprocess.call(
[zstd_path, '-14', uncompressed_file.name, '-o', compressed_path],
stderr=devnull)
self.assertEqual(
binary_sizes.CompressedSize(uncompressed_file.name, ['-14']),
os.path.getsize(compressed_path))
os.remove(uncompressed_file.name)
os.remove(compressed_path)
if __name__ == '__main__':
unittest.main()
...@@ -256,3 +256,4 @@ ...@@ -256,3 +256,4 @@
/xdg-utils /xdg-utils
/xstream/lib/ /xstream/lib/
/xulrunner-sdk /xulrunner-sdk
/zstd
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment