OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "update_engine/test_utils.h" | 5 #include "update_engine/test_utils.h" |
6 #include <sys/stat.h> | 6 #include <sys/stat.h> |
7 #include <sys/types.h> | 7 #include <sys/types.h> |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 input_counter++; | 183 input_counter++; |
184 input_counter %= sizeof(kRandomString); | 184 input_counter %= sizeof(kRandomString); |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 void CreateExtImageAtPath(const string& path, vector<string>* out_paths) { | 188 void CreateExtImageAtPath(const string& path, vector<string>* out_paths) { |
189 // create 10MiB sparse file | 189 // create 10MiB sparse file |
190 EXPECT_EQ(0, System(StringPrintf("dd if=/dev/zero of=%s" | 190 EXPECT_EQ(0, System(StringPrintf("dd if=/dev/zero of=%s" |
191 " seek=10485759 bs=1 count=1", | 191 " seek=10485759 bs=1 count=1", |
192 path.c_str()))); | 192 path.c_str()))); |
193 EXPECT_EQ(0, System(StringPrintf("mkfs.ext3 -F %s", path.c_str()))); | 193 EXPECT_EQ(0, System(StringPrintf("mkfs.ext3 -b 4096 -F %s", path.c_str()))); |
194 EXPECT_EQ(0, System(StringPrintf("mkdir -p %s", kMountPath))); | 194 EXPECT_EQ(0, System(StringPrintf("mkdir -p %s", kMountPath))); |
195 EXPECT_EQ(0, System(StringPrintf("mount -o loop %s %s", path.c_str(), | 195 EXPECT_EQ(0, System(StringPrintf("mount -o loop %s %s", path.c_str(), |
196 kMountPath))); | 196 kMountPath))); |
197 EXPECT_EQ(0, System(StringPrintf("echo hi > %s/hi", kMountPath))); | 197 EXPECT_EQ(0, System(StringPrintf("echo hi > %s/hi", kMountPath))); |
198 EXPECT_EQ(0, System(StringPrintf("echo hello > %s/hello", kMountPath))); | 198 EXPECT_EQ(0, System(StringPrintf("echo hello > %s/hello", kMountPath))); |
199 EXPECT_EQ(0, System(StringPrintf("mkdir %s/some_dir", kMountPath))); | 199 EXPECT_EQ(0, System(StringPrintf("mkdir %s/some_dir", kMountPath))); |
200 EXPECT_EQ(0, System(StringPrintf("mkdir %s/some_dir/empty_dir", kMountPath))); | 200 EXPECT_EQ(0, System(StringPrintf("mkdir %s/some_dir/empty_dir", kMountPath))); |
201 EXPECT_EQ(0, System(StringPrintf("mkdir %s/some_dir/mnt", kMountPath))); | 201 EXPECT_EQ(0, System(StringPrintf("mkdir %s/some_dir/mnt", kMountPath))); |
202 EXPECT_EQ(0, System(StringPrintf("echo T > %s/some_dir/test", kMountPath))); | 202 EXPECT_EQ(0, System(StringPrintf("echo T > %s/some_dir/test", kMountPath))); |
203 EXPECT_EQ(0, System(StringPrintf("mkfifo %s/some_dir/fifo", kMountPath))); | 203 EXPECT_EQ(0, System(StringPrintf("mkfifo %s/some_dir/fifo", kMountPath))); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 EXPECT_TRUE(expected_paths.empty()); | 264 EXPECT_TRUE(expected_paths.empty()); |
265 if (!expected_paths.empty()) { | 265 if (!expected_paths.empty()) { |
266 for (set<string>::const_iterator it = expected_paths.begin(); | 266 for (set<string>::const_iterator it = expected_paths.begin(); |
267 it != expected_paths.end(); ++it) { | 267 it != expected_paths.end(); ++it) { |
268 LOG(INFO) << "extra path: " << *it; | 268 LOG(INFO) << "extra path: " << *it; |
269 } | 269 } |
270 } | 270 } |
271 } | 271 } |
272 | 272 |
273 } // namespace chromeos_update_engine | 273 } // namespace chromeos_update_engine |
OLD | NEW |