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/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 #include <unistd.h> | 8 #include <unistd.h> |
| 9 #include <set> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 #include "base/string_util.h" | 12 #include "base/string_util.h" |
12 #include <gtest/gtest.h> | 13 #include <gtest/gtest.h> |
13 #include "chromeos/obsolete_logging.h" | 14 #include "chromeos/obsolete_logging.h" |
14 #include "update_engine/decompressing_file_writer.h" | 15 #include "update_engine/decompressing_file_writer.h" |
15 #include "update_engine/delta_diff_generator.h" | 16 #include "update_engine/delta_diff_generator.h" |
16 #include "update_engine/delta_diff_parser.h" | 17 #include "update_engine/delta_diff_parser.h" |
17 #include "update_engine/gzip.h" | 18 #include "update_engine/gzip.h" |
18 #include "update_engine/mock_file_writer.h" | 19 #include "update_engine/mock_file_writer.h" |
19 #include "update_engine/subprocess.h" | 20 #include "update_engine/subprocess.h" |
20 #include "update_engine/test_utils.h" | 21 #include "update_engine/test_utils.h" |
21 #include "update_engine/utils.h" | 22 #include "update_engine/utils.h" |
22 | 23 |
23 namespace chromeos_update_engine { | 24 namespace chromeos_update_engine { |
24 | 25 |
| 26 using std::set; |
25 using std::string; | 27 using std::string; |
26 using std::vector; | 28 using std::vector; |
27 | 29 |
28 class DeltaDiffGeneratorTest : public ::testing::Test {}; | 30 class DeltaDiffGeneratorTest : public ::testing::Test { |
| 31 virtual void TearDown() { |
| 32 EXPECT_EQ(0, system("rm -rf diff-gen-test")); |
| 33 } |
| 34 protected: |
| 35 void FakerootEncodeDataToDeltaFileTest(bool test_diff_exclusion); |
| 36 }; |
29 | 37 |
30 namespace { | 38 namespace { |
31 void DumpProto(const DeltaArchiveManifest* archive) { | 39 void DumpProto(const DeltaArchiveManifest* archive) { |
32 for (int i = 0; i < archive->files_size(); i++) { | 40 for (int i = 0; i < archive->files_size(); i++) { |
33 printf("Node %d\n", i); | 41 printf("Node %d\n", i); |
34 const DeltaArchiveManifest_File& file = archive->files(i); | 42 const DeltaArchiveManifest_File& file = archive->files(i); |
35 for (int j = 0; j < file.children_size(); j++) { | 43 for (int j = 0; j < file.children_size(); j++) { |
36 const DeltaArchiveManifest_File_Child& child = file.children(j); | 44 const DeltaArchiveManifest_File_Child& child = file.children(j); |
37 printf(" %d %s\n", child.index(), child.name().c_str()); | 45 printf(" %d %s\n", child.index(), child.name().c_str()); |
38 } | 46 } |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 EXPECT_TRUE(S_ISLNK(link.mode())); | 351 EXPECT_TRUE(S_ISLNK(link.mode())); |
344 EXPECT_EQ(0, link.uid()); | 352 EXPECT_EQ(0, link.uid()); |
345 EXPECT_EQ(0, link.gid()); | 353 EXPECT_EQ(0, link.gid()); |
346 EXPECT_FALSE(link.has_hardlink_path()); | 354 EXPECT_FALSE(link.has_hardlink_path()); |
347 EXPECT_FALSE(link.has_data_format()); | 355 EXPECT_FALSE(link.has_data_format()); |
348 EXPECT_FALSE(link.has_data_offset()); | 356 EXPECT_FALSE(link.has_data_offset()); |
349 EXPECT_FALSE(link.has_data_length()); | 357 EXPECT_FALSE(link.has_data_length()); |
350 } | 358 } |
351 | 359 |
352 TEST_F(DeltaDiffGeneratorTest, FakerootEncodeDataToDeltaFileTest) { | 360 TEST_F(DeltaDiffGeneratorTest, FakerootEncodeDataToDeltaFileTest) { |
| 361 FakerootEncodeDataToDeltaFileTest(false); |
| 362 } |
| 363 TEST_F(DeltaDiffGeneratorTest, FakerootDiffExclusionsTest) { |
| 364 FakerootEncodeDataToDeltaFileTest(true); |
| 365 } |
| 366 |
| 367 void DeltaDiffGeneratorTest::FakerootEncodeDataToDeltaFileTest( |
| 368 bool test_diff_exclusion) { |
353 char cwd[1000]; | 369 char cwd[1000]; |
354 ASSERT_EQ(cwd, getcwd(cwd, sizeof(cwd))) << "cwd buf possibly too small"; | 370 ASSERT_EQ(cwd, getcwd(cwd, sizeof(cwd))) << "cwd buf possibly too small"; |
355 ASSERT_EQ(0, System(string("mkdir -p ") + cwd + "/diff-gen-test")); | 371 ASSERT_EQ(0, System(string("mkdir -p ") + cwd + "/diff-gen-test")); |
356 ASSERT_EQ(0, System(string("mkdir -p ") + cwd + "/diff-gen-test/old")); | 372 ASSERT_EQ(0, System(string("mkdir -p ") + cwd + "/diff-gen-test/old")); |
357 ASSERT_EQ(0, System(string("mkdir -p ") + cwd + "/diff-gen-test/new")); | 373 ASSERT_EQ(0, System(string("mkdir -p ") + cwd + "/diff-gen-test/new")); |
358 GenerateFilesAtPath(string(cwd) + "/diff-gen-test/old"); | 374 GenerateFilesAtPath(string(cwd) + "/diff-gen-test/old"); |
359 GenerateFilesAtPath(string(cwd) + "/diff-gen-test/new"); | 375 GenerateFilesAtPath(string(cwd) + "/diff-gen-test/new"); |
360 EditFilesAtPath(string(cwd) + "/diff-gen-test/new"); | 376 EditFilesAtPath(string(cwd) + "/diff-gen-test/new"); |
361 | 377 |
| 378 set<string> diff_exclusions; |
| 379 if (test_diff_exclusion) { |
| 380 diff_exclusions.insert("/encoding/long_small_change"); |
| 381 } else { |
| 382 diff_exclusions.insert("/hi"); |
| 383 } |
| 384 |
362 DeltaArchiveManifest* archive = | 385 DeltaArchiveManifest* archive = |
363 DeltaDiffGenerator::EncodeMetadataToProtoBuffer( | 386 DeltaDiffGenerator::EncodeMetadataToProtoBuffer( |
364 (string(cwd) + "/diff-gen-test/new").c_str()); | 387 (string(cwd) + "/diff-gen-test/new").c_str()); |
365 EXPECT_TRUE(NULL != archive); | 388 EXPECT_TRUE(NULL != archive); |
366 | 389 |
367 EXPECT_TRUE(DeltaDiffGenerator::EncodeDataToDeltaFile( | 390 EXPECT_TRUE(DeltaDiffGenerator::EncodeDataToDeltaFile( |
368 archive, | 391 archive, |
369 string(cwd) + "/diff-gen-test/old", | 392 string(cwd) + "/diff-gen-test/old", |
370 string(cwd) + "/diff-gen-test/new", | 393 string(cwd) + "/diff-gen-test/new", |
371 string(cwd) + "/diff-gen-test/out.dat", | 394 string(cwd) + "/diff-gen-test/out.dat", |
372 "")); | 395 diff_exclusions, "")); |
373 | 396 |
374 EXPECT_EQ(18, archive->files_size()); | 397 EXPECT_EQ(18, archive->files_size()); |
375 | 398 |
376 const DeltaArchiveManifest_File& root = archive->files(0); | 399 const DeltaArchiveManifest_File& root = archive->files(0); |
377 EXPECT_TRUE(S_ISDIR(root.mode())); | 400 EXPECT_TRUE(S_ISDIR(root.mode())); |
378 EXPECT_EQ(0, root.uid()); | 401 EXPECT_EQ(0, root.uid()); |
379 EXPECT_EQ(0, root.gid()); | 402 EXPECT_EQ(0, root.gid()); |
380 ASSERT_EQ(6, root.children_size()); | 403 ASSERT_EQ(6, root.children_size()); |
381 EXPECT_EQ("cdev", root.children(0).name()); | 404 EXPECT_EQ("cdev", root.children(0).name()); |
382 EXPECT_EQ("compress_link", root.children(1).name()); | 405 EXPECT_EQ("compress_link", root.children(1).name()); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 EXPECT_TRUE(long_new.has_data_length()); | 492 EXPECT_TRUE(long_new.has_data_length()); |
470 EXPECT_FALSE(long_new.has_hardlink_path()); | 493 EXPECT_FALSE(long_new.has_hardlink_path()); |
471 | 494 |
472 const DeltaArchiveManifest_File& long_small_change = | 495 const DeltaArchiveManifest_File& long_small_change = |
473 archive->files(encoding.children(1).index()); | 496 archive->files(encoding.children(1).index()); |
474 EXPECT_EQ(0, long_small_change.children_size()); | 497 EXPECT_EQ(0, long_small_change.children_size()); |
475 EXPECT_TRUE(S_ISREG(long_small_change.mode())); | 498 EXPECT_TRUE(S_ISREG(long_small_change.mode())); |
476 EXPECT_EQ(0, long_small_change.uid()); | 499 EXPECT_EQ(0, long_small_change.uid()); |
477 EXPECT_EQ(0, long_small_change.gid()); | 500 EXPECT_EQ(0, long_small_change.gid()); |
478 EXPECT_TRUE(long_small_change.has_data_format()); | 501 EXPECT_TRUE(long_small_change.has_data_format()); |
479 EXPECT_EQ(DeltaArchiveManifest_File_DataFormat_BSDIFF, | 502 DeltaArchiveManifest_File_DataFormat expected_format = |
480 long_small_change.data_format()); | 503 DeltaArchiveManifest_File_DataFormat_BSDIFF; |
| 504 if (test_diff_exclusion) |
| 505 expected_format = DeltaArchiveManifest_File_DataFormat_FULL; |
| 506 EXPECT_EQ(expected_format, long_small_change.data_format()); |
481 EXPECT_TRUE(long_small_change.has_data_offset()); | 507 EXPECT_TRUE(long_small_change.has_data_offset()); |
482 EXPECT_TRUE(long_small_change.has_data_length()); | 508 EXPECT_TRUE(long_small_change.has_data_length()); |
483 EXPECT_FALSE(long_small_change.has_hardlink_path()); | 509 EXPECT_FALSE(long_small_change.has_hardlink_path()); |
484 | 510 |
485 const DeltaArchiveManifest_File& nochange = | 511 const DeltaArchiveManifest_File& nochange = |
486 archive->files(encoding.children(2).index()); | 512 archive->files(encoding.children(2).index()); |
487 EXPECT_EQ(0, nochange.children_size()); | 513 EXPECT_EQ(0, nochange.children_size()); |
488 EXPECT_TRUE(S_ISREG(nochange.mode())); | 514 EXPECT_TRUE(S_ISREG(nochange.mode())); |
489 EXPECT_EQ(0, nochange.uid()); | 515 EXPECT_EQ(0, nochange.uid()); |
490 EXPECT_EQ(0, nochange.gid()); | 516 EXPECT_EQ(0, nochange.gid()); |
491 EXPECT_TRUE(nochange.has_data_format()); | 517 EXPECT_FALSE(nochange.has_data_format()); |
492 EXPECT_EQ(DeltaArchiveManifest_File_DataFormat_FULL, nochange.data_format()); | 518 EXPECT_FALSE(nochange.has_data_offset()); |
493 EXPECT_TRUE(nochange.has_data_offset()); | 519 EXPECT_FALSE(nochange.has_data_length()); |
494 EXPECT_TRUE(nochange.has_data_length()); | |
495 EXPECT_FALSE(nochange.has_hardlink_path()); | 520 EXPECT_FALSE(nochange.has_hardlink_path()); |
496 | 521 |
497 const DeltaArchiveManifest_File& onebyte = | 522 const DeltaArchiveManifest_File& onebyte = |
498 archive->files(encoding.children(3).index()); | 523 archive->files(encoding.children(3).index()); |
499 EXPECT_EQ(0, onebyte.children_size()); | 524 EXPECT_EQ(0, onebyte.children_size()); |
500 EXPECT_TRUE(S_ISREG(onebyte.mode())); | 525 EXPECT_TRUE(S_ISREG(onebyte.mode())); |
501 EXPECT_EQ(0, onebyte.uid()); | 526 EXPECT_EQ(0, onebyte.uid()); |
502 EXPECT_EQ(0, onebyte.gid()); | 527 EXPECT_EQ(0, onebyte.gid()); |
503 EXPECT_TRUE(onebyte.has_data_format()); | 528 EXPECT_TRUE(onebyte.has_data_format()); |
504 EXPECT_EQ(DeltaArchiveManifest_File_DataFormat_FULL, onebyte.data_format()); | 529 EXPECT_EQ(DeltaArchiveManifest_File_DataFormat_FULL, onebyte.data_format()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 ASSERT_TRUE(hello.has_data_length()); | 584 ASSERT_TRUE(hello.has_data_length()); |
560 EXPECT_GT(hello.data_length(), 0); | 585 EXPECT_GT(hello.data_length(), 0); |
561 EXPECT_FALSE(hello.has_hardlink_path()); | 586 EXPECT_FALSE(hello.has_hardlink_path()); |
562 | 587 |
563 const DeltaArchiveManifest_File& newempty = | 588 const DeltaArchiveManifest_File& newempty = |
564 archive->files(dir.children(3).index()); | 589 archive->files(dir.children(3).index()); |
565 EXPECT_EQ(0, newempty.children_size()); | 590 EXPECT_EQ(0, newempty.children_size()); |
566 EXPECT_TRUE(S_ISREG(newempty.mode())); | 591 EXPECT_TRUE(S_ISREG(newempty.mode())); |
567 EXPECT_EQ(0, newempty.uid()); | 592 EXPECT_EQ(0, newempty.uid()); |
568 EXPECT_EQ(0, newempty.gid()); | 593 EXPECT_EQ(0, newempty.gid()); |
569 EXPECT_FALSE(newempty.has_data_format()); | 594 EXPECT_TRUE(newempty.has_data_format()); |
570 EXPECT_FALSE(newempty.has_data_offset()); | 595 EXPECT_EQ(DeltaArchiveManifest_File_DataFormat_FULL, newempty.data_format()); |
571 EXPECT_FALSE(newempty.has_data_length()); | 596 EXPECT_TRUE(newempty.has_data_offset()); |
| 597 EXPECT_TRUE(newempty.has_data_length()); |
572 EXPECT_FALSE(newempty.has_hardlink_path()); | 598 EXPECT_FALSE(newempty.has_hardlink_path()); |
573 | 599 |
574 const DeltaArchiveManifest_File& subdir = | 600 const DeltaArchiveManifest_File& subdir = |
575 archive->files(dir.children(4).index()); | 601 archive->files(dir.children(4).index()); |
576 EXPECT_EQ(2, subdir.children_size()); | 602 EXPECT_EQ(2, subdir.children_size()); |
577 EXPECT_EQ("fifo", subdir.children(0).name()); | 603 EXPECT_EQ("fifo", subdir.children(0).name()); |
578 EXPECT_EQ("link", subdir.children(1).name()); | 604 EXPECT_EQ("link", subdir.children(1).name()); |
579 EXPECT_TRUE(S_ISDIR(subdir.mode())); | 605 EXPECT_TRUE(S_ISDIR(subdir.mode())); |
580 EXPECT_EQ(0, subdir.uid()); | 606 EXPECT_EQ(0, subdir.uid()); |
581 EXPECT_EQ(0, subdir.gid()); | 607 EXPECT_EQ(0, subdir.gid()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 DeltaArchiveManifest* archive = | 686 DeltaArchiveManifest* archive = |
661 DeltaDiffGenerator::EncodeMetadataToProtoBuffer( | 687 DeltaDiffGenerator::EncodeMetadataToProtoBuffer( |
662 (string(cwd) + "/diff-gen-test/new").c_str()); | 688 (string(cwd) + "/diff-gen-test/new").c_str()); |
663 EXPECT_TRUE(NULL != archive); | 689 EXPECT_TRUE(NULL != archive); |
664 | 690 |
665 EXPECT_TRUE(DeltaDiffGenerator::EncodeDataToDeltaFile( | 691 EXPECT_TRUE(DeltaDiffGenerator::EncodeDataToDeltaFile( |
666 archive, | 692 archive, |
667 string(cwd) + "/diff-gen-test/old", | 693 string(cwd) + "/diff-gen-test/old", |
668 string(cwd) + "/diff-gen-test/new", | 694 string(cwd) + "/diff-gen-test/new", |
669 string(cwd) + "/diff-gen-test/out.dat", | 695 string(cwd) + "/diff-gen-test/out.dat", |
670 "")); | 696 set<string>(), "")); |
671 // parse the file | 697 // parse the file |
672 | 698 |
673 DeltaDiffParser parser(string(cwd) + "/diff-gen-test/out.dat"); | 699 DeltaDiffParser parser(string(cwd) + "/diff-gen-test/out.dat"); |
674 ASSERT_TRUE(parser.valid()); | 700 ASSERT_TRUE(parser.valid()); |
675 DeltaDiffParser::Iterator it = parser.Begin(); | 701 DeltaDiffParser::Iterator it = parser.Begin(); |
676 string expected_paths[] = { | 702 string expected_paths[] = { |
677 "", | 703 "", |
678 "/cdev", | 704 "/cdev", |
679 "/compress_link", | 705 "/compress_link", |
680 "/dir", | 706 "/dir", |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 EXPECT_TRUE(file.has_data_format()); | 808 EXPECT_TRUE(file.has_data_format()); |
783 EXPECT_EQ(DeltaArchiveManifest_File_DataFormat_FULL, file.data_format()); | 809 EXPECT_EQ(DeltaArchiveManifest_File_DataFormat_FULL, file.data_format()); |
784 EXPECT_EQ("hello\n", ReadFilePartToString(string(cwd) + | 810 EXPECT_EQ("hello\n", ReadFilePartToString(string(cwd) + |
785 "/diff-gen-test/out.dat", | 811 "/diff-gen-test/out.dat", |
786 file.data_offset(), | 812 file.data_offset(), |
787 file.data_length())); | 813 file.data_length())); |
788 | 814 |
789 // newempty | 815 // newempty |
790 file = parser.GetFileAtPath("/dir/newempty"); | 816 file = parser.GetFileAtPath("/dir/newempty"); |
791 EXPECT_TRUE(S_ISREG(file.mode())); | 817 EXPECT_TRUE(S_ISREG(file.mode())); |
792 EXPECT_FALSE(file.has_data_format()); | 818 EXPECT_TRUE(file.has_data_format()); |
| 819 EXPECT_EQ(DeltaArchiveManifest_File_DataFormat_FULL, file.data_format()); |
793 | 820 |
794 // subdir | 821 // subdir |
795 file = parser.GetFileAtPath("/dir/subdir"); | 822 file = parser.GetFileAtPath("/dir/subdir"); |
796 EXPECT_TRUE(S_ISDIR(file.mode())); | 823 EXPECT_TRUE(S_ISDIR(file.mode())); |
797 EXPECT_FALSE(file.has_data_format()); | 824 EXPECT_FALSE(file.has_data_format()); |
798 | 825 |
799 // fifo | 826 // fifo |
800 file = parser.GetFileAtPath("/dir/subdir/fifo"); | 827 file = parser.GetFileAtPath("/dir/subdir/fifo"); |
801 EXPECT_TRUE(S_ISFIFO(file.mode())); | 828 EXPECT_TRUE(S_ISFIFO(file.mode())); |
802 EXPECT_FALSE(file.has_data_format()); | 829 EXPECT_FALSE(file.has_data_format()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 data = ReadFilePart(string(cwd) + "/diff-gen-test/out.dat", | 865 data = ReadFilePart(string(cwd) + "/diff-gen-test/out.dat", |
839 file.data_offset(), file.data_length()); | 866 file.data_offset(), file.data_length()); |
840 WriteFileVector(string(cwd) + "/diff-gen-test/patch", data); | 867 WriteFileVector(string(cwd) + "/diff-gen-test/patch", data); |
841 int rc = 1; | 868 int rc = 1; |
842 vector<string> cmd; | 869 vector<string> cmd; |
843 cmd.push_back("/usr/bin/bspatch"); | 870 cmd.push_back("/usr/bin/bspatch"); |
844 cmd.push_back(string(cwd) + "/diff-gen-test/old/encoding/long_small_change"); | 871 cmd.push_back(string(cwd) + "/diff-gen-test/old/encoding/long_small_change"); |
845 cmd.push_back(string(cwd) + "/diff-gen-test/patch_result"); | 872 cmd.push_back(string(cwd) + "/diff-gen-test/patch_result"); |
846 cmd.push_back(string(cwd) + "/diff-gen-test/patch"); | 873 cmd.push_back(string(cwd) + "/diff-gen-test/patch"); |
847 Subprocess::SynchronousExec(cmd, &rc); | 874 Subprocess::SynchronousExec(cmd, &rc); |
848 EXPECT_EQ(0, rc); | 875 ASSERT_EQ(0, rc); |
849 vector<char> patch_result; | 876 vector<char> patch_result; |
850 EXPECT_TRUE(utils::ReadFile(string(cwd) + "/diff-gen-test/patch_result", | 877 EXPECT_TRUE(utils::ReadFile(string(cwd) + "/diff-gen-test/patch_result", |
851 &patch_result)); | 878 &patch_result)); |
852 vector<char> expected_data(sizeof(kRandomString) + 1); | 879 vector<char> expected_data(sizeof(kRandomString) + 1); |
853 memcpy(&expected_data[0], kRandomString, sizeof(kRandomString)); | 880 memcpy(&expected_data[0], kRandomString, sizeof(kRandomString)); |
854 expected_data[expected_data.size() - 1] = 'h'; | 881 expected_data[expected_data.size() - 1] = 'h'; |
855 ExpectVectorsEq(expected_data, patch_result); | 882 ExpectVectorsEq(expected_data, patch_result); |
856 | 883 |
857 // nochange | 884 // nochange |
858 file = parser.GetFileAtPath("/encoding/nochange"); | 885 file = parser.GetFileAtPath("/encoding/nochange"); |
859 EXPECT_TRUE(S_ISREG(file.mode())); | 886 EXPECT_TRUE(S_ISREG(file.mode())); |
860 EXPECT_TRUE(file.has_data_format()); | 887 EXPECT_FALSE(file.has_data_format()); |
861 EXPECT_EQ(DeltaArchiveManifest_File_DataFormat_FULL, file.data_format()); | 888 EXPECT_FALSE(file.has_data_offset()); |
862 EXPECT_EQ("nochange\n", ReadFilePartToString(string(cwd) + | 889 EXPECT_FALSE(file.has_data_length()); |
863 "/diff-gen-test/out.dat", | |
864 file.data_offset(), | |
865 file.data_length())); | |
866 | 890 |
867 // onebyte | 891 // onebyte |
868 file = parser.GetFileAtPath("/encoding/onebyte"); | 892 file = parser.GetFileAtPath("/encoding/onebyte"); |
869 EXPECT_TRUE(S_ISREG(file.mode())); | 893 EXPECT_TRUE(S_ISREG(file.mode())); |
870 EXPECT_TRUE(file.has_data_format()); | 894 EXPECT_TRUE(file.has_data_format()); |
871 EXPECT_EQ(DeltaArchiveManifest_File_DataFormat_FULL, file.data_format()); | 895 EXPECT_EQ(DeltaArchiveManifest_File_DataFormat_FULL, file.data_format()); |
872 EXPECT_EQ("h", ReadFilePartToString(string(cwd) + | 896 EXPECT_EQ("h", ReadFilePartToString(string(cwd) + |
873 "/diff-gen-test/out.dat", | 897 "/diff-gen-test/out.dat", |
874 file.data_offset(), | 898 file.data_offset(), |
875 file.data_length())); | 899 file.data_length())); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 { | 946 { |
923 vector<char> data(14); | 947 vector<char> data(14); |
924 memcpy(&data[0], "CrAU\0\0\0\0\0\0\0\x0cxx", 12); | 948 memcpy(&data[0], "CrAU\0\0\0\0\0\0\0\x0cxx", 12); |
925 WriteFileVector("diff-gen-test/baddelta", data); | 949 WriteFileVector("diff-gen-test/baddelta", data); |
926 DeltaDiffParser parser("diff-gen-test/baddelta"); | 950 DeltaDiffParser parser("diff-gen-test/baddelta"); |
927 EXPECT_FALSE(parser.valid()); | 951 EXPECT_FALSE(parser.valid()); |
928 } | 952 } |
929 } | 953 } |
930 | 954 |
931 } // namespace chromeos_update_engine | 955 } // namespace chromeos_update_engine |
OLD | NEW |