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

Side by Side Diff: syzygy/agent/asan/unittest_util.cc

Issue 2363733003: Make syzyasan_rtl compile in 64 bit (Closed)
Patch Set: Nits. Created 4 years, 2 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
« no previous file with comments | « syzygy/agent/asan/unittest_util.h ('k') | syzygy/syzygy.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 Google Inc. All Rights Reserved. 1 // Copyright 2013 Google Inc. All Rights Reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 logger_stdout_file_.reset(base::OpenFile( 178 logger_stdout_file_.reset(base::OpenFile(
179 temp_dir_.path().AppendASCII("agent_logger_stdout.txt"), "w")); 179 temp_dir_.path().AppendASCII("agent_logger_stdout.txt"), "w"));
180 CHECK(logger_stdout_file_); 180 CHECK(logger_stdout_file_);
181 logger_stderr_file_.reset(base::OpenFile( 181 logger_stderr_file_.reset(base::OpenFile(
182 temp_dir_.path().AppendASCII("agent_logger_stderr.txt"), "w")); 182 temp_dir_.path().AppendASCII("agent_logger_stderr.txt"), "w"));
183 CHECK(logger_stderr_file_); 183 CHECK(logger_stderr_file_);
184 184
185 // Save the environment we found. 185 // Save the environment we found.
186 std::unique_ptr<base::Environment> env(base::Environment::Create()); 186 std::unique_ptr<base::Environment> env(base::Environment::Create());
187 env->GetVar(kSyzygyRpcInstanceIdEnvVar, &old_logger_env_); 187 env->GetVar(kSyzygyRpcInstanceIdEnvVar, &old_logger_env_);
188 env->GetVar(common::kSyzyAsanOptionsEnvVar, &old_asan_options_env_);
188 189
189 // Configure the environment (to pass the instance id to the agent DLL). 190 // Configure the environment (to pass the instance id to the agent DLL).
190 // We append "-0" to the process id to avoid potential conflict with other 191 // We append "-0" to the process id to avoid potential conflict with other
191 // tests. 192 // tests.
192 instance_id_ = base::UintToString16(::GetCurrentProcessId()) + L"-0"; 193 instance_id_ = base::UintToString16(::GetCurrentProcessId()) + L"-0";
193 AppendToLoggerEnv(base::StringPrintf("%ls,%ls", 194 AppendToLoggerEnv(base::StringPrintf("%ls,%ls",
194 kSyzyAsanRtlDll, 195 kSyzyAsanRtlDll,
195 instance_id_.c_str())); 196 instance_id_.c_str()));
197 env->UnSetVar(common::kSyzyAsanOptionsEnvVar);
196 198
197 log_contents_read_ = false; 199 log_contents_read_ = false;
198 StartLogger(); 200 StartLogger();
199 } 201 }
200 202
201 void TestWithAsanLogger::TearDown() { 203 void TestWithAsanLogger::TearDown() {
202 StopLogger(); 204 StopLogger();
203 205
204 // Restore the environment variable as we found it. 206 // Restore the environment variable as we found it.
205 std::unique_ptr<base::Environment> env(base::Environment::Create()); 207 std::unique_ptr<base::Environment> env(base::Environment::Create());
206 env->SetVar(kSyzygyRpcInstanceIdEnvVar, old_logger_env_); 208 env->SetVar(kSyzygyRpcInstanceIdEnvVar, old_logger_env_);
209 env->SetVar(common::kSyzyAsanOptionsEnvVar, old_asan_options_env_);
207 } 210 }
208 211
209 bool TestWithAsanLogger::LogContains(const base::StringPiece& message) { 212 bool TestWithAsanLogger::LogContains(const base::StringPiece& message) {
210 if (!log_contents_read_ && logger_running_) { 213 if (!log_contents_read_ && logger_running_) {
211 CHECK(base::ReadFileToString(log_file_path_, &log_contents_)); 214 CHECK(base::ReadFileToString(log_file_path_, &log_contents_));
212 log_contents_read_ = true; 215 log_contents_read_ = true;
213 } 216 }
214 return log_contents_.find(message.as_string()) != std::string::npos; 217 return log_contents_.find(message.as_string()) != std::string::npos;
215 } 218 }
216 219
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 1165
1163 // Delete the entire range. 1166 // Delete the entire range.
1164 shadow_address_space_.Remove(iter_pair); 1167 shadow_address_space_.Remove(iter_pair);
1165 if (reinsert_head_range) 1168 if (reinsert_head_range)
1166 CHECK(shadow_address_space_.Insert(head_range, head_data)); 1169 CHECK(shadow_address_space_.Insert(head_range, head_data));
1167 if (reinsert_tail_range) 1170 if (reinsert_tail_range)
1168 CHECK(shadow_address_space_.Insert(tail_range, tail_data)); 1171 CHECK(shadow_address_space_.Insert(tail_range, tail_data));
1169 } 1172 }
1170 1173
1171 } // namespace testing 1174 } // namespace testing
OLDNEW
« no previous file with comments | « syzygy/agent/asan/unittest_util.h ('k') | syzygy/syzygy.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698