OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium 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/stat.h> | 5 #include <sys/stat.h> |
6 #include <sys/types.h> | 6 #include <sys/types.h> |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 kMountPath)); | 50 kMountPath)); |
51 ASSERT_EQ(0, System(string("mount -o loop ") + sub_image + " " + | 51 ASSERT_EQ(0, System(string("mount -o loop ") + sub_image + " " + |
52 kMountPath + "/some_dir/mnt")); | 52 kMountPath + "/some_dir/mnt")); |
53 for (vector<string>::iterator it = expected_paths_vector.begin(); | 53 for (vector<string>::iterator it = expected_paths_vector.begin(); |
54 it != expected_paths_vector.end(); ++it) | 54 it != expected_paths_vector.end(); ++it) |
55 *it = kMountPath + *it; | 55 *it = kMountPath + *it; |
56 set<string> expected_paths(expected_paths_vector.begin(), | 56 set<string> expected_paths(expected_paths_vector.begin(), |
57 expected_paths_vector.end()); | 57 expected_paths_vector.end()); |
58 VerifyAllPaths(kMountPath, expected_paths); | 58 VerifyAllPaths(kMountPath, expected_paths); |
59 | 59 |
60 EXPECT_EQ(0, System(string("umount ") + kMountPath + "/some_dir/mnt")); | 60 EXPECT_EQ(0, System(string("umount -d ") + kMountPath + "/some_dir/mnt")); |
61 EXPECT_EQ(0, System(string("umount ") + kMountPath)); | 61 EXPECT_EQ(0, System(string("umount -d ") + kMountPath)); |
62 EXPECT_EQ(0, System(string("rm -f ") + first_image + " " + sub_image)); | 62 EXPECT_EQ(0, System(string("rm -f ") + first_image + " " + sub_image)); |
63 } | 63 } |
64 | 64 |
65 TEST_F(FilesystemIteratorTest, NegativeTest) { | 65 TEST_F(FilesystemIteratorTest, NegativeTest) { |
66 { | 66 { |
67 FilesystemIterator iter("/non/existent/path", set<string>()); | 67 FilesystemIterator iter("/non/existent/path", set<string>()); |
68 EXPECT_TRUE(iter.IsEnd()); | 68 EXPECT_TRUE(iter.IsEnd()); |
69 EXPECT_TRUE(iter.IsErr()); | 69 EXPECT_TRUE(iter.IsErr()); |
70 } | 70 } |
71 | 71 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 EXPECT_EQ(0, rmdir("DeleteWhileTraverseTest/a")); | 111 EXPECT_EQ(0, rmdir("DeleteWhileTraverseTest/a")); |
112 } | 112 } |
113 iter.Increment(); | 113 iter.Increment(); |
114 } | 114 } |
115 EXPECT_FALSE(iter.IsErr()); | 115 EXPECT_FALSE(iter.IsErr()); |
116 EXPECT_TRUE(expected_paths.empty()); | 116 EXPECT_TRUE(expected_paths.empty()); |
117 EXPECT_EQ(0, system("rm -rf DeleteWhileTraverseTest")); | 117 EXPECT_EQ(0, system("rm -rf DeleteWhileTraverseTest")); |
118 } | 118 } |
119 | 119 |
120 } // namespace chromeos_update_engine | 120 } // namespace chromeos_update_engine |
OLD | NEW |