| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // builds, but only run the AddressSanitizer-specific part of the test when | 55 // builds, but only run the AddressSanitizer-specific part of the test when |
| 56 // compiled with AddressSanitizer. | 56 // compiled with AddressSanitizer. |
| 57 #if defined(ADDRESS_SANITIZER) | 57 #if defined(ADDRESS_SANITIZER) |
| 58 bool asan_build = true; | 58 bool asan_build = true; |
| 59 #else | 59 #else |
| 60 bool asan_build = false; | 60 bool asan_build = false; |
| 61 #endif | 61 #endif |
| 62 base::ScopedTempDir temp_directory; | 62 base::ScopedTempDir temp_directory; |
| 63 base::FilePath temp_file_name; | 63 base::FilePath temp_file_name; |
| 64 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); | 64 ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); |
| 65 ASSERT_TRUE(CreateTemporaryFileInDir(temp_directory.path(), &temp_file_name)); | 65 ASSERT_TRUE( |
| 66 CreateTemporaryFileInDir(temp_directory.GetPath(), &temp_file_name)); |
| 66 | 67 |
| 67 SECURITY_ATTRIBUTES attrs = {}; | 68 SECURITY_ATTRIBUTES attrs = {}; |
| 68 attrs.nLength = sizeof(attrs); | 69 attrs.nLength = sizeof(attrs); |
| 69 attrs.bInheritHandle = TRUE; | 70 attrs.bInheritHandle = TRUE; |
| 70 base::win::ScopedHandle tmp_handle( | 71 base::win::ScopedHandle tmp_handle( |
| 71 CreateFile(temp_file_name.value().c_str(), GENERIC_WRITE, | 72 CreateFile(temp_file_name.value().c_str(), GENERIC_WRITE, |
| 72 FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE, | 73 FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE, |
| 73 &attrs, OPEN_EXISTING, 0, NULL)); | 74 &attrs, OPEN_EXISTING, 0, NULL)); |
| 74 EXPECT_TRUE(tmp_handle.IsValid()); | 75 EXPECT_TRUE(tmp_handle.IsValid()); |
| 75 | 76 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 99 size_t last_slash = source_file_basename.find_last_of("/\\"); | 100 size_t last_slash = source_file_basename.find_last_of("/\\"); |
| 100 last_slash = last_slash == std::string::npos ? 0 : last_slash + 1; | 101 last_slash = last_slash == std::string::npos ? 0 : last_slash + 1; |
| 101 ASSERT_TRUE(strstr(data.c_str(), &source_file_basename[last_slash])) | 102 ASSERT_TRUE(strstr(data.c_str(), &source_file_basename[last_slash])) |
| 102 << "The stack trace doesn't have a correct filename:\n" << data; | 103 << "The stack trace doesn't have a correct filename:\n" << data; |
| 103 } else { | 104 } else { |
| 104 LOG(WARNING) << "Not an AddressSanitizer build, skipping the run."; | 105 LOG(WARNING) << "Not an AddressSanitizer build, skipping the run."; |
| 105 } | 106 } |
| 106 } | 107 } |
| 107 | 108 |
| 108 } // namespace sandbox | 109 } // namespace sandbox |
| OLD | NEW |