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

Unified Diff: tools/gn/runtime_deps_unittest.cc

Issue 1386783003: [GN]: Support for loadable modules (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
Index: tools/gn/runtime_deps_unittest.cc
diff --git a/tools/gn/runtime_deps_unittest.cc b/tools/gn/runtime_deps_unittest.cc
index a674e5b82ed5d3b435af6bdd9348819ab75bed8c..3b3c88037beb053525e34927cf61e87dd850d843 100644
--- a/tools/gn/runtime_deps_unittest.cc
+++ b/tools/gn/runtime_deps_unittest.cc
@@ -43,9 +43,10 @@ TEST(RuntimeDeps, Libs) {
TestWithScope setup;
Err err;
- // Dependency hierarchy: main(exe) -> stat
- // -> shared
- // -> set
+ // Dependency hierarchy: main(exe) -> static library
+ // -> shared library
+ // -> loadable module
+ // -> source set
Target stat(setup.settings(), Label(SourceDir("//"), "stat"));
InitTargetWithType(setup, &stat, Target::STATIC_LIBRARY);
@@ -57,6 +58,11 @@ TEST(RuntimeDeps, Libs) {
shared.data().push_back("//shared.dat");
ASSERT_TRUE(shared.OnResolved(&err));
+ Target loadable(setup.settings(), Label(SourceDir("//"), "loadable"));
+ InitTargetWithType(setup, &loadable, Target::LOADABLE_MODULE);
+ loadable.data().push_back("//loadable.dat");
+ ASSERT_TRUE(loadable.OnResolved(&err));
+
Target set(setup.settings(), Label(SourceDir("//"), "set"));
InitTargetWithType(setup, &set, Target::SOURCE_SET);
set.data().push_back("//set.dat");
@@ -66,6 +72,7 @@ TEST(RuntimeDeps, Libs) {
InitTargetWithType(setup, &main, Target::EXECUTABLE);
main.private_deps().push_back(LabelTargetPair(&stat));
main.private_deps().push_back(LabelTargetPair(&shared));
+ main.private_deps().push_back(LabelTargetPair(&loadable));
main.private_deps().push_back(LabelTargetPair(&set));
main.data().push_back("//main.dat");
ASSERT_TRUE(main.OnResolved(&err));
@@ -73,8 +80,9 @@ TEST(RuntimeDeps, Libs) {
std::vector<std::pair<OutputFile, const Target*>> result =
ComputeRuntimeDeps(&main);
- // The result should have deps of main, all 4 dat files, and libshared.so
- ASSERT_EQ(6u, result.size()) << GetVectorDescription(result);
+ // The result should have deps of main, all 5 dat files, libshared.so, and
+ // libloadable.so.
+ ASSERT_EQ(8u, result.size()) << GetVectorDescription(result);
// The first one should always be the main exe.
EXPECT_TRUE(MakePair("./main", &main) == result[0]);
@@ -87,16 +95,22 @@ TEST(RuntimeDeps, Libs) {
MakePair("../../shared.dat", &shared)) !=
result.end()) << GetVectorDescription(result);
EXPECT_TRUE(std::find(result.begin(), result.end(),
+ MakePair("../../loadable.dat", &loadable)) !=
+ result.end()) << GetVectorDescription(result);
+ EXPECT_TRUE(std::find(result.begin(), result.end(),
MakePair("../../set.dat", &set)) !=
result.end()) << GetVectorDescription(result);
EXPECT_TRUE(std::find(result.begin(), result.end(),
MakePair("../../main.dat", &main)) !=
result.end()) << GetVectorDescription(result);
- // Check the static library
+ // Check the static library and loadable module.
EXPECT_TRUE(std::find(result.begin(), result.end(),
MakePair("./libshared.so", &shared)) !=
result.end()) << GetVectorDescription(result);
+ EXPECT_TRUE(std::find(result.begin(), result.end(),
+ MakePair("./libloadable.so", &loadable)) !=
+ result.end()) << GetVectorDescription(result);
}
// Tests that executables that aren't listed as data deps aren't included in

Powered by Google App Engine
This is Rietveld 408576698