Fix the testonly flag for gn ls This fixes a problem where running 'gn ls' with '--testonly=true' would not filter out targets who did not have testonly set to true in their BUILD.gn file. Bug: 288 Change-Id: I65a5f72d459a0f90fdac58249b5a1661edb66525 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/14680 Reviewed-by: Brett Wilson <brettw@chromium.org> Commit-Queue: Brett Wilson <brettw@chromium.org>
diff --git a/src/gn/commands.cc b/src/gn/commands.cc index 02926ec..f81f7ab 100644 --- a/src/gn/commands.cc +++ b/src/gn/commands.cc
@@ -469,9 +469,9 @@ if (cmdline.HasSwitch(testonly_switch)) { std::string value = cmdline.GetSwitchValueString(testonly_switch); if (value == "true") { - testonly_mode_ = TESTONLY_TRUE; + result.testonly_mode_ = TESTONLY_TRUE; } else if (value == "false") { - testonly_mode_ = TESTONLY_FALSE; + result.testonly_mode_ = TESTONLY_FALSE; } else { Err(Location(), "Bad value for --testonly.", "I was expecting --testonly=true or --testonly=false.")