summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2005-03-03 23:16:00 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2005-03-03 23:16:00 (GMT)
commitded7d151446dd889956c294188c7bf65e3063e96 (patch)
tree63317ae2801896f218948591de30a19e804d9219 /Tests
parenta0c095d420e07243af929f92e469d392e9ae26ba (diff)
downloadCMake-ded7d151446dd889956c294188c7bf65e3063e96.zip
CMake-ded7d151446dd889956c294188c7bf65e3063e96.tar.gz
CMake-ded7d151446dd889956c294188c7bf65e3063e96.tar.bz2
ENH: try number two with topological sort
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Complex/Executable/complex.cxx47
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx47
-rw-r--r--Tests/ComplexRelativePaths/Executable/complex.cxx47
3 files changed, 108 insertions, 33 deletions
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 1245dbb..3a9f150 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -57,24 +57,24 @@ bool TestLibraryOrder(bool shouldFail)
orderLibs.SetLinkInformation(target, cmTarget::GENERAL, "A");
bool ret = orderLibs.DetermineLibraryPathOrder();
orderLibs.GetLinkerInformation(sortedpaths, linkItems);
- std::cerr << "Sorted Link Paths:\n";
+ std::cout << "Sorted Link Paths:\n";
for(std::vector<cmStdString>::iterator i = sortedpaths.begin();
i != sortedpaths.end(); ++i)
{
- std::cerr << *i << "\n";
+ std::cout << *i << "\n";
}
- std::cerr << "Link Items: \n";
+ std::cout << "Link Items: \n";
for(std::vector<cmStdString>::iterator i = linkItems.begin();
i != linkItems.end(); ++i)
{
- std::cerr << *i << "\n";
+ std::cout << *i << "\n";
}
if(!(linkItems[0] == "A" &&
linkItems[1] == "B" &&
linkItems[2] == "C" &&
linkItems[3] == "-lm" ))
{
- std::cerr << "fail because link items should be A B C -lm and the are not\n";
+ std::cout << "fail because link items should be A B C -lm and the are not\n";
return shouldFail;
}
@@ -82,16 +82,18 @@ bool TestLibraryOrder(bool shouldFail)
// if this is not the fail test then the order should be f B C A
if(!shouldFail)
{
- if(!(sortedpaths[0][sortedpaths[0].size()-1] == 'f' &&
- sortedpaths[1][sortedpaths[1].size()-1] == 'B' &&
- sortedpaths[2][sortedpaths[2].size()-1] == 'C' &&
- sortedpaths[3][sortedpaths[3].size()-1] == 'A' ))
+ char order[5];
+ order[4] = 0;
+ for(int i =0; i < 4; ++i)
{
- std::cerr << "fail because order should be /lib/extra/stuff B C A and it is not\n";
+ order[i] = sortedpaths[i][sortedpaths[i].size()-1];
+ }
+ if(!(strcmp(order, "fBCA") == 0 || strcmp(order, "BCAf") == 0))
+ {
+ std::cout << "fail because order should be /lib/extra/stuff B C A and it is not\n";
return false;
}
}
-
return ret;
}
@@ -999,6 +1001,29 @@ int main()
#else
cmPassed("CMake SET CACHE FORCE");
#endif
+
+ // first run with shouldFail = true, this will
+ // run with A B C as set by the CMakeList.txt file.
+ if(!TestLibraryOrder(true))
+ {
+ cmPassed("CMake cmOrderLinkDirectories failed when it should.");
+ }
+ else
+ {
+ cmFailed("CMake cmOrderLinkDirectories failed to fail when given an impossible set of paths.");
+ }
+ // next run with shouldPass = true, this will
+ // run with B/libA.a removed and should create the order
+ // B C A
+ if(TestLibraryOrder(false))
+ {
+ cmPassed("CMake cmOrderLinkDirectories worked.");
+ }
+ else
+ {
+ cmFailed("CMake cmOrderLinkDirectories failed.");
+ }
+
// ----------------------------------------------------------------------
// Summary
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
index 1245dbb..3a9f150 100644
--- a/Tests/ComplexOneConfig/Executable/complex.cxx
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -57,24 +57,24 @@ bool TestLibraryOrder(bool shouldFail)
orderLibs.SetLinkInformation(target, cmTarget::GENERAL, "A");
bool ret = orderLibs.DetermineLibraryPathOrder();
orderLibs.GetLinkerInformation(sortedpaths, linkItems);
- std::cerr << "Sorted Link Paths:\n";
+ std::cout << "Sorted Link Paths:\n";
for(std::vector<cmStdString>::iterator i = sortedpaths.begin();
i != sortedpaths.end(); ++i)
{
- std::cerr << *i << "\n";
+ std::cout << *i << "\n";
}
- std::cerr << "Link Items: \n";
+ std::cout << "Link Items: \n";
for(std::vector<cmStdString>::iterator i = linkItems.begin();
i != linkItems.end(); ++i)
{
- std::cerr << *i << "\n";
+ std::cout << *i << "\n";
}
if(!(linkItems[0] == "A" &&
linkItems[1] == "B" &&
linkItems[2] == "C" &&
linkItems[3] == "-lm" ))
{
- std::cerr << "fail because link items should be A B C -lm and the are not\n";
+ std::cout << "fail because link items should be A B C -lm and the are not\n";
return shouldFail;
}
@@ -82,16 +82,18 @@ bool TestLibraryOrder(bool shouldFail)
// if this is not the fail test then the order should be f B C A
if(!shouldFail)
{
- if(!(sortedpaths[0][sortedpaths[0].size()-1] == 'f' &&
- sortedpaths[1][sortedpaths[1].size()-1] == 'B' &&
- sortedpaths[2][sortedpaths[2].size()-1] == 'C' &&
- sortedpaths[3][sortedpaths[3].size()-1] == 'A' ))
+ char order[5];
+ order[4] = 0;
+ for(int i =0; i < 4; ++i)
{
- std::cerr << "fail because order should be /lib/extra/stuff B C A and it is not\n";
+ order[i] = sortedpaths[i][sortedpaths[i].size()-1];
+ }
+ if(!(strcmp(order, "fBCA") == 0 || strcmp(order, "BCAf") == 0))
+ {
+ std::cout << "fail because order should be /lib/extra/stuff B C A and it is not\n";
return false;
}
}
-
return ret;
}
@@ -999,6 +1001,29 @@ int main()
#else
cmPassed("CMake SET CACHE FORCE");
#endif
+
+ // first run with shouldFail = true, this will
+ // run with A B C as set by the CMakeList.txt file.
+ if(!TestLibraryOrder(true))
+ {
+ cmPassed("CMake cmOrderLinkDirectories failed when it should.");
+ }
+ else
+ {
+ cmFailed("CMake cmOrderLinkDirectories failed to fail when given an impossible set of paths.");
+ }
+ // next run with shouldPass = true, this will
+ // run with B/libA.a removed and should create the order
+ // B C A
+ if(TestLibraryOrder(false))
+ {
+ cmPassed("CMake cmOrderLinkDirectories worked.");
+ }
+ else
+ {
+ cmFailed("CMake cmOrderLinkDirectories failed.");
+ }
+
// ----------------------------------------------------------------------
// Summary
diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx
index 1245dbb..3a9f150 100644
--- a/Tests/ComplexRelativePaths/Executable/complex.cxx
+++ b/Tests/ComplexRelativePaths/Executable/complex.cxx
@@ -57,24 +57,24 @@ bool TestLibraryOrder(bool shouldFail)
orderLibs.SetLinkInformation(target, cmTarget::GENERAL, "A");
bool ret = orderLibs.DetermineLibraryPathOrder();
orderLibs.GetLinkerInformation(sortedpaths, linkItems);
- std::cerr << "Sorted Link Paths:\n";
+ std::cout << "Sorted Link Paths:\n";
for(std::vector<cmStdString>::iterator i = sortedpaths.begin();
i != sortedpaths.end(); ++i)
{
- std::cerr << *i << "\n";
+ std::cout << *i << "\n";
}
- std::cerr << "Link Items: \n";
+ std::cout << "Link Items: \n";
for(std::vector<cmStdString>::iterator i = linkItems.begin();
i != linkItems.end(); ++i)
{
- std::cerr << *i << "\n";
+ std::cout << *i << "\n";
}
if(!(linkItems[0] == "A" &&
linkItems[1] == "B" &&
linkItems[2] == "C" &&
linkItems[3] == "-lm" ))
{
- std::cerr << "fail because link items should be A B C -lm and the are not\n";
+ std::cout << "fail because link items should be A B C -lm and the are not\n";
return shouldFail;
}
@@ -82,16 +82,18 @@ bool TestLibraryOrder(bool shouldFail)
// if this is not the fail test then the order should be f B C A
if(!shouldFail)
{
- if(!(sortedpaths[0][sortedpaths[0].size()-1] == 'f' &&
- sortedpaths[1][sortedpaths[1].size()-1] == 'B' &&
- sortedpaths[2][sortedpaths[2].size()-1] == 'C' &&
- sortedpaths[3][sortedpaths[3].size()-1] == 'A' ))
+ char order[5];
+ order[4] = 0;
+ for(int i =0; i < 4; ++i)
{
- std::cerr << "fail because order should be /lib/extra/stuff B C A and it is not\n";
+ order[i] = sortedpaths[i][sortedpaths[i].size()-1];
+ }
+ if(!(strcmp(order, "fBCA") == 0 || strcmp(order, "BCAf") == 0))
+ {
+ std::cout << "fail because order should be /lib/extra/stuff B C A and it is not\n";
return false;
}
}
-
return ret;
}
@@ -999,6 +1001,29 @@ int main()
#else
cmPassed("CMake SET CACHE FORCE");
#endif
+
+ // first run with shouldFail = true, this will
+ // run with A B C as set by the CMakeList.txt file.
+ if(!TestLibraryOrder(true))
+ {
+ cmPassed("CMake cmOrderLinkDirectories failed when it should.");
+ }
+ else
+ {
+ cmFailed("CMake cmOrderLinkDirectories failed to fail when given an impossible set of paths.");
+ }
+ // next run with shouldPass = true, this will
+ // run with B/libA.a removed and should create the order
+ // B C A
+ if(TestLibraryOrder(false))
+ {
+ cmPassed("CMake cmOrderLinkDirectories worked.");
+ }
+ else
+ {
+ cmFailed("CMake cmOrderLinkDirectories failed.");
+ }
+
// ----------------------------------------------------------------------
// Summary