Skip to content

Commit

Permalink
Add TribitsExampleProjectAddons with test as POST extra repo (TriBITS #…
Browse files Browse the repository at this point in the history
…73)

This is a nice example and test of an add-on extra repo. This will also be
used to demonstrate and test PRE extra repos.
  • Loading branch information
Roscoe A. Bartlett committed Jun 10, 2015
1 parent 0b312fb commit 7c4cb4e
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 6 deletions.
68 changes: 62 additions & 6 deletions test/core/ExamplesUnitTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ ELSE()
ENDIF()


#
########################################################################
# RawHelloWorld
#
########################################################################


TRIBITS_ADD_ADVANCED_TEST( RawHelloWorld
Expand Down Expand Up @@ -101,9 +101,9 @@ TRIBITS_ADD_ADVANCED_TEST( RawHelloWorld
)


#
########################################################################
# TribitsHelloWorld
#
########################################################################


TRIBITS_ADD_ADVANCED_TEST( TribitsHelloWorld
Expand Down Expand Up @@ -181,9 +181,9 @@ TRIBITS_ADD_ADVANCED_TEST( TribitsHelloWorld_ScaleTimeout
)


#
########################################################################
# TribitsExampleProject
#
########################################################################


ASSERT_DEFINED(TPL_ENABLE_MPI)
Expand Down Expand Up @@ -1593,3 +1593,59 @@ TRIBITS_ADD_ADVANCED_TEST( TribitsExampleProject_DisableWithSubpackagesB_EnableW
)
# NOTE: The above test is the *only* test that we have that checks that a
# parent package is re-enabled if any of its subpackages are enabled!


########################################################################
# TribitsExampleProject + TribitsExampleProjectAddons
########################################################################


TRIBITS_ADD_ADVANCED_TEST( TribitsExampleProject_TribitsExampleProjectAddons
OVERALL_WORKING_DIRECTORY TEST_NAME
OVERALL_NUM_MPI_PROCS 1

TEST_0
MESSAGE "Copy TribitsExampleProject so that we can copy in TribitsExampleProjectAddons."
CMND cp
ARGS -r ${${PROJECT_NAME}_TRIBITS_DIR}/examples/TribitsExampleProject .

TEST_1
MESSAGE "Copy TribitsExampleProjectAddons to base dir."
CMND cp
ARGS -r ${${PROJECT_NAME}_TRIBITS_DIR}/examples/TribitsExampleProjectAddons
TribitsExampleProject/.

TEST_2
MESSAGE "Configure with cmake/ExtraRepositoriesList.cmake file enabling all packages"
CMND ${CMAKE_COMMAND}
ARGS
${COMMON_ENV_ARGS_PASSTHROUGH}
-DTribitsExProj_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR}
-DTribitsExProj_ENABLE_Fortran=OFF
-DTribitsExProj_ENABLE_DEBUG=OFF
-DTribitsExProj_ENABLE_ALL_PACKAGES=ON
-DTribitsExProj_ENABLE_TESTS=ON
-DTribitsExProj_EXTRAREPOS_FILE=cmake/ExtraRepositoriesList.cmake
-DTribitsExProj_ENABLE_KNOWN_EXTERNAL_REPOS_TYPE=Continuous
TribitsExampleProject
PASS_REGULAR_EXPRESSION_ALL
"-- Adding POST extra Continuous repository TribitsExampleProjectAddons"
"Reading the list of packages from .*/TribitsExampleProject/TribitsExampleProjectAddons/PackagesList.cmake"
"Reading a list of extra TPLs from .*/TribitsExampleProject/TribitsExampleProjectAddons/TPLsList.cmake"
"Final set of enabled SE packages: SimpleCxx .* Addon1"
"Processing enabled package: Addon1 [(]Libs, Tests, Examples[)]"
"Configuring done"
"Generating done"

TEST_3 CMND make
ARGS ${CTEST_BUILD_FLAGS}
PASS_REGULAR_EXPRESSION_ALL
"Scanning dependencies of target addon1"
"Built target Addon1_test"

TEST_4 CMND ${CMAKE_CTEST_COMMAND} ARGS -VV
PASS_REGULAR_EXPRESSION_ALL
"Test .*: Addon1_test .* Passed"
"100% tests passed, 0 tests failed out of"

)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TRIBITS_PROJECT_DEFINE_EXTRA_REPOSITORIES(
TribitsExampleProjectAddons "" GIT dummy-git-url "" Continuous
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TRIBITS_REPOSITORY_DEFINE_PACKAGES(
Addon1 packages/addon1 PT
)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TRIBITS_REPOSITORY_DEFINE_TPLS()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TRIBITS_PACKAGE(Addon1)
ADD_SUBDIRECTORY(src)
TRIBITS_ADD_TEST_DIRECTORIES(tests)
TRIBITS_PACKAGE_POSTPROCESS()
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
LIB_REQUIRED_PACKAGES SimpleCxx
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "Addon1.hpp"

#include "SimpleCxx_HelloWorld.hpp"

std::string Addon1::getAddon1() {
return std::string("Addon1");
}

std::string Addon1::depsAddon1() {
return SimpleCxx::deps();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef ADDON1_HPP_
#define ADDON1_HPP_

#include <string>

namespace Addon1 {

// return a string containing "Addon1"
std::string getAddon1();

// return a string describing the dependencies of "Addon1", recursively
std::string depsAddon1();

}

#endif /* ADDON1_HPP_ */
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
TRIBITS_ADD_LIBRARY(addon1
SOURCES Addon1.cpp
HEADERS Addon1.hpp
NOINSTALLHEADERS
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <iostream>
#include <string>

#include "Addon1.hpp"

int main() {
std::string label_Addon1 = Addon1::getAddon1();
std::string deps_Addon1 = Addon1::depsAddon1();
std::cout << "Addon1 label is: " << label_Addon1 << "\n";
std::cout << "Addon1 deps are: " << deps_Addon1 << "\n";
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
TRIBITS_ADD_EXECUTABLE(test SOURCES Addon1_test.cpp)

TRIBITS_ADD_ADVANCED_TEST( test
OVERALL_NUM_MPI_PROCS 1
TEST_0 EXEC test
PASS_REGULAR_EXPRESSION_ALL
"Addon1 label is: Addon1"
"Addon1 deps are: no_deps"
)

0 comments on commit 7c4cb4e

Please sign in to comment.