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

Side by Side Diff: tools/gn/function_exec_script.cc

Issue 41703002: Fix GN unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/build_settings.cc ('k') | tools/gn/ninja_binary_target_writer_unittest.cc » ('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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/process/kill.h" 8 #include "base/process/kill.h"
9 #include "base/process/launch.h" 9 #include "base/process/launch.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 #if defined(OS_WIN) 341 #if defined(OS_WIN)
342 g_scheduler->Log("Pythoning", UTF16ToUTF8(cmdline.GetCommandLineString())); 342 g_scheduler->Log("Pythoning", UTF16ToUTF8(cmdline.GetCommandLineString()));
343 #else 343 #else
344 g_scheduler->Log("Pythoning", cmdline.GetCommandLineString()); 344 g_scheduler->Log("Pythoning", cmdline.GetCommandLineString());
345 #endif 345 #endif
346 begin_exec = base::TimeTicks::Now(); 346 begin_exec = base::TimeTicks::Now();
347 } 347 }
348 348
349 base::FilePath startup_dir = 349 base::FilePath startup_dir =
350 build_settings->GetFullPath(build_settings->build_dir()); 350 build_settings->GetFullPath(build_settings->build_dir());
351 // The first time a build is run, no targets will have been written so the
352 // build output directory won't exist. We need to make sure it does before
353 // running any scripts with this as its startup directory, although it will
354 // be relatively rare that the directory won't exist by the time we get here.
355 //
356 // If this shows up on benchmarks, we can cache whether we've done this
357 // or not and skip creating the directory.
358 file_util::CreateDirectory(startup_dir);
scottmg 2013/10/24 21:47:20 racing is silently ok on all platforms? (looks ok
351 359
352 // Execute the process. 360 // Execute the process.
353 // TODO(brettw) set the environment block. 361 // TODO(brettw) set the environment block.
354 std::string output; 362 std::string output;
355 std::string stderr_output; // TODO(brettw) not hooked up, see above. 363 std::string stderr_output; // TODO(brettw) not hooked up, see above.
356 int exit_code = 0; 364 int exit_code = 0;
357 if (!CommandLine::ForCurrentProcess()->HasSwitch(kNoExecSwitch)) { 365 if (!CommandLine::ForCurrentProcess()->HasSwitch(kNoExecSwitch)) {
358 if (!ExecProcess(cmdline, startup_dir, 366 if (!ExecProcess(cmdline, startup_dir,
359 &output, &stderr_output, &exit_code)) { 367 &output, &stderr_output, &exit_code)) {
360 *err = Err(function->function(), "Could not execute python.", 368 *err = Err(function->function(), "Could not execute python.",
(...skipping 19 matching lines...) Expand all
380 msg += "."; 388 msg += ".";
381 *err = Err(function->function(), "Script returned non-zero exit code.", 389 *err = Err(function->function(), "Script returned non-zero exit code.",
382 msg); 390 msg);
383 return Value(); 391 return Value();
384 } 392 }
385 393
386 return ConvertInputToValue(output, function, args[2], err); 394 return ConvertInputToValue(output, function, args[2], err);
387 } 395 }
388 396
389 } // namespace functions 397 } // namespace functions
OLDNEW
« no previous file with comments | « tools/gn/build_settings.cc ('k') | tools/gn/ninja_binary_target_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698