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

Unified Diff: tools/gn/function_toolchain_unittest.cc

Issue 2178173002: Allow GN toolchains to specify runtime deps outputs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/function_toolchain.cc ('k') | tools/gn/gn.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/function_toolchain_unittest.cc
diff --git a/tools/gn/function_toolchain_unittest.cc b/tools/gn/function_toolchain_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c7ffbc7a5029c139e6e95ffa549895f1b744cfdc
--- /dev/null
+++ b/tools/gn/function_toolchain_unittest.cc
@@ -0,0 +1,58 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "tools/gn/functions.h"
+#include "tools/gn/scheduler.h"
+#include "tools/gn/test_with_scope.h"
+
+TEST(FunctionToolchain, RuntimeOutputs) {
+ Scheduler scheduler;
+ TestWithScope setup;
+
+ // These runtime outputs are a subset of the outputs so are OK.
+ {
+ TestParseInput input(
+ "toolchain(\"good\") {\n"
+ " tool(\"link\") {\n"
+ " outputs = [ \"foo\" ]\n"
+ " runtime_outputs = [ \"foo\" ]\n"
+ " }\n"
+ "}\n");
+ ASSERT_FALSE(input.has_error());
+
+ Err err;
+ input.parsed()->Execute(setup.scope(), &err);
+ ASSERT_FALSE(err.has_error()) << err.message();
+
+ // It should have generated a toolchain.
+ ASSERT_EQ(1u, setup.items().size());
+ const Toolchain* toolchain = setup.items()[0]->AsToolchain();
+ ASSERT_TRUE(toolchain);
+
+ // The toolchain should have a link tool with the two outputs.
+ const Tool* link = toolchain->GetTool(Toolchain::TYPE_LINK);
+ ASSERT_TRUE(link);
+ ASSERT_EQ(1u, link->outputs().list().size());
+ EXPECT_EQ("foo", link->outputs().list()[0].AsString());
+ ASSERT_EQ(1u, link->runtime_outputs().list().size());
+ EXPECT_EQ("foo", link->runtime_outputs().list()[0].AsString());
+ }
+
+ // This one is not a subset so should throw an error.
+ {
+ TestParseInput input(
+ "toolchain(\"bad\") {\n"
+ " tool(\"link\") {\n"
+ " outputs = [ \"foo\" ]\n"
+ " runtime_outputs = [ \"bar\" ]\n"
+ " }\n"
+ "}\n");
+ ASSERT_FALSE(input.has_error());
+
+ Err err;
+ input.parsed()->Execute(setup.scope(), &err);
+ ASSERT_TRUE(err.has_error()) << err.message();
+ }
+}
« no previous file with comments | « tools/gn/function_toolchain.cc ('k') | tools/gn/gn.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698