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

Side by Side Diff: test_utils.cc

Issue 6551015: AU: When checking if we've visited a file before, don't follow symlinks. (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: unittest Created 9 years, 10 months 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
« delta_diff_generator.cc ('K') | « delta_performer_unittest.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
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 6
7 #include <sys/stat.h> 7 #include <sys/stat.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <errno.h> 9 #include <errno.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 EXPECT_EQ(0, System(StringPrintf("mkdir %s/some_dir/mnt", kMountPath))); 204 EXPECT_EQ(0, System(StringPrintf("mkdir %s/some_dir/mnt", kMountPath)));
205 EXPECT_EQ(0, System(StringPrintf("echo T > %s/some_dir/test", kMountPath))); 205 EXPECT_EQ(0, System(StringPrintf("echo T > %s/some_dir/test", kMountPath)));
206 EXPECT_EQ(0, System(StringPrintf("mkfifo %s/some_dir/fifo", kMountPath))); 206 EXPECT_EQ(0, System(StringPrintf("mkfifo %s/some_dir/fifo", kMountPath)));
207 EXPECT_EQ(0, System(StringPrintf("mknod %s/cdev c 2 3", kMountPath))); 207 EXPECT_EQ(0, System(StringPrintf("mknod %s/cdev c 2 3", kMountPath)));
208 EXPECT_EQ(0, System(StringPrintf("ln -s /some/target %s/sym", kMountPath))); 208 EXPECT_EQ(0, System(StringPrintf("ln -s /some/target %s/sym", kMountPath)));
209 EXPECT_EQ(0, System(StringPrintf("ln %s/some_dir/test %s/testlink", 209 EXPECT_EQ(0, System(StringPrintf("ln %s/some_dir/test %s/testlink",
210 kMountPath, kMountPath))); 210 kMountPath, kMountPath)));
211 EXPECT_EQ(0, System(StringPrintf("echo T > %s/srchardlink0", kMountPath))); 211 EXPECT_EQ(0, System(StringPrintf("echo T > %s/srchardlink0", kMountPath)));
212 EXPECT_EQ(0, System(StringPrintf("ln %s/srchardlink0 %s/srchardlink1", 212 EXPECT_EQ(0, System(StringPrintf("ln %s/srchardlink0 %s/srchardlink1",
213 kMountPath, kMountPath))); 213 kMountPath, kMountPath)));
214 EXPECT_EQ(0, System(StringPrintf("ln -s bogus %s/boguslink",
215 kMountPath)));
214 EXPECT_EQ(0, System(StringPrintf("umount -d %s", kMountPath))); 216 EXPECT_EQ(0, System(StringPrintf("umount -d %s", kMountPath)));
215 217
216 if (out_paths) { 218 if (out_paths) {
217 out_paths->clear(); 219 out_paths->clear();
218 out_paths->push_back(""); 220 out_paths->push_back("");
219 out_paths->push_back("/hi"); 221 out_paths->push_back("/hi");
222 out_paths->push_back("/boguslink");
220 out_paths->push_back("/hello"); 223 out_paths->push_back("/hello");
221 out_paths->push_back("/some_dir"); 224 out_paths->push_back("/some_dir");
222 out_paths->push_back("/some_dir/empty_dir"); 225 out_paths->push_back("/some_dir/empty_dir");
223 out_paths->push_back("/some_dir/mnt"); 226 out_paths->push_back("/some_dir/mnt");
224 out_paths->push_back("/some_dir/test"); 227 out_paths->push_back("/some_dir/test");
225 out_paths->push_back("/some_dir/fifo"); 228 out_paths->push_back("/some_dir/fifo");
226 out_paths->push_back("/cdev"); 229 out_paths->push_back("/cdev");
227 out_paths->push_back("/testlink"); 230 out_paths->push_back("/testlink");
228 out_paths->push_back("/sym"); 231 out_paths->push_back("/sym");
229 out_paths->push_back("/srchardlink0"); 232 out_paths->push_back("/srchardlink0");
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 std::string loop_dev = GetUnusedLoopDevice(); 290 std::string loop_dev = GetUnusedLoopDevice();
288 EXPECT_EQ(0, system(StringPrintf("losetup %s %s", loop_dev.c_str(), 291 EXPECT_EQ(0, system(StringPrintf("losetup %s %s", loop_dev.c_str(),
289 file_path.c_str()).c_str())); 292 file_path.c_str()).c_str()));
290 loop_releaser_.reset(new ScopedLoopbackDeviceReleaser(loop_dev)); 293 loop_releaser_.reset(new ScopedLoopbackDeviceReleaser(loop_dev));
291 294
292 EXPECT_TRUE(utils::MountFilesystem(loop_dev, *mnt_path, flags)); 295 EXPECT_TRUE(utils::MountFilesystem(loop_dev, *mnt_path, flags));
293 unmounter_.reset(new ScopedFilesystemUnmounter(*mnt_path)); 296 unmounter_.reset(new ScopedFilesystemUnmounter(*mnt_path));
294 } 297 }
295 298
296 } // namespace chromeos_update_engine 299 } // namespace chromeos_update_engine
OLDNEW
« delta_diff_generator.cc ('K') | « delta_performer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698