OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <sys/types.h> | 5 #include <sys/types.h> |
6 #include <sys/stat.h> | 6 #include <sys/stat.h> |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // - Chunk 0, 1, 2, 3 | 106 // - Chunk 0, 1, 2, 3 |
107 // - Root directory (inode 2) | 107 // - Root directory (inode 2) |
108 // - Journal (inode 8) | 108 // - Journal (inode 8) |
109 // - lost+found directory (inode 11) | 109 // - lost+found directory (inode 11) |
110 // - test_file indirect block (inode 12) | 110 // - test_file indirect block (inode 12) |
111 struct { | 111 struct { |
112 string metadata_name; | 112 string metadata_name; |
113 off_t start_block; // Set to -1 to skip start block verification | 113 off_t start_block; // Set to -1 to skip start block verification |
114 off_t num_blocks; // Set to -1 to skip num blocks verification | 114 off_t num_blocks; // Set to -1 to skip num blocks verification |
115 } exp_results[] = | 115 } exp_results[] = |
116 {{"<rootfs-bg-0-0-metadata>", 0, 260}, | 116 {{"<rootfs-bg-0-0-metadata>", 0, 104}, |
117 {"<rootfs-bg-0-1-metadata>", 260, 260}, | 117 {"<rootfs-bg-0-1-metadata>", 104, 104}, |
118 {"<rootfs-bg-0-2-metadata>", 520, 260}, | 118 {"<rootfs-bg-0-2-metadata>", 208, 104}, |
119 {"<rootfs-bg-0-3-metadata>", 780, 263}, | 119 {"<rootfs-bg-0-3-metadata>", 312, 104}, |
120 {"<rootfs-bg-1-0-metadata>", 32768, 260}, | 120 {"<rootfs-bg-0-4-metadata>", 416, 104}, |
121 {"<rootfs-bg-1-1-metadata>", 33028, 260}, | 121 {"<rootfs-bg-0-5-metadata>", 520, 104}, |
122 {"<rootfs-bg-1-2-metadata>", 33288, 260}, | 122 {"<rootfs-bg-0-6-metadata>", 624, 104}, |
123 {"<rootfs-bg-1-3-metadata>", 33548, 263}, | 123 {"<rootfs-bg-0-7-metadata>", 728, 104}, |
| 124 {"<rootfs-bg-0-8-metadata>", 832, 104}, |
| 125 {"<rootfs-bg-0-9-metadata>", 936, 107}, |
| 126 {"<rootfs-bg-1-0-metadata>", 32768, 104}, |
| 127 {"<rootfs-bg-1-1-metadata>", 32872, 104}, |
| 128 {"<rootfs-bg-1-2-metadata>", 32976, 104}, |
| 129 {"<rootfs-bg-1-3-metadata>", 33080, 104}, |
| 130 {"<rootfs-bg-1-4-metadata>", 33184, 104}, |
| 131 {"<rootfs-bg-1-5-metadata>", 33288, 104}, |
| 132 {"<rootfs-bg-1-6-metadata>", 33392, 104}, |
| 133 {"<rootfs-bg-1-7-metadata>", 33496, 104}, |
| 134 {"<rootfs-bg-1-8-metadata>", 33600, 104}, |
| 135 {"<rootfs-bg-1-9-metadata>", 33704, 107}, |
124 {"<rootfs-inode-2-metadata>", -1, 1}, | 136 {"<rootfs-inode-2-metadata>", -1, 1}, |
125 {"<rootfs-inode-8-metadata>", -1, 4101}, | 137 {"<rootfs-inode-8-metadata>", -1, 4101}, |
126 {"<rootfs-inode-11-metadata>", -1, 4}, | 138 {"<rootfs-inode-11-metadata>", -1, 4}, |
127 {"<rootfs-inode-12-metadata>", -1, 1}}; | 139 {"<rootfs-inode-12-metadata>", -1, 1}}; |
128 | 140 |
129 int num_exp_results = sizeof(exp_results) / sizeof(exp_results[0]); | 141 int num_exp_results = sizeof(exp_results) / sizeof(exp_results[0]); |
130 EXPECT_EQ(graph.size(), num_exp_results); | 142 EXPECT_EQ(graph.size(), num_exp_results); |
131 | 143 |
132 for (int i = 0; i < num_exp_results; i++) { | 144 for (int i = 0; i < num_exp_results; i++) { |
133 Vertex& vertex = graph[i]; | 145 Vertex& vertex = graph[i]; |
(...skipping 14 matching lines...) Expand all Loading... |
148 EXPECT_EQ(op.src_extents(0).start_block(), exp_results[i].start_block); | 160 EXPECT_EQ(op.src_extents(0).start_block(), exp_results[i].start_block); |
149 } | 161 } |
150 | 162 |
151 if (exp_results[i].num_blocks != -1) { | 163 if (exp_results[i].num_blocks != -1) { |
152 EXPECT_EQ(op.src_extents(0).num_blocks(), exp_results[i].num_blocks); | 164 EXPECT_EQ(op.src_extents(0).num_blocks(), exp_results[i].num_blocks); |
153 } | 165 } |
154 } | 166 } |
155 } | 167 } |
156 | 168 |
157 } // namespace chromeos_update_engine | 169 } // namespace chromeos_update_engine |
OLD | NEW |