ENH: Combine all dependency* tests into one Dependency test. Add more difficult test cases.

This commit is contained in:
Brad King 2008-02-06 14:52:12 -05:00
parent 0cb622a28b
commit 1cba430d1b
18 changed files with 111 additions and 54 deletions

View File

@ -418,68 +418,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
--test-command TestDriverTest subdir/test3
)
ADD_TEST(dependency_w_libout ${CMAKE_CTEST_COMMAND}
ADD_TEST(Dependency ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/Dependency"
"${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut"
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec"
--build-project Dependency
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-options
-DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib
--test-command exec
)
ADD_TEST(dependency_wo_lib_out ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/Dependency"
"${CMake_BINARY_DIR}/Tests/Dependency/WOLibOut"
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WOLibOut/Exec"
"${CMake_BINARY_DIR}/Tests/Dependency"
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/Exec"
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-project Dependency
--test-command exec
)
ADD_TEST(dependency2 ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/Dependency"
"${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut"
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec2"
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-project Dependency
--build-options
-DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib
--test-command exec2
)
ADD_TEST(dependency3 ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/Dependency"
"${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut"
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec3"
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-project Dependency
--build-options
-DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib
--test-command exec3)
ADD_TEST(dependency4 ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/Dependency"
"${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut"
--build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec4"
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
--build-project Dependency
--build-options
-DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib
--test-command exec4
)
IF("${CMAKE_SYSTEM_NAME}" MATCHES syllable)
# RPATH isn't supported under Syllable, so the tests don't

View File

@ -43,3 +43,8 @@ ADD_SUBDIRECTORY(Exec)
ADD_SUBDIRECTORY(Exec2)
ADD_SUBDIRECTORY(Exec3)
ADD_SUBDIRECTORY(Exec4)
# Specific cases added to test fixes to problems found in real
# projects.
ADD_SUBDIRECTORY(Case1)
ADD_SUBDIRECTORY(Case2)

View File

@ -0,0 +1,19 @@
project(CASE1)
# The old anaylize lib depends stuff in cmTarget gets this case wrong.
# The cmComputeLinkDepends implementation gets it right.
add_library(case1a STATIC a.c)
add_library(case1b STATIC b.c b2.c)
target_link_libraries(case1b case1a)
add_library(case1c STATIC c.c c2.c)
target_link_libraries(case1c case1b)
add_library(case1d STATIC d.c)
target_link_libraries(case1d case1c)
add_executable(hello main.c)
target_link_libraries(hello case1c case1b case1d case1c)

View File

@ -0,0 +1,5 @@
int a()
{
return 5;
}

View File

@ -0,0 +1,6 @@
extern int a();
int b()
{
return a()+17;
}

View File

@ -0,0 +1,4 @@
int b2()
{
return 3;
}

View File

@ -0,0 +1,6 @@
extern int b();
int c()
{
return b()+42;
}

View File

@ -0,0 +1,6 @@
extern int b2();
int c2()
{
return b2()+1;
}

View File

@ -0,0 +1,7 @@
extern int c2();
int d()
{
return c2()+2;
}

View File

@ -0,0 +1,10 @@
extern int b();
extern int c();
extern int d();
int main()
{
c();
b();
d();
}

View File

@ -0,0 +1,20 @@
project(CASE2 C)
add_library(case2Foo1 STATIC foo1.c)
add_library(case2Foo2 STATIC foo2.c)
add_library(case2Foo3 STATIC foo3.c)
target_link_libraries(case2Foo1 case2Foo2)
target_link_libraries(case2Foo2 case2Foo3)
target_link_libraries(case2Foo3 case2Foo1)
add_library(case2Bar1 STATIC bar1.c)
add_library(case2Bar2 STATIC bar2.c)
add_library(case2Bar3 STATIC bar3.c)
target_link_libraries(case2Bar1 case2Bar2 case2Foo1)
target_link_libraries(case2Bar2 case2Bar3)
target_link_libraries(case2Bar3 case2Bar1)
add_executable(case2Zot zot.c)
target_link_libraries(case2Zot case2Bar1)
#set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_DEBUG_MODE 1)

View File

@ -0,0 +1,4 @@
extern int foo1();
extern int bar2(void);
int bar1(void) { return bar2(); }
int bar1_from_bar3(void) { return foo1(); }

View File

@ -0,0 +1,2 @@
extern int bar3(void);
int bar2(void) { return bar3(); }

View File

@ -0,0 +1,2 @@
extern int bar1_from_bar3(void);
int bar3(void) { return bar1_from_bar3(); }

View File

@ -0,0 +1,3 @@
extern int foo2(void);
int foo1(void) { return foo2(); }
int foo1_from_foo3(void) { return 0; }

View File

@ -0,0 +1,2 @@
extern int foo3(void);
int foo2(void) { return foo3(); }

View File

@ -0,0 +1,2 @@
extern int foo1_from_foo3(void);
int foo3(void) { return foo1_from_foo3(); }

View File

@ -0,0 +1,5 @@
extern int bar1(void);
int main(void)
{
return bar1();
}