Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: full_update_generator_unittest.cc

Issue 4610001: AU: Speed up full update payload generation by running multiple threads. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
Patch Set: doc strings Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« full_update_generator.cc ('K') | « full_update_generator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <string>
6 #include <vector>
7
8 #include <gtest/gtest.h>
9
10 #include "update_engine/full_update_generator.h"
11 #include "update_engine/test_utils.h"
12
13 using std::string;
14 using std::vector;
15
16 namespace chromeos_update_engine {
17
18 namespace {
19 const size_t kBlockSize = 4096;
20 } // namespace {}
21
22
23 class FullUpdateGeneratorTest : public ::testing::Test { };
24
25
26 TEST(FullUpdateGeneratorTest, RunTest) {
27 vector<char> new_root(20 * 1024 * 1024);
28 vector<char> new_kern(16 * 1024 * 1024);
29 const off_t kChunkSize = 128 * 1024;
30 FillWithData(&new_root);
31 FillWithData(&new_kern);
32 // Assume hashes take 2 MiB beyond the rootfs.
33 off_t new_rootfs_size = new_root.size() - 2 * 1024 * 1024;
34
35 string new_root_path;
36 EXPECT_TRUE(utils::MakeTempFile("/tmp/NewFullUpdateTest_R.XXXXXX",
37 &new_root_path,
38 NULL));
39 ScopedPathUnlinker new_root_path_unlinker(new_root_path);
40 EXPECT_TRUE(WriteFileVector(new_root_path, new_root));
41
42 string new_kern_path;
43 EXPECT_TRUE(utils::MakeTempFile("/tmp/NewFullUpdateTest_K.XXXXXX",
44 &new_kern_path,
45 NULL));
46 ScopedPathUnlinker new_kern_path_unlinker(new_kern_path);
47 EXPECT_TRUE(WriteFileVector(new_kern_path, new_kern));
48
49 string out_blobs_path;
50 int out_blobs_fd;
51 EXPECT_TRUE(utils::MakeTempFile("/tmp/NewFullUpdateTest_D.XXXXXX",
52 &out_blobs_path,
53 &out_blobs_fd));
54 ScopedPathUnlinker out_blobs_path_unlinker(out_blobs_path);
55 ScopedFdCloser out_blobs_fd_closer(&out_blobs_fd);
56
57 off_t out_blobs_length = 0;
58
59 Graph graph;
60 vector<DeltaArchiveManifest_InstallOperation> kernel_ops;
61 vector<Vertex::Index> final_order;
62
63 EXPECT_TRUE(FullUpdateGenerator::Run(&graph,
64 new_kern_path,
65 new_root_path,
66 new_rootfs_size,
67 out_blobs_fd,
68 &out_blobs_length,
69 kChunkSize,
70 kBlockSize,
71 &kernel_ops,
72 &final_order));
73 EXPECT_EQ(new_rootfs_size / kChunkSize, graph.size());
74 EXPECT_EQ(new_rootfs_size / kChunkSize, final_order.size());
75 EXPECT_EQ(new_kern.size() / kChunkSize, kernel_ops.size());
76 for (off_t i = 0; i < (new_rootfs_size / kChunkSize); ++i) {
77 EXPECT_EQ(i, final_order[i]);
78 EXPECT_EQ(1, graph[i].op.dst_extents_size());
79 EXPECT_EQ(i * kChunkSize / kBlockSize,
80 graph[i].op.dst_extents(0).start_block()) << "i = " << i;
81 EXPECT_EQ(kChunkSize / kBlockSize,
82 graph[i].op.dst_extents(0).num_blocks());
83 if (graph[i].op.type() !=
84 DeltaArchiveManifest_InstallOperation_Type_REPLACE) {
85 EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ,
86 graph[i].op.type());
87 }
88 }
89 }
90
91 } // namespace chromeos_update_engine
OLDNEW
« full_update_generator.cc ('K') | « full_update_generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698