Skip to content

Commit

Permalink
Merge pull request #63 from hariharan-devarajan/catch2
Browse files Browse the repository at this point in the history
Added Catch2 CI integration.
  • Loading branch information
ChristopherHogan committed Jan 11, 2021
2 parents 68cfedc + 4080799 commit 2b49a6f
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: GitHub Actions
# events but only for the master branch
on:
push:
branches: [ master, chogan/**, kimmy/** ]
branches: [ master, chogan/**, kimmy/**, hariharan/** ]
pull_request:
branches: [ master ]

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ GTAGS

.gdb_history

/cmake-build-debug/
/.idea/
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ if(CMAKE_PROJECT_NAME STREQUAL HERMES)
endif()

if(CMAKE_PROJECT_NAME STREQUAL HERMES AND BUILD_TESTING)
find_package(Catch2 REQUIRED)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()

Expand Down
56 changes: 56 additions & 0 deletions ci/hermes/packages/catch2/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

# ----------------------------------------------------------------------------
# If you submit this package back to Spack as a pull request,
# please first remove this boilerplate and all FIXME comments.
#
# This is a template package file for Spack. We've put "FIXME"
# next to all the things you'll want to change. Once you've handled
# them, you can save this file and test your package like this:
#
# spack install catch2
#
# You can edit this file again by typing:
#
# spack edit catch2
#
# See the Spack documentation for more information on packaging.
# ----------------------------------------------------------------------------

from spack import *


class Catch2(CMakePackage):

homepage = "https://github.com/catchorg/Catch2"
url = "https://github.com/catchorg/Catch2.git"

version('2.13.3', sha256='fedc5b008f7eb574f45098e7c7138211c543f0f8ad04792090e790511697a877')

def url_for_version(self, version):
url = "https://github.com/catchorg/Catch2/archive/v{0}.tar.gz"
return url.format(version)

def cmake_args(self):
options = ['-DCMAKE_INSTALL_PREFIX={}'.format(self.prefix),
'-DBUILD_TESTING=OFF']
return options

def set_include(self,env,path):
env.append_flags('CFLAGS', '-I{}'.format(path))
env.append_flags('CXXFLAGS', '-I{}'.format(path))
def set_lib(self,env,path):
env.prepend_path('LD_LIBRARY_PATH', path)
env.append_flags('LDFLAGS', '-L{}'.format(path))
def set_flags(self,env):
self.set_include(env,'{}/include'.format(self.prefix))
self.set_include(env,'{}/include'.format(self.prefix))
self.set_lib(env,'{}/lib'.format(self.prefix))
self.set_lib(env,'{}/lib64'.format(self.prefix))
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
self.set_flags(spack_env)
def setup_run_environment(self, env):
self.set_flags(env)
69 changes: 69 additions & 0 deletions ci/hermes/packages/gortools/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

# ----------------------------------------------------------------------------
# If you submit this package back to Spack as a pull request,
# please first remove this boilerplate and all FIXME comments.
#
# This is a template package file for Spack. We've put "FIXME"
# next to all the things you'll want to change. Once you've handled
# them, you can save this file and test your package like this:
#
# spack install rpclib
#
# You can edit this file again by typing:
#
# spack edit rpclib
#
# See the Spack documentation for more information on packaging.
# ----------------------------------------------------------------------------

from spack import *


class Gortools(Package):

homepage = "https://developers.google.com/optimization/install/cpp"
version('8.0', sha256='ac01d7ebde157daaeb0e21ce54923a48e4f1d21faebd0b08a54979f150f909ee')
version('7.1', sha256='c4c65cb3351554d207d5bb212601ca4e9d352563cda35a283d75963739d16bbd')
version('7.2', sha256='13a4de5dba1f64e2e490394f8f63fe0a301ee55466ef65fe309ffd5100358ea8')
version('7.3', sha256='b87922b75bbcce9b2ab5da0221751a3c8c0bff54b2a1eafa951dbf70722a640e')
version('7.4', sha256='89fafb63308b012d56a6bb9b8da9dead4078755f137a4f6b3567b36a7f3ba85c')
version('7.5', sha256='fb111aaacaf89d395d62e9e871833afdcf7f168b9f004bcfc9b70a894852f808')
version('7.6', sha256='a41202ebe24e030dccaf15846bd24224eec692b523edd191596b6a15159a2d47')
version('7.7', sha256='d20eb031ea3f1b75e55e44ae6acdb674ee6fb31e7a56498be32dc83ba9bc13bd')
version('7.8', sha256='d93a9502b18af51902abd130ff5f23768fcf47e266e6d1f34b3586387aa2de68')
version('7.0', sha256='379c13c9a5ae70bf0e876763005b2d2d51fcf966882b28b1a65344f2d3d2c589')
depends_on('gflags')
depends_on('cmake')
depends_on('gcc@8.3.0')

def url_for_version(self, version):
url = "https://github.com/google/or-tools/archive/v{}.tar.gz"
return url.format(version)
#def cmake_args(self):
# args = ['-DCMAKE_INSTALL_PREFIX={}'.format(self.prefix),'-DBUILD_DEPS:BOOL=ON']
# return args
def install(self, spec, prefix):
options = ['prefix=%s' % prefix]
#with working_dir('spack-build', create=True):
make('third_party')
make('cc')
make('install_cc', *options)
def set_include(self,env,path):
env.append_flags('CFLAGS', '-I{}'.format(path))
env.append_flags('CXXFLAGS', '-I{}'.format(path))
def set_lib(self,env,path):
env.prepend_path('LD_LIBRARY_PATH', path)
env.append_flags('LDFLAGS', '-L{}'.format(path))
def set_flags(self,env):
self.set_include(env,'{}/include'.format(self.prefix))
self.set_include(env,'{}/include'.format(self.prefix))
self.set_lib(env,'{}/lib'.format(self.prefix))
self.set_lib(env,'{}/lib64'.format(self.prefix))
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
self.set_flags(spack_env)
def setup_run_environment(self, env):
self.set_flags(env)
2 changes: 2 additions & 0 deletions ci/hermes/repo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
repo:
namespace: hermes
6 changes: 5 additions & 1 deletion ci/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ SPACK_DIR=${INSTALL_DIR}/spack
SDS_REPO_DIR=${INSTALL_DIR}/sds-repo
THALLIUM_VERSION=0.8.3
GOTCHA_VERSION=develop
CATCH2_VERSION=2.13.3

echo "Installing dependencies at ${INSTALL_DIR}"
mkdir -p ${INSTALL_DIR}
Expand All @@ -23,15 +24,18 @@ git clone https://xgitlab.cels.anl.gov/sds/sds-repo.git ${SDS_REPO_DIR}

set +x
spack repo add ${SDS_REPO_DIR}
spack repo add ./ci/hermes

GOTCHA_SPEC=gotcha@${GOTCHA_VERSION}
spack install ${GOTCHA_SPEC}
THALLIUM_SPEC="mochi-thallium~cereal@${THALLIUM_VERSION} ^mercury~boostsys"
spack install ${THALLIUM_SPEC}
CATCH2_SPEC="catch2@${CATCH2_VERSION}"
spack install ${CATCH2_SPEC}

SPACK_STAGING_DIR=~/spack_staging
mkdir -p ${SPACK_STAGING_DIR}
spack view --verbose symlink ${SPACK_STAGING_DIR} ${THALLIUM_SPEC} ${GOTCHA_SPEC}
spack view --verbose symlink ${SPACK_STAGING_DIR} ${THALLIUM_SPEC} ${GOTCHA_SPEC} ${CATCH2_SPEC}
set -x

ORTOOLS_VERSION=v7.7
Expand Down
1 change: 1 addition & 0 deletions ci/install_hermes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ cmake \
-DHERMES_USE_THREAD_SANITIZER=OFF \
-DHERMES_RPC_THALLIUM=ON \
-DHERMES_DEBUG_HEAP=OFF \
-DBUILD_TESTING=ON \
..

cmake --build . -- -j4
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if(HERMES_HAVE_GOTCHA)
add_executable(stdio_test stdio_test.c)
target_link_libraries(stdio_test hermes)
add_executable(mpi_test mpi_test.c)
target_link_libraries(mpi_test hermes)
target_link_libraries(mpi_test hermes MPI::MPI_CXX)
endif()

#------------------------------------------------------------------------------
Expand Down

0 comments on commit 2b49a6f

Please sign in to comment.