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

Side by Side Diff: src/platform/update_engine/test_utils.cc

Issue 1599029: update engine: 32- and 64-bit compile (Closed)
Patch Set: int32->int32_t, PRIi64, 80 cols for review Created 10 years, 8 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
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 #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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 CHECK_LT(r, static_cast<ssize_t>(buf.size())); 50 CHECK_LT(r, static_cast<ssize_t>(buf.size()));
51 buf.resize(r); 51 buf.resize(r);
52 string ret; 52 string ret;
53 ret.insert(ret.begin(), buf.begin(), buf.end()); 53 ret.insert(ret.begin(), buf.begin(), buf.end());
54 return ret; 54 return ret;
55 } 55 }
56 56
57 std::vector<char> GzipCompressData(const std::vector<char>& data) { 57 std::vector<char> GzipCompressData(const std::vector<char>& data) {
58 const char fname[] = "/tmp/GzipCompressDataTemp"; 58 const char fname[] = "/tmp/GzipCompressDataTemp";
59 if (!WriteFileVector(fname, data)) { 59 if (!WriteFileVector(fname, data)) {
60 system((string("rm ") + fname).c_str()); 60 EXPECT_EQ(0, system((string("rm ") + fname).c_str()));
61 return vector<char>(); 61 return vector<char>();
62 } 62 }
63 system((string("cat ") + fname + "|gzip>" + fname + ".gz").c_str()); 63 EXPECT_EQ(0, system((string("cat ") + fname + "|gzip>" +
64 system((string("rm ") + fname).c_str()); 64 fname + ".gz").c_str()));
65 EXPECT_EQ(0, system((string("rm ") + fname).c_str()));
65 vector<char> ret; 66 vector<char> ret;
66 EXPECT_TRUE(utils::ReadFile(string(fname) + ".gz", &ret)); 67 EXPECT_TRUE(utils::ReadFile(string(fname) + ".gz", &ret));
67 system((string("rm ") + fname + ".gz").c_str()); 68 EXPECT_EQ(0, system((string("rm ") + fname + ".gz").c_str()));
68 return ret; 69 return ret;
69 } 70 }
70 71
71 vector<char> GenerateSampleMbr() { 72 vector<char> GenerateSampleMbr() {
72 // This is the actual MBR from my dev machine. Partition 1 (the first) 73 // This is the actual MBR from my dev machine. Partition 1 (the first)
73 // is currently marked bootable 74 // is currently marked bootable
74 char mbr[512] = { 75 char mbr[512] = {
75 0xeb, 0x48, 0x90, 0x10, 0x8e, 0xd0, 0xbc, 0x00, 76 0xeb, 0x48, 0x90, 0x10, 0x8e, 0xd0, 0xbc, 0x00,
76 0xb0, 0xb8, 0x00, 0x00, 0x8e, 0xd8, 0x8e, 0xc0, 77 0xb0, 0xb8, 0x00, 0x00, 0x8e, 0xd8, 0x8e, 0xc0,
77 0xfb, 0xbe, 0x00, 0x7c, 0xbf, 0x00, 0x06, 0xb9, 78 0xfb, 0xbe, 0x00, 0x7c, 0xbf, 0x00, 0x06, 0xb9,
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 EXPECT_TRUE(expected_paths.empty()); 264 EXPECT_TRUE(expected_paths.empty());
264 if (!expected_paths.empty()) { 265 if (!expected_paths.empty()) {
265 for (set<string>::const_iterator it = expected_paths.begin(); 266 for (set<string>::const_iterator it = expected_paths.begin();
266 it != expected_paths.end(); ++it) { 267 it != expected_paths.end(); ++it) {
267 LOG(INFO) << "extra path: " << *it; 268 LOG(INFO) << "extra path: " << *it;
268 } 269 }
269 } 270 }
270 } 271 }
271 272
272 } // namespace chromeos_update_engine 273 } // namespace chromeos_update_engine
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698