ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 1 | // Copyright 2017 The Bazel Authors. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (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 |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
laszlocsomor | a300ae8 | 2019-08-07 06:28:59 -0700 | [diff] [blame] | 15 | #include "src/main/cpp/rc_file.h" |
| 16 | |
| 17 | #include <memory> |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 18 | |
| 19 | #include "src/main/cpp/bazel_startup_options.h" |
| 20 | #include "src/main/cpp/blaze_util.h" |
| 21 | #include "src/main/cpp/blaze_util_platform.h" |
| 22 | #include "src/main/cpp/option_processor-internal.h" |
laszlocsomor | a300ae8 | 2019-08-07 06:28:59 -0700 | [diff] [blame] | 23 | #include "src/main/cpp/option_processor.h" |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 24 | #include "src/main/cpp/util/file.h" |
| 25 | #include "src/main/cpp/util/file_platform.h" |
ccalvarin | ac69da0 | 2018-06-05 15:27:26 -0700 | [diff] [blame] | 26 | #include "src/main/cpp/util/path.h" |
ccalvarin | bccf9c6 | 2018-06-20 15:05:23 -0700 | [diff] [blame] | 27 | #include "src/main/cpp/util/path_platform.h" |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 28 | #include "src/main/cpp/workspace_layout.h" |
| 29 | #include "googlemock/include/gmock/gmock.h" |
| 30 | #include "googletest/include/gtest/gtest.h" |
| 31 | |
| 32 | namespace blaze { |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 33 | using ::testing::ContainsRegex; |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 34 | using ::testing::HasSubstr; |
| 35 | using ::testing::MatchesRegex; |
| 36 | |
Loo Rong Jie | 4022bac | 2018-06-11 02:04:52 -0700 | [diff] [blame] | 37 | #if defined(_WIN32) || defined(__CYGWIN__) |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 38 | constexpr const char* kNullDevice = "NUL"; |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 39 | #else // Assume POSIX if not Windows. |
| 40 | constexpr const char* kNullDevice = "/dev/null"; |
| 41 | #endif |
| 42 | |
| 43 | class RcFileTest : public ::testing::Test { |
| 44 | protected: |
| 45 | RcFileTest() |
Laszlo Csomor | 0d10749 | 2019-03-13 09:04:27 -0700 | [diff] [blame] | 46 | : workspace_(blaze_util::JoinPath(blaze::GetPathEnv("TEST_TMPDIR"), |
| 47 | "workspace")), |
| 48 | cwd_(blaze_util::JoinPath(blaze::GetPathEnv("TEST_TMPDIR"), "cwd")), |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 49 | binary_dir_( |
Laszlo Csomor | 0d10749 | 2019-03-13 09:04:27 -0700 | [diff] [blame] | 50 | blaze_util::JoinPath(blaze::GetPathEnv("TEST_TMPDIR"), "bazeldir")), |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 51 | binary_path_(blaze_util::JoinPath(binary_dir_, "bazel")), |
Yannic Bonenberger | 45d5200 | 2018-09-14 16:11:36 -0700 | [diff] [blame] | 52 | workspace_layout_(new WorkspaceLayout()) {} |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 53 | |
| 54 | void SetUp() override { |
| 55 | ASSERT_TRUE(blaze_util::MakeDirectories(workspace_, 0755)); |
| 56 | ASSERT_TRUE(blaze_util::MakeDirectories(cwd_, 0755)); |
ccalvarin | bccf9c6 | 2018-06-20 15:05:23 -0700 | [diff] [blame] | 57 | ASSERT_TRUE(blaze_util::ChangeDirectory(cwd_)); |
| 58 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 59 | // GetCwd returns a short path on Windows, so we store this expectation now |
| 60 | // to keep assertions sane in the tests. |
| 61 | std::string short_cwd; |
| 62 | std::string error; |
| 63 | ASSERT_TRUE(blaze_util::AsShortWindowsPath(cwd_, &short_cwd, &error)) |
| 64 | << error; |
| 65 | cwd_ = short_cwd; |
| 66 | |
| 67 | #endif |
| 68 | |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 69 | ASSERT_TRUE(blaze_util::MakeDirectories(binary_dir_, 0755)); |
| 70 | option_processor_.reset(new OptionProcessor( |
| 71 | workspace_layout_.get(), |
| 72 | std::unique_ptr<StartupOptions>( |
Yannic Bonenberger | 45d5200 | 2018-09-14 16:11:36 -0700 | [diff] [blame] | 73 | new BazelStartupOptions(workspace_layout_.get())), |
| 74 | "bazel.bazelrc")); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | void TearDown() override { |
| 78 | // TODO(bazel-team): The code below deletes all the files in the workspace |
| 79 | // and other rc-related directories, but it intentionally skips directories. |
| 80 | // As a consequence, there may be empty directories from test to test. |
| 81 | // Remove this once blaze_util::DeleteDirectories(path) exists. |
| 82 | std::vector<std::string> files; |
| 83 | blaze_util::GetAllFilesUnder(workspace_, &files); |
| 84 | for (const std::string& file : files) { |
| 85 | blaze_util::UnlinkPath(file); |
| 86 | } |
| 87 | blaze_util::GetAllFilesUnder(cwd_, &files); |
| 88 | for (const std::string& file : files) { |
| 89 | blaze_util::UnlinkPath(file); |
| 90 | } |
| 91 | blaze_util::GetAllFilesUnder(binary_dir_, &files); |
| 92 | for (const std::string& file : files) { |
| 93 | blaze_util::UnlinkPath(file); |
| 94 | } |
| 95 | } |
| 96 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 97 | bool SetUpSystemRcFile(const std::string& contents, |
ccalvarin | bccf9c6 | 2018-06-20 15:05:23 -0700 | [diff] [blame] | 98 | std::string* rcfile_path) const { |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 99 | const std::string system_rc_path = |
ccalvarin | bccf9c6 | 2018-06-20 15:05:23 -0700 | [diff] [blame] | 100 | blaze_util::ConvertPath(blaze_util::JoinPath(cwd_, "bazel.bazelrc")); |
| 101 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 102 | if (blaze_util::WriteFile(contents, system_rc_path, 0755)) { |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 103 | *rcfile_path = blaze_util::MakeCanonical(system_rc_path.c_str()); |
ccalvarin | bccf9c6 | 2018-06-20 15:05:23 -0700 | [diff] [blame] | 104 | return true; |
| 105 | } |
| 106 | return false; |
| 107 | } |
| 108 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 109 | bool SetUpWorkspaceRcFile(const std::string& contents, |
| 110 | std::string* rcfile_path) const { |
| 111 | const std::string workspace_user_rc_path = |
| 112 | blaze_util::JoinPath(workspace_, ".bazelrc"); |
| 113 | if (blaze_util::WriteFile(contents, workspace_user_rc_path, 0755)) { |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 114 | *rcfile_path = blaze_util::MakeCanonical(workspace_user_rc_path.c_str()); |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 115 | return true; |
| 116 | } |
| 117 | return false; |
| 118 | } |
| 119 | |
| 120 | // TODO(b/36168162): Make it possible to configure the home directory so we |
| 121 | // can test --home_rc as well. |
| 122 | |
| 123 | bool SetUpLegacyMasterRcFileInWorkspace(const std::string& contents, |
| 124 | std::string* rcfile_path) const { |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 125 | const std::string tools_dir = blaze_util::JoinPath(workspace_, "tools"); |
| 126 | const std::string workspace_rc_path = |
| 127 | blaze_util::JoinPath(tools_dir, "bazel.rc"); |
| 128 | if (blaze_util::MakeDirectories(tools_dir, 0755) && |
| 129 | blaze_util::WriteFile(contents, workspace_rc_path, 0755)) { |
| 130 | *rcfile_path = workspace_rc_path; |
| 131 | return true; |
| 132 | } |
| 133 | return false; |
| 134 | } |
| 135 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 136 | bool SetUpLegacyMasterRcFileAlongsideBinary(const std::string& contents, |
| 137 | std::string* rcfile_path) const { |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 138 | const std::string binary_rc_path = |
| 139 | blaze_util::JoinPath(binary_dir_, "bazel.bazelrc"); |
| 140 | if (blaze_util::WriteFile(contents, binary_rc_path, 0755)) { |
| 141 | *rcfile_path = binary_rc_path; |
| 142 | return true; |
| 143 | } |
| 144 | return false; |
| 145 | } |
| 146 | |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 147 | const std::string workspace_; |
ccalvarin | bccf9c6 | 2018-06-20 15:05:23 -0700 | [diff] [blame] | 148 | std::string cwd_; |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 149 | const std::string binary_dir_; |
| 150 | const std::string binary_path_; |
| 151 | const std::unique_ptr<WorkspaceLayout> workspace_layout_; |
ccalvarin | bccf9c6 | 2018-06-20 15:05:23 -0700 | [diff] [blame] | 152 | const std::string old_system_bazelrc_path_; |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 153 | std::unique_ptr<OptionProcessor> option_processor_; |
| 154 | }; |
| 155 | |
| 156 | using GetRcFileTest = RcFileTest; |
| 157 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 158 | TEST_F(GetRcFileTest, GetRcFilesLoadsAllDefaultBazelrcs) { |
| 159 | std::string system_rc; |
| 160 | ASSERT_TRUE(SetUpSystemRcFile("", &system_rc)); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 161 | std::string workspace_rc; |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 162 | ASSERT_TRUE(SetUpWorkspaceRcFile("", &workspace_rc)); |
| 163 | |
| 164 | const CommandLine cmd_line = CommandLine(binary_path_, {}, "build", {}); |
| 165 | std::string error = "check that this string is not modified"; |
| 166 | std::vector<std::unique_ptr<RcFile>> parsed_rcs; |
| 167 | const blaze_exit_code::ExitCode exit_code = |
| 168 | option_processor_->GetRcFiles(workspace_layout_.get(), workspace_, cwd_, |
| 169 | &cmd_line, &parsed_rcs, &error); |
| 170 | EXPECT_EQ(blaze_exit_code::SUCCESS, exit_code); |
| 171 | EXPECT_EQ("check that this string is not modified", error); |
| 172 | |
| 173 | // There should be 2 rc files: the system one and the workspace one. --bazelrc |
| 174 | // is not passed and therefore is not relevant. |
| 175 | ASSERT_EQ(2, parsed_rcs.size()); |
| 176 | const std::deque<std::string> expected_system_rc_que = {system_rc}; |
| 177 | const std::deque<std::string> expected_workspace_rc_que = {workspace_rc}; |
Laszlo Csomor | 9b83bd7 | 2018-12-17 08:42:44 -0800 | [diff] [blame] | 178 | EXPECT_EQ(expected_system_rc_que, |
| 179 | parsed_rcs[0].get()->canonical_source_paths()); |
| 180 | EXPECT_EQ(expected_workspace_rc_que, |
| 181 | parsed_rcs[1].get()->canonical_source_paths()); |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | TEST_F(GetRcFileTest, GetRcFilesRespectsNoSystemRc) { |
| 185 | std::string system_rc; |
| 186 | ASSERT_TRUE(SetUpSystemRcFile("", &system_rc)); |
| 187 | std::string workspace_rc; |
| 188 | ASSERT_TRUE(SetUpWorkspaceRcFile("", &workspace_rc)); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 189 | |
| 190 | const CommandLine cmd_line = |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 191 | CommandLine(binary_path_, {"--nosystem_rc"}, "build", {}); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 192 | std::string error = "check that this string is not modified"; |
| 193 | std::vector<std::unique_ptr<RcFile>> parsed_rcs; |
| 194 | const blaze_exit_code::ExitCode exit_code = |
| 195 | option_processor_->GetRcFiles(workspace_layout_.get(), workspace_, cwd_, |
| 196 | &cmd_line, &parsed_rcs, &error); |
| 197 | EXPECT_EQ(blaze_exit_code::SUCCESS, exit_code); |
| 198 | EXPECT_EQ("check that this string is not modified", error); |
| 199 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 200 | ASSERT_EQ(1, parsed_rcs.size()); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 201 | const std::deque<std::string> expected_workspace_rc_que = {workspace_rc}; |
Laszlo Csomor | 9b83bd7 | 2018-12-17 08:42:44 -0800 | [diff] [blame] | 202 | EXPECT_EQ(expected_workspace_rc_que, |
| 203 | parsed_rcs[0].get()->canonical_source_paths()); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 204 | } |
| 205 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 206 | TEST_F(GetRcFileTest, GetRcFilesRespectsNoWorkspaceRc) { |
| 207 | std::string system_rc; |
| 208 | ASSERT_TRUE(SetUpSystemRcFile("", &system_rc)); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 209 | std::string workspace_rc; |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 210 | ASSERT_TRUE(SetUpWorkspaceRcFile("", &workspace_rc)); |
| 211 | |
| 212 | const CommandLine cmd_line = |
| 213 | CommandLine(binary_path_, {"--noworkspace_rc"}, "build", {}); |
| 214 | std::string error = "check that this string is not modified"; |
| 215 | std::vector<std::unique_ptr<RcFile>> parsed_rcs; |
| 216 | const blaze_exit_code::ExitCode exit_code = |
| 217 | option_processor_->GetRcFiles(workspace_layout_.get(), workspace_, cwd_, |
| 218 | &cmd_line, &parsed_rcs, &error); |
| 219 | EXPECT_EQ(blaze_exit_code::SUCCESS, exit_code); |
| 220 | EXPECT_EQ("check that this string is not modified", error); |
| 221 | |
| 222 | ASSERT_EQ(1, parsed_rcs.size()); |
| 223 | const std::deque<std::string> expected_system_rc_que = {system_rc}; |
Laszlo Csomor | 9b83bd7 | 2018-12-17 08:42:44 -0800 | [diff] [blame] | 224 | EXPECT_EQ(expected_system_rc_que, |
| 225 | parsed_rcs[0].get()->canonical_source_paths()); |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | TEST_F(GetRcFileTest, GetRcFilesRespectsNoWorkspaceRcAndNoSystemCombined) { |
| 229 | std::string system_rc; |
| 230 | ASSERT_TRUE(SetUpSystemRcFile("", &system_rc)); |
| 231 | std::string workspace_rc; |
| 232 | ASSERT_TRUE(SetUpWorkspaceRcFile("", &workspace_rc)); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 233 | |
| 234 | const CommandLine cmd_line = CommandLine( |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 235 | binary_path_, {"--noworkspace_rc", "--nosystem_rc"}, "build", {}); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 236 | std::string error = "check that this string is not modified"; |
| 237 | std::vector<std::unique_ptr<RcFile>> parsed_rcs; |
| 238 | const blaze_exit_code::ExitCode exit_code = |
| 239 | option_processor_->GetRcFiles(workspace_layout_.get(), workspace_, cwd_, |
| 240 | &cmd_line, &parsed_rcs, &error); |
| 241 | EXPECT_EQ(blaze_exit_code::SUCCESS, exit_code); |
| 242 | EXPECT_EQ("check that this string is not modified", error); |
| 243 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 244 | ASSERT_EQ(0, parsed_rcs.size()); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 245 | } |
| 246 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 247 | TEST_F(GetRcFileTest, GetRcFilesWarnsAboutIgnoredMasterRcFiles) { |
| 248 | std::string workspace_rc; |
| 249 | ASSERT_TRUE(SetUpLegacyMasterRcFileInWorkspace("", &workspace_rc)); |
| 250 | std::string binary_rc; |
| 251 | ASSERT_TRUE(SetUpLegacyMasterRcFileAlongsideBinary("", &binary_rc)); |
| 252 | |
| 253 | const CommandLine cmd_line = CommandLine(binary_path_, {}, "build", {}); |
| 254 | std::string error = "check that this string is not modified"; |
| 255 | std::vector<std::unique_ptr<RcFile>> parsed_rcs; |
| 256 | |
| 257 | testing::internal::CaptureStderr(); |
| 258 | const blaze_exit_code::ExitCode exit_code = |
| 259 | option_processor_->GetRcFiles(workspace_layout_.get(), workspace_, cwd_, |
| 260 | &cmd_line, &parsed_rcs, &error); |
ccalvarin | 375d593 | 2018-08-23 14:25:49 -0700 | [diff] [blame] | 261 | const std::string output = testing::internal::GetCapturedStderr(); |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 262 | |
| 263 | EXPECT_EQ(blaze_exit_code::SUCCESS, exit_code); |
| 264 | EXPECT_EQ("check that this string is not modified", error); |
| 265 | |
| 266 | // Expect that GetRcFiles outputs a warning about these files that are not |
| 267 | // read as expected. |
| 268 | EXPECT_THAT(output, |
| 269 | HasSubstr("The following rc files are no longer being read")); |
dslomov | a6c7758 | 2018-10-09 13:56:38 -0700 | [diff] [blame] | 270 | EXPECT_THAT(output, HasSubstr(workspace_rc)); |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 271 | EXPECT_THAT(output, HasSubstr(binary_rc)); |
| 272 | } |
| 273 | |
| 274 | TEST_F( |
| 275 | GetRcFileTest, |
| 276 | GetRcFilesDoesNotWarnAboutIgnoredMasterRcFilesWhenNoMasterBazelrcIsPassed) { |
| 277 | std::string workspace_rc; |
| 278 | ASSERT_TRUE(SetUpLegacyMasterRcFileInWorkspace("", &workspace_rc)); |
| 279 | std::string binary_rc; |
| 280 | ASSERT_TRUE(SetUpLegacyMasterRcFileAlongsideBinary("", &binary_rc)); |
| 281 | |
| 282 | const CommandLine cmd_line = |
| 283 | CommandLine(binary_path_, {"--nomaster_bazelrc"}, "build", {}); |
| 284 | std::string error = "check that this string is not modified"; |
| 285 | std::vector<std::unique_ptr<RcFile>> parsed_rcs; |
| 286 | |
| 287 | testing::internal::CaptureStderr(); |
| 288 | const blaze_exit_code::ExitCode exit_code = |
| 289 | option_processor_->GetRcFiles(workspace_layout_.get(), workspace_, cwd_, |
| 290 | &cmd_line, &parsed_rcs, &error); |
ccalvarin | 375d593 | 2018-08-23 14:25:49 -0700 | [diff] [blame] | 291 | const std::string output = testing::internal::GetCapturedStderr(); |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 292 | |
| 293 | EXPECT_EQ(blaze_exit_code::SUCCESS, exit_code); |
| 294 | EXPECT_EQ("check that this string is not modified", error); |
| 295 | |
| 296 | // Expect that nothing is logged to stderr about ignored rc files when these |
| 297 | // files are disabled. |
| 298 | EXPECT_THAT( |
| 299 | output, |
| 300 | Not(HasSubstr("The following rc files are no longer being read"))); |
| 301 | EXPECT_THAT(output, Not(HasSubstr(workspace_rc))); |
| 302 | EXPECT_THAT(output, Not(HasSubstr(binary_rc))); |
| 303 | } |
| 304 | |
| 305 | TEST_F(GetRcFileTest, GetRcFilesReadsCommandLineRc) { |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 306 | const std::string cmdline_rc_path = |
| 307 | blaze_util::JoinPath(workspace_, "mybazelrc"); |
| 308 | ASSERT_TRUE( |
| 309 | blaze_util::MakeDirectories(blaze_util::Dirname(cmdline_rc_path), 0755)); |
| 310 | ASSERT_TRUE(blaze_util::WriteFile("", cmdline_rc_path, 0755)); |
| 311 | |
| 312 | const CommandLine cmd_line = CommandLine( |
| 313 | binary_path_, {"--nomaster_bazelrc", "--bazelrc=" + cmdline_rc_path}, |
| 314 | "build", {}); |
| 315 | std::string error = "check that this string is not modified"; |
| 316 | std::vector<std::unique_ptr<RcFile>> parsed_rcs; |
| 317 | const blaze_exit_code::ExitCode exit_code = |
| 318 | option_processor_->GetRcFiles(workspace_layout_.get(), workspace_, cwd_, |
| 319 | &cmd_line, &parsed_rcs, &error); |
| 320 | EXPECT_EQ(blaze_exit_code::SUCCESS, exit_code); |
| 321 | EXPECT_EQ("check that this string is not modified", error); |
| 322 | |
| 323 | // Because of the variety of path representations in windows, this |
| 324 | // equality test does not attempt to check the entire path. |
| 325 | ASSERT_EQ(1, parsed_rcs.size()); |
Laszlo Csomor | 9b83bd7 | 2018-12-17 08:42:44 -0800 | [diff] [blame] | 326 | ASSERT_EQ(1, parsed_rcs[0].get()->canonical_source_paths().size()); |
| 327 | EXPECT_THAT(parsed_rcs[0].get()->canonical_source_paths().front(), |
| 328 | HasSubstr("mybazelrc")); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 329 | } |
| 330 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 331 | TEST_F(GetRcFileTest, GetRcFilesAcceptsNullCommandLineRc) { |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 332 | const CommandLine cmd_line = |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 333 | CommandLine(binary_path_, |
| 334 | {"--nosystem_rc", "--noworkspace_rc", "--nohome_rc", |
| 335 | "--bazelrc=/dev/null"}, |
| 336 | "build", {}); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 337 | std::string error = "check that this string is not modified"; |
| 338 | std::vector<std::unique_ptr<RcFile>> parsed_rcs; |
| 339 | const blaze_exit_code::ExitCode exit_code = |
| 340 | option_processor_->GetRcFiles(workspace_layout_.get(), workspace_, cwd_, |
| 341 | &cmd_line, &parsed_rcs, &error); |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 342 | // /dev/null is not an error |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 343 | EXPECT_EQ(blaze_exit_code::SUCCESS, exit_code); |
| 344 | EXPECT_EQ("check that this string is not modified", error); |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 345 | // but it does technically count as a file |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 346 | ASSERT_EQ(1, parsed_rcs.size()); |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 347 | const std::deque<std::string> expected_rc_que = {kNullDevice}; |
Laszlo Csomor | 9b83bd7 | 2018-12-17 08:42:44 -0800 | [diff] [blame] | 348 | EXPECT_EQ(expected_rc_que, parsed_rcs[0].get()->canonical_source_paths()); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 349 | } |
| 350 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 351 | class ParseOptionsTest : public RcFileTest { |
| 352 | protected: |
| 353 | void ParseOptionsAndCheckOutput( |
| 354 | const std::vector<std::string>& args, |
| 355 | const blaze_exit_code::ExitCode expected_exit_code, |
| 356 | const std::string& expected_error_regex, |
| 357 | const std::string& expected_output_regex) { |
| 358 | std::string error; |
| 359 | testing::internal::CaptureStderr(); |
| 360 | const blaze_exit_code::ExitCode exit_code = |
| 361 | option_processor_->ParseOptions(args, workspace_, cwd_, &error); |
| 362 | const std::string output = testing::internal::GetCapturedStderr(); |
| 363 | |
| 364 | ASSERT_EQ(expected_exit_code, exit_code) << error; |
| 365 | ASSERT_THAT(error, ContainsRegex(expected_error_regex)); |
| 366 | ASSERT_THAT(output, ContainsRegex(expected_output_regex)); |
| 367 | } |
| 368 | }; |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 369 | |
ccalvarin | 90e116c | 2018-05-15 16:41:19 -0700 | [diff] [blame] | 370 | TEST_F(ParseOptionsTest, IgnoreAllRcFilesIgnoresAllMasterAndUserRcFiles) { |
| 371 | // Put fake options in different expected rc files, to check that none of them |
| 372 | // are read. |
ccalvarin | d96f157 | 2018-08-22 11:18:53 -0700 | [diff] [blame] | 373 | std::string workspace_rc; |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 374 | ASSERT_TRUE(SetUpWorkspaceRcFile("startup --workspacefoo", &workspace_rc)); |
| 375 | std::string system_rc; |
| 376 | ASSERT_TRUE(SetUpSystemRcFile("startup --systemfoo", &system_rc)); |
| 377 | const std::string cmdline_rc_path = |
| 378 | blaze_util::JoinPath(workspace_, "mybazelrc"); |
| 379 | ASSERT_TRUE( |
| 380 | blaze_util::MakeDirectories(blaze_util::Dirname(cmdline_rc_path), 0755)); |
| 381 | ASSERT_TRUE(blaze_util::WriteFile("startup --myfoo", cmdline_rc_path, 0755)); |
ccalvarin | 90e116c | 2018-05-15 16:41:19 -0700 | [diff] [blame] | 382 | |
| 383 | const std::vector<std::string> args = {binary_path_, "--ignore_all_rc_files", |
| 384 | "build"}; |
| 385 | // Expect no error due to the incorrect options, as non of them should have |
| 386 | // been loaded. |
| 387 | std::string error; |
| 388 | EXPECT_EQ(blaze_exit_code::SUCCESS, |
| 389 | option_processor_->ParseOptions(args, workspace_, cwd_, &error)); |
| 390 | ASSERT_EQ("", error); |
| 391 | |
| 392 | // Check that the startup options' provenance message contains nothing |
| 393 | testing::internal::CaptureStderr(); |
| 394 | option_processor_->PrintStartupOptionsProvenanceMessage(); |
ccalvarin | 375d593 | 2018-08-23 14:25:49 -0700 | [diff] [blame] | 395 | const std::string output = testing::internal::GetCapturedStderr(); |
ccalvarin | 90e116c | 2018-05-15 16:41:19 -0700 | [diff] [blame] | 396 | |
| 397 | EXPECT_EQ(output, ""); |
| 398 | } |
| 399 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 400 | TEST_F(ParseOptionsTest, LaterIgnoreAllRcFilesValueWins) { |
ccalvarin | 90e116c | 2018-05-15 16:41:19 -0700 | [diff] [blame] | 401 | std::string workspace_rc; |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 402 | ASSERT_TRUE(SetUpWorkspaceRcFile("startup --workspacefoo", &workspace_rc)); |
ccalvarin | 90e116c | 2018-05-15 16:41:19 -0700 | [diff] [blame] | 403 | |
| 404 | const std::vector<std::string> args = {binary_path_, "--ignore_all_rc_files", |
| 405 | "--noignore_all_rc_files", "build"}; |
| 406 | std::string error; |
| 407 | EXPECT_EQ(blaze_exit_code::BAD_ARGV, |
| 408 | option_processor_->ParseOptions(args, workspace_, cwd_, &error)); |
| 409 | ASSERT_EQ( |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 410 | "Unknown startup option: '--workspacefoo'.\n For more info, run " |
ccalvarin | 90e116c | 2018-05-15 16:41:19 -0700 | [diff] [blame] | 411 | "'bazel help startup_options'.", |
| 412 | error); |
| 413 | |
| 414 | // Check that the startup options' provenance message contains the provenance |
| 415 | // of the incorrect option. |
| 416 | testing::internal::CaptureStderr(); |
| 417 | option_processor_->PrintStartupOptionsProvenanceMessage(); |
ccalvarin | 375d593 | 2018-08-23 14:25:49 -0700 | [diff] [blame] | 418 | const std::string output = testing::internal::GetCapturedStderr(); |
ccalvarin | 90e116c | 2018-05-15 16:41:19 -0700 | [diff] [blame] | 419 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 420 | EXPECT_THAT( |
| 421 | output, |
| 422 | MatchesRegex("INFO: Reading 'startup' options from .*workspace.*bazelrc: " |
| 423 | "--workspacefoo\n")); |
ccalvarin | 90e116c | 2018-05-15 16:41:19 -0700 | [diff] [blame] | 424 | } |
| 425 | |
| 426 | TEST_F(ParseOptionsTest, IgnoreAllRcFilesIgnoresCommandLineRcFileToo) { |
| 427 | // Put fake options in different expected rc files, to check that none of them |
| 428 | // are read. |
| 429 | std::string workspace_rc; |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 430 | ASSERT_TRUE(SetUpWorkspaceRcFile("startup --workspacefoo", &workspace_rc)); |
| 431 | std::string system_rc; |
| 432 | ASSERT_TRUE(SetUpSystemRcFile("startup --systemfoo", &system_rc)); |
| 433 | |
ccalvarin | 90e116c | 2018-05-15 16:41:19 -0700 | [diff] [blame] | 434 | const std::string cmdline_rc_path = |
| 435 | blaze_util::JoinPath(workspace_, "mybazelrc"); |
| 436 | ASSERT_TRUE( |
| 437 | blaze_util::MakeDirectories(blaze_util::Dirname(cmdline_rc_path), 0755)); |
| 438 | ASSERT_TRUE( |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 439 | blaze_util::WriteFile("startup --cmdlinefoo", cmdline_rc_path, 0755)); |
ccalvarin | 90e116c | 2018-05-15 16:41:19 -0700 | [diff] [blame] | 440 | |
| 441 | const std::vector<std::string> args = {binary_path_, "--ignore_all_rc_files", |
| 442 | "--bazelrc=" + cmdline_rc_path, |
| 443 | "build"}; |
| 444 | // Expect no error due to the incorrect options, as non of them should have |
| 445 | // been loaded. |
| 446 | std::string error; |
| 447 | EXPECT_EQ(blaze_exit_code::SUCCESS, |
| 448 | option_processor_->ParseOptions(args, workspace_, cwd_, &error)); |
| 449 | ASSERT_EQ("", error); |
| 450 | |
| 451 | // Check that the startup options' provenance message contains nothing |
| 452 | testing::internal::CaptureStderr(); |
| 453 | option_processor_->PrintStartupOptionsProvenanceMessage(); |
ccalvarin | 375d593 | 2018-08-23 14:25:49 -0700 | [diff] [blame] | 454 | const std::string output = testing::internal::GetCapturedStderr(); |
ccalvarin | 90e116c | 2018-05-15 16:41:19 -0700 | [diff] [blame] | 455 | |
| 456 | EXPECT_EQ(output, ""); |
| 457 | } |
| 458 | |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 459 | TEST_F(ParseOptionsTest, CommandLineBazelrcHasUnknownOption) { |
| 460 | const std::string cmdline_rc_path = |
| 461 | blaze_util::JoinPath(workspace_, "mybazelrc"); |
| 462 | ASSERT_TRUE( |
| 463 | blaze_util::MakeDirectories(blaze_util::Dirname(cmdline_rc_path), 0755)); |
| 464 | ASSERT_TRUE(blaze_util::WriteFile("startup --foo", cmdline_rc_path, 0755)); |
| 465 | |
| 466 | const std::vector<std::string> args = {binary_path_, "--nomaster_bazelrc", |
| 467 | "--bazelrc=" + cmdline_rc_path, |
| 468 | "build"}; |
| 469 | const std::string expected_error = |
| 470 | "Unknown startup option: '--foo'.\n" |
| 471 | " For more info, run 'bazel help startup_options'."; |
| 472 | std::string error; |
| 473 | ASSERT_NE(blaze_exit_code::SUCCESS, |
| 474 | option_processor_->ParseOptions(args, workspace_, cwd_, &error)) |
| 475 | << error; |
| 476 | ASSERT_EQ(expected_error, error); |
| 477 | |
| 478 | // Check that the startup options' provenance message contains the correct |
| 479 | // information for the incorrect flag, and does not print the command-line |
| 480 | // provided startup flags. |
| 481 | testing::internal::CaptureStderr(); |
| 482 | option_processor_->PrintStartupOptionsProvenanceMessage(); |
ccalvarin | 375d593 | 2018-08-23 14:25:49 -0700 | [diff] [blame] | 483 | const std::string output = testing::internal::GetCapturedStderr(); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 484 | |
| 485 | EXPECT_THAT(output, |
| 486 | MatchesRegex( |
| 487 | "INFO: Reading 'startup' options from .*mybazelrc: --foo\n")); |
| 488 | } |
| 489 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 490 | TEST_F(ParseOptionsTest, BazelrcHasUnknownOption) { |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 491 | std::string workspace_rc; |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 492 | ASSERT_TRUE(SetUpWorkspaceRcFile("startup --foo", &workspace_rc)); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 493 | |
| 494 | const std::vector<std::string> args = {binary_path_, "build"}; |
| 495 | |
| 496 | // Expect no error due to the incorrect --foo. |
| 497 | std::string error; |
| 498 | EXPECT_EQ(blaze_exit_code::BAD_ARGV, |
| 499 | option_processor_->ParseOptions(args, workspace_, cwd_, &error)); |
| 500 | ASSERT_EQ( |
| 501 | "Unknown startup option: '--foo'.\n" |
| 502 | " For more info, run 'bazel help startup_options'.", |
| 503 | error); |
| 504 | |
| 505 | // Check that the startup options' provenance message contains nothing for the |
| 506 | // master bazelrc. |
| 507 | testing::internal::CaptureStderr(); |
| 508 | option_processor_->PrintStartupOptionsProvenanceMessage(); |
ccalvarin | 375d593 | 2018-08-23 14:25:49 -0700 | [diff] [blame] | 509 | const std::string output = testing::internal::GetCapturedStderr(); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 510 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 511 | EXPECT_THAT(output, MatchesRegex("INFO: Reading 'startup' options from " |
| 512 | ".*workspace.*bazelrc: --foo\n")); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 513 | } |
| 514 | |
| 515 | TEST_F(ParseOptionsTest, |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 516 | IncorrectWorkspaceBazelrcIgnoredWhenNoWorkspaceRcIsPresent) { |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 517 | std::string workspace_rc; |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 518 | ASSERT_TRUE(SetUpWorkspaceRcFile("startup --foo", &workspace_rc)); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 519 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 520 | const std::vector<std::string> args = {binary_path_, "--noworkspace_rc", |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 521 | "build"}; |
| 522 | |
| 523 | // Expect no error due to the incorrect --foo. |
| 524 | std::string error; |
| 525 | EXPECT_EQ(blaze_exit_code::SUCCESS, |
| 526 | option_processor_->ParseOptions(args, workspace_, cwd_, &error)); |
| 527 | ASSERT_EQ("", error); |
| 528 | |
| 529 | // Check that the startup options' provenance message contains nothing for the |
| 530 | // master bazelrc. |
| 531 | testing::internal::CaptureStderr(); |
| 532 | option_processor_->PrintStartupOptionsProvenanceMessage(); |
ccalvarin | 375d593 | 2018-08-23 14:25:49 -0700 | [diff] [blame] | 533 | const std::string output = testing::internal::GetCapturedStderr(); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 534 | |
| 535 | EXPECT_EQ(output, ""); |
| 536 | } |
| 537 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 538 | TEST_F(ParseOptionsTest, PositiveOptionOverridesNegativeOption) { |
| 539 | std::string workspace_rc; |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 540 | ASSERT_TRUE( |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 541 | SetUpWorkspaceRcFile("startup --max_idle_secs=123", &workspace_rc)); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 542 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 543 | const std::vector<std::string> args = {"bazel", "--noworkspace_rc", |
| 544 | "--workspace_rc", "build"}; |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 545 | ParseOptionsAndCheckOutput(args, blaze_exit_code::SUCCESS, "", ""); |
ccalvarin | 2d3adfb | 2018-08-22 08:56:27 -0700 | [diff] [blame] | 546 | |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 547 | EXPECT_EQ(123, option_processor_->GetParsedStartupOptions()->max_idle_secs); |
| 548 | |
| 549 | // Check that the startup options' provenance message contains the correct |
| 550 | // information for the master bazelrc. |
| 551 | testing::internal::CaptureStderr(); |
| 552 | option_processor_->PrintStartupOptionsProvenanceMessage(); |
ccalvarin | 375d593 | 2018-08-23 14:25:49 -0700 | [diff] [blame] | 553 | const std::string output = testing::internal::GetCapturedStderr(); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 554 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 555 | EXPECT_THAT(output, |
| 556 | MatchesRegex("INFO: Reading 'startup' options from " |
| 557 | ".*workspace.*bazelrc: --max_idle_secs=123\n")); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 558 | } |
| 559 | |
| 560 | TEST_F(ParseOptionsTest, MultipleStartupArgsInMasterBazelrcWorksCorrectly) { |
| 561 | // Add startup flags to the master bazelrc. |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 562 | std::string workspace_rc; |
| 563 | ASSERT_TRUE(SetUpWorkspaceRcFile( |
| 564 | "startup --max_idle_secs=42\nstartup --io_nice_level=6", &workspace_rc)); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 565 | |
| 566 | const std::vector<std::string> args = {binary_path_, "build"}; |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 567 | ParseOptionsAndCheckOutput(args, blaze_exit_code::SUCCESS, "", ""); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 568 | |
| 569 | EXPECT_EQ(42, option_processor_->GetParsedStartupOptions()->max_idle_secs); |
| 570 | EXPECT_EQ(6, option_processor_->GetParsedStartupOptions()->io_nice_level); |
| 571 | |
| 572 | // Check that the startup options get grouped together properly in the output |
| 573 | // message. |
| 574 | testing::internal::CaptureStderr(); |
| 575 | option_processor_->PrintStartupOptionsProvenanceMessage(); |
ccalvarin | 375d593 | 2018-08-23 14:25:49 -0700 | [diff] [blame] | 576 | const std::string output = testing::internal::GetCapturedStderr(); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 577 | |
| 578 | EXPECT_THAT( |
| 579 | output, |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 580 | MatchesRegex("INFO: Reading 'startup' options from .*workspace.*bazelrc: " |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 581 | "--max_idle_secs=42 --io_nice_level=6\n")); |
| 582 | } |
| 583 | |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 584 | TEST_F(ParseOptionsTest, CommandLineBazelrcHasPriorityOverDefaultBazelrc) { |
| 585 | // Add startup flags to the workspace bazelrc. |
| 586 | std::string workspace_rc; |
| 587 | ASSERT_TRUE(SetUpWorkspaceRcFile( |
| 588 | "startup --max_idle_secs=42\nstartup --io_nice_level=6", &workspace_rc)); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 589 | |
| 590 | // Override one of the master bazelrc's flags in the commandline rc. |
| 591 | const std::string cmdline_rc_path = |
| 592 | blaze_util::JoinPath(workspace_, "mybazelrc"); |
| 593 | ASSERT_TRUE( |
| 594 | blaze_util::MakeDirectories(blaze_util::Dirname(cmdline_rc_path), 0755)); |
| 595 | ASSERT_TRUE(blaze_util::WriteFile("startup --max_idle_secs=123", |
| 596 | cmdline_rc_path, 0755)); |
| 597 | |
| 598 | const std::vector<std::string> args = { |
| 599 | "bazel", "--bazelrc=" + cmdline_rc_path, "build"}; |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 600 | ParseOptionsAndCheckOutput(args, blaze_exit_code::SUCCESS, "", ""); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 601 | |
| 602 | EXPECT_EQ(123, option_processor_->GetParsedStartupOptions()->max_idle_secs); |
| 603 | EXPECT_EQ(6, option_processor_->GetParsedStartupOptions()->io_nice_level); |
| 604 | |
| 605 | // Check that the options are reported in the correct order in the provenance |
| 606 | // message. |
| 607 | testing::internal::CaptureStderr(); |
| 608 | option_processor_->PrintStartupOptionsProvenanceMessage(); |
ccalvarin | 375d593 | 2018-08-23 14:25:49 -0700 | [diff] [blame] | 609 | const std::string output = testing::internal::GetCapturedStderr(); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 610 | |
| 611 | EXPECT_THAT( |
| 612 | output, |
ccalvarin | 5e5ee0d | 2018-08-23 08:56:01 -0700 | [diff] [blame] | 613 | MatchesRegex("INFO: Reading 'startup' options from .*workspace.*bazelrc: " |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 614 | "--max_idle_secs=42 --io_nice_level=6\n" |
| 615 | "INFO: Reading 'startup' options from .*mybazelrc: " |
| 616 | "--max_idle_secs=123\n")); |
| 617 | } |
| 618 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 619 | class BlazercImportTest : public ParseOptionsTest { |
| 620 | protected: |
| 621 | void TestBazelRcImportsMaintainsFlagOrdering(const std::string& import_type) { |
| 622 | // Override one of the master bazelrc's flags in the custom bazelrc. |
| 623 | const std::string imported_rc_path = |
| 624 | blaze_util::JoinPath(workspace_, "myimportedbazelrc"); |
| 625 | ASSERT_TRUE(blaze_util::MakeDirectories( |
| 626 | blaze_util::Dirname(imported_rc_path), 0755)); |
| 627 | ASSERT_TRUE(blaze_util::WriteFile( |
| 628 | "startup --max_idle_secs=123\n" |
| 629 | "startup --io_nice_level=4", |
| 630 | imported_rc_path, 0755)); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 631 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 632 | // Add startup flags the imported bazelrc. |
| 633 | std::string workspace_rc; |
| 634 | ASSERT_TRUE(SetUpWorkspaceRcFile( |
| 635 | "startup --max_idle_secs=42\n" + |
| 636 | import_type + " " + imported_rc_path + "\n" |
| 637 | "startup --io_nice_level=6", |
| 638 | &workspace_rc)); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 639 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 640 | const std::vector<std::string> args = {"bazel", "build"}; |
| 641 | ParseOptionsAndCheckOutput(args, blaze_exit_code::SUCCESS, "", ""); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 642 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 643 | EXPECT_EQ(123, option_processor_->GetParsedStartupOptions()->max_idle_secs); |
| 644 | EXPECT_EQ(6, option_processor_->GetParsedStartupOptions()->io_nice_level); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 645 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 646 | // Check that the options are reported in the correct order in the |
| 647 | // provenance message, the imported file between the two master flags |
| 648 | testing::internal::CaptureStderr(); |
| 649 | option_processor_->PrintStartupOptionsProvenanceMessage(); |
| 650 | const std::string output = testing::internal::GetCapturedStderr(); |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 651 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 652 | EXPECT_THAT( |
| 653 | output, |
| 654 | MatchesRegex( |
| 655 | "INFO: Reading 'startup' options from .*workspace.*bazelrc: " |
| 656 | "--max_idle_secs=42\n" |
| 657 | "INFO: Reading 'startup' options from .*myimportedbazelrc: " |
| 658 | "--max_idle_secs=123 --io_nice_level=4\n" |
| 659 | "INFO: Reading 'startup' options from .*workspace.*bazelrc: " |
| 660 | "--io_nice_level=6\n")); |
| 661 | } |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 662 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 663 | void TestThatDoubleImportsCauseAWarning(const std::string& import_type) { |
| 664 | const std::string imported_rc_path = |
| 665 | blaze_util::JoinPath(workspace_, "myimportedbazelrc"); |
| 666 | ASSERT_TRUE(blaze_util::WriteFile("", imported_rc_path, 0755)); |
| 667 | |
| 668 | // Import the custom location twice. |
| 669 | std::string workspace_rc; |
| 670 | ASSERT_TRUE(SetUpWorkspaceRcFile( |
| 671 | import_type + " " + imported_rc_path + "\n" + |
| 672 | import_type + " " + imported_rc_path + "\n", |
| 673 | &workspace_rc)); |
| 674 | |
| 675 | const std::vector<std::string> args = {"bazel", "build"}; |
| 676 | ParseOptionsAndCheckOutput( |
| 677 | args, blaze_exit_code::SUCCESS, "", |
| 678 | "WARNING: Duplicate rc file: .*myimportedbazelrc is imported multiple " |
| 679 | "times from .*workspace.*bazelrc\n"); |
| 680 | } |
| 681 | |
| 682 | void TestThatDoubleImportWithWorkspaceRelativeSyntaxCauseAWarning( |
| 683 | const std::string& import_type) { |
| 684 | const std::string imported_rc_path = |
| 685 | blaze_util::JoinPath(workspace_, "myimportedbazelrc"); |
| 686 | ASSERT_TRUE(blaze_util::WriteFile("", imported_rc_path, 0755)); |
| 687 | |
| 688 | // Import the custom location twice. |
| 689 | std::string workspace_rc; |
| 690 | ASSERT_TRUE( |
| 691 | SetUpWorkspaceRcFile( |
| 692 | import_type + " " + imported_rc_path + "\n" + |
| 693 | import_type + " %workspace%/myimportedbazelrc\n", |
| 694 | &workspace_rc)); |
| 695 | |
| 696 | const std::vector<std::string> args = {"bazel", "build"}; |
| 697 | ParseOptionsAndCheckOutput( |
| 698 | args, blaze_exit_code::SUCCESS, "", |
| 699 | "WARNING: Duplicate rc file: .*myimportedbazelrc is imported multiple " |
| 700 | "times from .*workspace.*bazelrc\n"); |
| 701 | } |
| 702 | |
| 703 | void TestThatDoubleImportWithExcessPathSyntaxCauseAWarning( |
| 704 | const std::string& import_type) { |
| 705 | const std::string imported_rc_path = |
| 706 | blaze_util::JoinPath(workspace_, "myimportedbazelrc"); |
| 707 | ASSERT_TRUE(blaze_util::WriteFile("", imported_rc_path, 0755)); |
| 708 | |
| 709 | // Import the custom location twice. |
| 710 | std::string workspace_rc; |
| 711 | ASSERT_TRUE( |
| 712 | SetUpWorkspaceRcFile( |
| 713 | import_type + " " + imported_rc_path + "\n" + |
| 714 | import_type + " %workspace%///.//myimportedbazelrc\n", |
| 715 | &workspace_rc)); |
| 716 | |
| 717 | const std::vector<std::string> args = {"bazel", "build"}; |
| 718 | ParseOptionsAndCheckOutput( |
| 719 | args, blaze_exit_code::SUCCESS, "", |
| 720 | "WARNING: Duplicate rc file: .*myimportedbazelrc is imported multiple " |
| 721 | "times from .*workspace.*bazelrc\n"); |
| 722 | } |
| 723 | |
| 724 | void TestThatDeepDoubleImportCausesAWarning(const std::string& import_type) { |
| 725 | const std::string dual_imported_rc_path = |
| 726 | blaze_util::JoinPath(workspace_, "dual_imported.bazelrc"); |
| 727 | ASSERT_TRUE(blaze_util::WriteFile("", dual_imported_rc_path, 0755)); |
| 728 | |
| 729 | const std::string intermediate_import_1 = |
| 730 | blaze_util::JoinPath(workspace_, "intermediate_import_1"); |
| 731 | ASSERT_TRUE(blaze_util::WriteFile( |
| 732 | import_type + " " + dual_imported_rc_path, |
| 733 | intermediate_import_1, 0755)); |
| 734 | |
| 735 | const std::string intermediate_import_2 = |
| 736 | blaze_util::JoinPath(workspace_, "intermediate_import_2"); |
| 737 | ASSERT_TRUE(blaze_util::WriteFile( |
| 738 | import_type + " " + dual_imported_rc_path, |
| 739 | intermediate_import_2, 0755)); |
| 740 | |
| 741 | // Import the custom location twice. |
| 742 | std::string workspace_rc; |
| 743 | ASSERT_TRUE(SetUpWorkspaceRcFile( |
| 744 | import_type + " " + intermediate_import_1 + "\n" + |
| 745 | import_type + " " + intermediate_import_2 + "\n", |
| 746 | &workspace_rc)); |
| 747 | |
| 748 | const std::vector<std::string> args = {"bazel", "build"}; |
| 749 | ParseOptionsAndCheckOutput( |
| 750 | args, blaze_exit_code::SUCCESS, "", |
| 751 | "WARNING: Duplicate rc file: .*dual_imported.bazelrc is imported " |
| 752 | "multiple times from .*workspace.*bazelrc\n"); |
| 753 | } |
| 754 | |
| 755 | void TestThatImportingAFileAndPassingItInCausesAWarning( |
| 756 | const std::string& import_type) { |
| 757 | const std::string imported_rc_path = |
| 758 | blaze_util::JoinPath(workspace_, "myimportedbazelrc"); |
| 759 | ASSERT_TRUE(blaze_util::WriteFile("", imported_rc_path, 0755)); |
| 760 | |
| 761 | // Import the custom location, and pass it in by flag. |
| 762 | std::string workspace_rc; |
| 763 | ASSERT_TRUE( |
| 764 | SetUpWorkspaceRcFile( |
| 765 | import_type + " " + imported_rc_path, |
| 766 | &workspace_rc)); |
| 767 | |
| 768 | const std::vector<std::string> args = { |
| 769 | "bazel", "--bazelrc=" + imported_rc_path, "build"}; |
| 770 | ParseOptionsAndCheckOutput( |
| 771 | args, blaze_exit_code::SUCCESS, "", |
| 772 | "WARNING: Duplicate rc file: .*myimportedbazelrc is read multiple " |
| 773 | "times, " |
jingwen | 68c57f0 | 2018-11-21 16:17:17 -0800 | [diff] [blame] | 774 | "it is a standard rc file location but must have been unnecessarily " |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 775 | "imported earlier.\n"); |
| 776 | } |
| 777 | }; |
| 778 | |
| 779 | TEST_F(BlazercImportTest, BazelRcImportFailsForMissingFile) { |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 780 | const std::string missing_imported_rc_path = |
| 781 | blaze_util::JoinPath(workspace_, "myimportedbazelrc"); |
| 782 | std::string workspace_rc; |
| 783 | ASSERT_TRUE(SetUpWorkspaceRcFile("import " + missing_imported_rc_path, |
| 784 | &workspace_rc)); |
| 785 | |
| 786 | const std::vector<std::string> args = {"bazel", "build"}; |
| 787 | ParseOptionsAndCheckOutput( |
| 788 | args, blaze_exit_code::INTERNAL_ERROR, |
| 789 | "Unexpected error reading .blazerc file '.*myimportedbazelrc'", ""); |
| 790 | } |
| 791 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 792 | TEST_F(BlazercImportTest, BazelRcTryImportDoesNotFailForMissingFile) { |
| 793 | const std::string missing_imported_rc_path = |
| 794 | blaze_util::JoinPath(workspace_, "tryimported.bazelrc"); |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 795 | std::string workspace_rc; |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 796 | ASSERT_TRUE(SetUpWorkspaceRcFile("try-import " + missing_imported_rc_path, |
| 797 | &workspace_rc)); |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 798 | |
| 799 | const std::vector<std::string> args = {"bazel", "build"}; |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 800 | ParseOptionsAndCheckOutput(args, blaze_exit_code::SUCCESS, "", ""); |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 801 | } |
| 802 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 803 | // rc_file does not differentiate between non-existent and unreadable files. We |
| 804 | // don't necessarily want try-import to ignore unreadable files, but this test |
| 805 | // exists to make sure we don't change the behavior by accident. Any change that |
| 806 | // makes existent but unreadable files a failure with try-import should inform |
| 807 | // users. |
| 808 | TEST_F(BlazercImportTest, BazelRcTryImportDoesNotFailForUnreadableFile) { |
| 809 | const std::string unreadable_rc_path = |
| 810 | blaze_util::JoinPath(workspace_, "tryimported.bazelrc"); |
| 811 | ASSERT_TRUE(blaze_util::WriteFile("startup --max_idle_secs=123", |
| 812 | unreadable_rc_path, 222)); |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 813 | std::string workspace_rc; |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 814 | ASSERT_TRUE( |
| 815 | SetUpWorkspaceRcFile("try-import " + unreadable_rc_path, &workspace_rc)); |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 816 | |
| 817 | const std::vector<std::string> args = {"bazel", "build"}; |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 818 | ParseOptionsAndCheckOutput(args, blaze_exit_code::SUCCESS, "", ""); |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 819 | } |
| 820 | |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 821 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 822 | TEST_F(BlazercImportTest, BazelRcImportsMaintainsFlagOrdering) { |
| 823 | TestBazelRcImportsMaintainsFlagOrdering("import"); |
| 824 | } |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 825 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 826 | TEST_F(BlazercImportTest, BazelRcTryImportsMaintainsFlagOrdering) { |
| 827 | TestBazelRcImportsMaintainsFlagOrdering("try-import"); |
| 828 | } |
| 829 | |
| 830 | TEST_F(BlazercImportTest, DoubleImportsCauseAWarning) { |
| 831 | TestThatDoubleImportsCauseAWarning("import"); |
| 832 | } |
| 833 | |
| 834 | TEST_F(BlazercImportTest, DoubleTryImportsCauseAWarning) { |
| 835 | TestThatDoubleImportsCauseAWarning("try-import"); |
| 836 | } |
| 837 | |
| 838 | TEST_F(BlazercImportTest, |
| 839 | DoubleImportWithWorkspaceRelativeSyntaxCauseAWarning) { |
| 840 | TestThatDoubleImportWithWorkspaceRelativeSyntaxCauseAWarning("import"); |
| 841 | } |
| 842 | |
| 843 | TEST_F(BlazercImportTest, |
| 844 | DoubleTryImportWithWorkspaceRelativeSyntaxCauseAWarning) { |
| 845 | TestThatDoubleImportWithWorkspaceRelativeSyntaxCauseAWarning("try-import"); |
| 846 | } |
| 847 | |
| 848 | TEST_F(BlazercImportTest, DoubleImportWithExcessPathSyntaxCauseAWarning) { |
| 849 | TestThatDoubleImportWithExcessPathSyntaxCauseAWarning("import"); |
| 850 | } |
| 851 | |
| 852 | TEST_F(BlazercImportTest, DoubleTryImportWithExcessPathSyntaxCauseAWarning) { |
| 853 | TestThatDoubleImportWithExcessPathSyntaxCauseAWarning("try-import"); |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 854 | } |
| 855 | |
| 856 | // The following tests unix-path semantics. |
| 857 | #if !defined(_WIN32) && !defined(__CYGWIN__) |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 858 | TEST_F(BlazercImportTest, |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 859 | DoubleImportWithEnclosingDirectorySyntaxCauseAWarning) { |
| 860 | const std::string imported_rc_path = |
| 861 | blaze_util::JoinPath(workspace_, "myimportedbazelrc"); |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 862 | ASSERT_TRUE(blaze_util::WriteFile("", imported_rc_path, 0755)); |
| 863 | |
| 864 | ASSERT_TRUE(blaze_util::MakeDirectories( |
| 865 | blaze_util::JoinPath(workspace_, "extra"), 0755)); |
| 866 | |
| 867 | // Import the custom location twice. |
| 868 | std::string workspace_rc; |
| 869 | ASSERT_TRUE(SetUpWorkspaceRcFile( |
| 870 | "import " + imported_rc_path + "\n" |
| 871 | "import %workspace%/extra/../myimportedbazelrc\n", |
| 872 | &workspace_rc)); |
| 873 | |
| 874 | const std::vector<std::string> args = {"bazel", "build"}; |
| 875 | ParseOptionsAndCheckOutput( |
| 876 | args, blaze_exit_code::SUCCESS, "", |
| 877 | "WARNING: Duplicate rc file: .*myimportedbazelrc is imported multiple " |
| 878 | "times from .*workspace.*bazelrc\n"); |
| 879 | } |
| 880 | #endif // !defined(_WIN32) && !defined(__CYGWIN__) |
| 881 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 882 | TEST_F(BlazercImportTest, DeepDoubleImportCausesAWarning) { |
| 883 | TestThatDeepDoubleImportCausesAWarning("import"); |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 884 | } |
| 885 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 886 | TEST_F(BlazercImportTest, DeepDoubleTryImportCausesAWarning) { |
| 887 | TestThatDeepDoubleImportCausesAWarning("try-import"); |
| 888 | } |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 889 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 890 | TEST_F(BlazercImportTest, ImportingAFileAndPassingItInCausesAWarning) { |
| 891 | TestThatImportingAFileAndPassingItInCausesAWarning("import"); |
| 892 | } |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 893 | |
ccalvarin | f03acca | 2018-09-06 14:25:27 -0700 | [diff] [blame] | 894 | TEST_F(BlazercImportTest, TryImportingAFileAndPassingItInCausesAWarning) { |
| 895 | TestThatImportingAFileAndPassingItInCausesAWarning("try-import"); |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 896 | } |
| 897 | |
| 898 | // TODO(b/112908763): Somehow, in the following tests, we end with a relative |
| 899 | // path written in the import line on Windows. Figure out what's going on and |
| 900 | // reinstate these tests |
| 901 | #if !defined(_WIN32) && !defined(__CYGWIN__) |
| 902 | TEST_F(ParseOptionsTest, ImportingAPreviouslyLoadedStandardRcCausesAWarning) { |
| 903 | std::string system_rc; |
| 904 | ASSERT_TRUE(SetUpSystemRcFile("", &system_rc)); |
| 905 | |
| 906 | // Import the system_rc extraneously. |
| 907 | std::string workspace_rc; |
| 908 | ASSERT_TRUE(SetUpWorkspaceRcFile("import " + system_rc, &workspace_rc)); |
| 909 | |
| 910 | const std::vector<std::string> args = {"bazel", "build"}; |
| 911 | ParseOptionsAndCheckOutput( |
| 912 | args, blaze_exit_code::SUCCESS, "", |
| 913 | "WARNING: Duplicate rc file: .*bazel.bazelrc is read multiple " |
| 914 | "times, most recently imported from .*workspace.*bazelrc\n"); |
| 915 | } |
| 916 | |
| 917 | TEST_F(ParseOptionsTest, ImportingStandardRcBeforeItIsLoadedCausesAWarning) { |
| 918 | std::string workspace_rc; |
| 919 | ASSERT_TRUE(SetUpWorkspaceRcFile("", &workspace_rc)); |
| 920 | |
| 921 | // Import the workspace_rc extraneously. |
| 922 | std::string system_rc; |
| 923 | ASSERT_TRUE(SetUpSystemRcFile("import " + workspace_rc, &system_rc)); |
| 924 | |
| 925 | const std::vector<std::string> args = {"bazel", "build"}; |
| 926 | ParseOptionsAndCheckOutput( |
| 927 | args, blaze_exit_code::SUCCESS, "", |
| 928 | "WARNING: Duplicate rc file: .*workspace.*bazelrc is read multiple " |
| 929 | "times, it is a standard rc file location but must have been " |
jingwen | 68c57f0 | 2018-11-21 16:17:17 -0800 | [diff] [blame] | 930 | "unnecessarily imported earlier.\n"); |
ccalvarin | 8ceaa65 | 2018-08-24 12:44:31 -0700 | [diff] [blame] | 931 | } |
| 932 | #endif // !defined(_WIN32) && !defined(__CYGWIN__) |
| 933 | |
ccalvarin | 0480894 | 2018-05-01 15:30:28 -0700 | [diff] [blame] | 934 | } // namespace blaze |