| 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 <sys/mount.h> | 5 #include <sys/mount.h> |
| 6 #include <inttypes.h> | 6 #include <inttypes.h> |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 b_mnt.c_str()).c_str())); | 253 b_mnt.c_str()).c_str())); |
| 254 EXPECT_TRUE(WriteSparseFile(StringPrintf("%s/fullsparse", b_mnt.c_str()), | 254 EXPECT_TRUE(WriteSparseFile(StringPrintf("%s/fullsparse", b_mnt.c_str()), |
| 255 1024 * 1024)); | 255 1024 * 1024)); |
| 256 EXPECT_EQ(0, system(StringPrintf("dd if=/dev/zero of=%s/partsparese bs=1 " | 256 EXPECT_EQ(0, system(StringPrintf("dd if=/dev/zero of=%s/partsparese bs=1 " |
| 257 "seek=4096 count=1", | 257 "seek=4096 count=1", |
| 258 b_mnt.c_str()).c_str())); | 258 b_mnt.c_str()).c_str())); |
| 259 EXPECT_EQ(0, system(StringPrintf("cp %s/srchardlink0 %s/tmp && " | 259 EXPECT_EQ(0, system(StringPrintf("cp %s/srchardlink0 %s/tmp && " |
| 260 "mv %s/tmp %s/srchardlink1", | 260 "mv %s/tmp %s/srchardlink1", |
| 261 b_mnt.c_str(), b_mnt.c_str(), | 261 b_mnt.c_str(), b_mnt.c_str(), |
| 262 b_mnt.c_str(), b_mnt.c_str()).c_str())); | 262 b_mnt.c_str(), b_mnt.c_str()).c_str())); |
| 263 EXPECT_EQ(0, system(StringPrintf("rm %s/boguslink && " |
| 264 "echo foobar > %s/boguslink", |
| 265 b_mnt.c_str(), b_mnt.c_str()).c_str())); |
| 263 EXPECT_TRUE(utils::WriteFile(StringPrintf("%s/hardtocompress", | 266 EXPECT_TRUE(utils::WriteFile(StringPrintf("%s/hardtocompress", |
| 264 b_mnt.c_str()).c_str(), | 267 b_mnt.c_str()).c_str(), |
| 265 reinterpret_cast<const char*>(kRandomString), | 268 reinterpret_cast<const char*>(kRandomString), |
| 266 sizeof(kRandomString))); | 269 sizeof(kRandomString))); |
| 267 } | 270 } |
| 268 | 271 |
| 269 string old_kernel; | 272 string old_kernel; |
| 270 EXPECT_TRUE(utils::MakeTempFile("/tmp/old_kernel.XXXXXX", &old_kernel, NULL)); | 273 EXPECT_TRUE(utils::MakeTempFile("/tmp/old_kernel.XXXXXX", &old_kernel, NULL)); |
| 271 ScopedPathUnlinker old_kernel_unlinker(old_kernel); | 274 ScopedPathUnlinker old_kernel_unlinker(old_kernel); |
| 272 | 275 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 op.clear_src_extents(); | 533 op.clear_src_extents(); |
| 531 *(op.add_src_extents()) = ExtentForRange(5, 3); | 534 *(op.add_src_extents()) = ExtentForRange(5, 3); |
| 532 EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op)); | 535 EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op)); |
| 533 *(op.add_dst_extents()) = ExtentForRange(20, 6); | 536 *(op.add_dst_extents()) = ExtentForRange(20, 6); |
| 534 EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op)); | 537 EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op)); |
| 535 *(op.add_src_extents()) = ExtentForRange(19, 2); | 538 *(op.add_src_extents()) = ExtentForRange(19, 2); |
| 536 EXPECT_FALSE(DeltaPerformer::IsIdempotentOperation(op)); | 539 EXPECT_FALSE(DeltaPerformer::IsIdempotentOperation(op)); |
| 537 } | 540 } |
| 538 | 541 |
| 539 } // namespace chromeos_update_engine | 542 } // namespace chromeos_update_engine |
| OLD | NEW |