Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General overhaul of the build and test system #217

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
416 changes: 416 additions & 0 deletions CMakeLists.txt

Large diffs are not rendered by default.

77 changes: 47 additions & 30 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,56 @@
def PROJECT_NAME=JOB_NAME.split("\\s|/")[2].toLowerCase()

pipeline {
agent {
docker {
image "fluidity/baseimages:${PROJECT_NAME}"
label 'azure-linux-8core'
}
}
agent none
environment {
MPLBACKEND = 'PS'
OMPI_MCA_btl = '^openib'
}
stages {
stage('Configuring') {
steps {
slackSend "Build started - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
sh './configure --enable-2d-adaptivity'
}
}
stage('Building') {
steps {
sh 'make -j' ;
sh 'make -j fltools' ;
sh 'make manual'
}
}
stage('Testing') {
steps {
sh 'make unittest' ;
sh 'make THREADS=8 test' ;
sh 'make THREADS=8 mediumtest'
junit 'tests/test_result*xml'
}
}
}
stage('Testing') {
parallel {
// For each combination of parameters required, build and test
stage('Build and test xenial autoconf container') {
agent {
docker {
image "fluidity/baseimages:xenial"
label 'dockerhost'
}
}
steps {
slackSend "Build started - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
sh './configure --enable-2d-adaptivity'
sh 'make' ;
sh 'make fltools' ;
sh 'make manual'
sh 'make unittest' ;
sh 'make THREADS=8 shorttest' ;
sh 'make THREADS=8 mediumtest'
junit 'tests/test_result*xml'
}
}
stage('Build and test xenial cmake container') {
agent {
docker {
image "fluidity/baseimages:xenial"
label 'dockerhost'
}
}
environment {
PETSc_DIR = '/usr/lib/petscdir/3.6.3/linux-gnu-c-opt/lib/petsc/conf'
}
steps {
slackSend "Build started - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
sh 'cmake -D USE_LIBMBA=ON -DUSE_EXODUSII=ON .'
sh 'make' ;
sh 'make fltools' ;
sh 'make unittest' ;
sh 'make THREADS=8 shorttest' ;
sh 'find . -name test_results.xml' ;
junit 'test_results.xml'
}
}
}
}
}
post {
aborted {
slackSend(color: '#DEADED',
Expand Down
77 changes: 8 additions & 69 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,8 @@ CXXFLAGS= @CPPFLAGS@ @CXXFLAGS@ -I./include

LINKER = @LINKER@ @LDFLAGS@ $(CXXFLAGS)

FLLINKER = @FLLINKER@ @LDFLAGS@ $(FCFLAGS)

LIBS = -L./lib -l$(FLUIDITY) @LIB_FEMDEM@ ./lib/libadaptivity.a \
./lib/libvtkfortran.a @LIBSPATIALINDEX@ @SPUDLIB@ @FLIBJUDY@ \
@LIBS@ @BLAS_LIBS@
./lib/libvtkfortran.a @LIBS@ @BLAS_LIBS@

OBJS = $(shell find . -mindepth 2 -maxdepth 2 -name '*.c' -o -name '*.cpp' -o -name '*.[fF]' -o -name '*.F90' | grep -v ^./lib | xargs)
MAKE = @MAKE@ -s
Expand Down Expand Up @@ -111,12 +108,7 @@ endif
default: bin/$(FLUIDITY)

sub_system: $(LIBMBA2D) $(LIBMBA3D) @LIB_FEMDEM@ \
lib/libadaptivity.a lib/libvtkfortran.a @LIBSPATIALINDEX@ \
@SPUDLIB@ @FLIBJUDY@ include/version.h

@FLIBJUDY@:
@echo ' MKDIR lib'; mkdir -p lib
echo ' MAKE libjudy'; $(MAKE) -C libjudy > make.log && $(MAKE) -C libjudy install >> make.log
lib/libadaptivity.a lib/libvtkfortran.a include/version.h

lib/libmba2d.a:
@echo ' MKDIR lib'; mkdir -p lib
Expand All @@ -134,18 +126,6 @@ lib/libvtkfortran.a:
@echo ' MKDIR lib'; mkdir -p lib
echo ' MAKE libvtkfortran'; $(MAKE) -C libvtkfortran 2>make.log 2>&1 && cp libvtkfortran/libvtkfortran.a lib/ && cp libvtkfortran/*.mod include/

@LIBSPATIALINDEX@:
@echo ' MKDIR lib'; mkdir -p lib
echo ' MAKE libspatialindex'; $(MAKE) -C @SPATIALINDEXDIR@ && $(MAKE) -C @SPATIALINDEXDIR@ install >> make.log 2>&1

@SPUDLIB@:
@echo ' MKDIR lib'; mkdir -p lib
ifeq (@SPUD_ONLY@,yes)
echo ' MAKE libspud'; $(MAKE) -C libspud && $(MAKE) -C libspud install-libspud
else
echo ' MAKE libspud'; $(MAKE) -C libspud && $(MAKE) -C libspud install-libspud && cd libspud/python && python setup.py build && cd ../.. && cp libspud/python/build/lib*/libspud.so python/
endif

libfemtools: sub_system
@echo ' MKDIR lib'; mkdir -p lib
@echo ' MAKE debug'
Expand All @@ -159,9 +139,7 @@ ifeq (@FEMDEM@,yes)
@$(MAKE) -C @FLFEMDEM_PATH@
endif

@SPUDHEADER@: @SPUDLIB@

main.o: include/version.h @SPUDHEADER@
main.o: include/version.h

include/version.h: version-info
@bin/version-info $@
Expand Down Expand Up @@ -358,14 +336,6 @@ endif
clean: clean-light clean-test python_clean clean-debian
@echo " CLEAN libvtkfortran"
@cd libvtkfortran; $(MAKE) clean
@echo " CLEAN libjudy"
@cd libjudy; $(MAKE) clean >> make.log 2>&1
ifeq ($(abspath @SPUDLIB@),$(abspath lib/libspud.a))
@echo " CLEAN libspud"
@cd libspud; $(MAKE) clean
endif
@echo " CLEAN libspatialindex"
@cd @SPATIALINDEXDIR@; $(MAKE) clean >> make.log
@echo " CLEAN libmba2d"
@cd libmba2d; $(MAKE) clean
@echo " CLEAN libmba3d"
Expand Down Expand Up @@ -402,10 +372,7 @@ distclean: clean
test/mvrtree/.deps test/rtree/.deps test/tprtree/.deps \
make.log > /dev/null
@cd libadaptivity ; make distclean > /dev/null
@cd libjudy ; make distclean > /dev/null
@cd libvtkfortran ; make distclean > /dev/null
@cd libspud ; make distclean > /dev/null ; rm -rf \
libspud.so.0 libtool diamond/build python/build > /dev/null
@cd tools ; make distclean > /dev/null
@rm -fr `find ./ -name config.status` `find ./ -name \
config.log` share include/Judy.h include/Wm4Command.h \
Expand All @@ -424,8 +391,6 @@ distclean: clean
include/Wm4Tetrahedron3.h include/Wm4Triangle2.h \
include/Wm4Triangle3.h include/Wm4Vector2.h \
include/Wm4Vector3.h include/confdefs.h include/config.h \
include/spatialindex include/spud include/spud.h \
include/spud_enums.h include/tinystr.h include/tinyxml.h \
include/version.h include/vtk.h \
preprocessor/check_options.F90 \
preprocessor/register_diagnostics.F90 python/setup.py > \
Expand All @@ -434,20 +399,12 @@ distclean: clean
@find ./ \( -name make.log \) -exec rm -f {} \; > /dev/null
@rm -f Makefile > /dev/null

test: serialtest

serialtest: fltools bin/$(FLUIDITY)
shorttest: fltools bin/$(FLUIDITY)
@cd tests; ../bin/testharness -x test_results.xml -l short $(EXCLUDE_TAGS) -n $(THREADS)

mediumtest: fltools bin/$(FLUIDITY) manual spudtools
mediumtest: fltools bin/$(FLUIDITY) manual
@cd tests; ../bin/testharness -x test_results_medium.xml -l medium $(EXCLUDE_TAGS) -n $(THREADS)

.PHONY: spudtools

spudtools:
@cd libspud ; $(MAKE) install-spudtools
@echo " INSTALL spudtools"

setuputs:
@echo "SETUP tests"
@echo " RMDIR bin/tests"
Expand All @@ -457,10 +414,6 @@ setuputs:
@ln -sf ../../tests/data bin/tests/data

build_unittest: fluidity_library libfemtools setuputs
ifeq (@SPUDLIB@,./lib/libspud.a)
@echo " UNITTEST libspud"
@cd libspud/src/tests; $(MAKE) test-binaries; find bin/* -maxdepth 1 -type f -exec ln -sf ../../libspud/src/tests/{} ../../../bin/tests \;
endif
@echo " UNITTEST error_measures"
@cd error_measures/tests; $(MAKE) unittest
@echo " UNITTEST horizontal_adaptivity"
Expand All @@ -479,13 +432,9 @@ unittest: build_unittest
@echo "RUN bin/tests"
@bin/unittestharness bin/tests

bin/spud-preprocess:
@echo "Installing spudtools"
@$(MAKE) -C libspud install-spudtools

schema: bin/spud-preprocess
schema:
@echo "Rebuilding schema fluidity_options.rng"
@./bin/spud-preprocess schemas/fluidity_options.rnc
@spud-preprocess schemas/fluidity_options.rnc

.PHONY: makefiles

Expand Down Expand Up @@ -540,7 +489,7 @@ endif
install: default fltools
@mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(docdir)/fluidity
find bin/ -maxdepth 1 -type f -exec cp '{}' $(DESTDIR)$(bindir) \;
rm -f $(DESTDIR)$(bindir)/spud-* $(DESTDIR)$(bindir)/diamond $(DESTDIR)$(bindir)/silenteval $(DESTDIR)$(bindir)/runut
rm -rf $(DESTDIR)$(bindir)/silenteval $(DESTDIR)$(bindir)/runut
[ -f manual/fluidity_manual.pdf ] && cp manual/fluidity_manual.pdf $(DESTDIR)$(docdir)/fluidity || true
mkdir -p $(DESTDIR)$(datadir)/fluidity
cp -R schemas $(DESTDIR)$(datadir)/fluidity/
Expand All @@ -552,16 +501,6 @@ install: default fltools
find $(DESTDIR)$(docdir)/fluidity/examples -type f -exec $(SED) -i "s/\.\.\/\.\.\/bin\///" '{}' \;
cd $(DESTDIR)$(docdir)/fluidity ; tar -czvf $(DESTDIR)$(docdir)/fluidity/examples.tar.gz examples/
rm -rf $(DESTDIR)$(docdir)/fluidity/examples/

install-diamond:
cd libspud; ./configure --prefix=@prefix@; cd ../..
cd libspud; $(MAKE) clean; cd ../..
cd libspud; $(MAKE) install-diamond; cd ../..
cd libspud; $(MAKE) install-dxdiff; cd ../..
cd libspud; $(MAKE) install-spudtools; cd ../..
cd libspud; ./configure --prefix=$(PWD); cd ../..

install-user-schemata:
mkdir -p $(HOME)/.diamond/schemata/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to now be part of install rather than the separate install-user-schemata. Is this intentional? As I'm not sure this is correct. Installing things in $(HOME) should not be part of install which should only be installing things in $(DESTDIR). In particular make install is typically run with sudo in which case $(HOME) is ambiguous or might not even be writable by root. I wonder whether we can get rid of make install-user-schemata; I have never used it personally.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - good point.

echo "Fluidity Markup Language" > $(HOME)/.diamond/schemata/flml
echo "$(PWD)/schemas/fluidity_options.rng" >> $(HOME)/.diamond/schemata/flml
Expand Down
6 changes: 6 additions & 0 deletions assemble/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
file(GLOB lib_srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.F90)
add_library_sources(${lib_srcs})
add_subdirectory(tests EXCLUDE_FROM_ALL)

set(unittests ${assemble_unittests};${unittests} PARENT_SCOPE)
set(unittest_meshes_3d ${assemble_unittest_meshes_3d};${unittest_meshes_3d} PARENT_SCOPE)
17 changes: 17 additions & 0 deletions assemble/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 2.6)
enable_language (Fortran CXX)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/tests)

file(GLOB tests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.F90)
list(REMOVE_ITEM tests test_mba_supermesh.F90 test_legacy_cv_faces.F90 test_lagrangian_remap.F90 test_adapt_mesh_mba3d.F90 test_pressure_solve.F90 test_matrix_free.F90 test_dg_interpolation_quads.F90 test_dg_diffusion.F90)
foreach(unittest IN LISTS tests)
get_filename_component(test_name ${unittest} NAME_WE)
add_library(${test_name}_main OBJECT test_main.cpp)
set_target_properties(${test_name}_main PROPERTIES COMPILE_FLAGS -DTESTNAME=${test_name}_)
add_executable(${test_name} ${unittest} $<TARGET_OBJECTS:${test_name}_main>)
target_link_libraries(${test_name} fluidity ${FLUIDITY_PACKAGE_LIBS})
list(APPEND unittests ${test_name})
endforeach()

set(assemble_unittests ${unittests} PARENT_SCOPE)
set(assemble_unittest_meshes_3d "cube_prismatic;cube_unstructured;" PARENT_SCOPE)
2 changes: 1 addition & 1 deletion assemble/tests/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ CXXFLAGS= @CPPFLAGS@ @CXXFLAGS@ -I../include -I../../include

LDFLAGS = @LDFLAGS@

LIBS = ./lib/libadaptivity.a ./lib/libvtkfortran.a @LIBSPATIALINDEX@ @SPUDLIB@ @FLIBJUDY@ @LIBS@
LIBS = ./lib/libadaptivity.a ./lib/libvtkfortran.a @LIBS@
FLIBS = @FLIBS@
LIBFLUIDITY=../../lib/lib$(FLUIDITY).a

Expand Down
1 change: 1 addition & 0 deletions bathymetry/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_library_sources(NetCDF_reader.cpp SampleNetCDF2.cpp import_bath_data.cpp read_netcdf_interface.cpp)
2 changes: 1 addition & 1 deletion bathymetry/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ CXXFLAGS = -I../include @CXXFLAGS@ @CPPFLAGS@

LDFLAGS = @LDFLAGS@
LIBS = -L../lib -l$(FLUIDITY) @LIBS@ @BLAS_LIBS@ \
../lib/libvtkfortran.a @LIBSPATIALINDEX@ @SPUDLIB@ @FLIBJUDY@
../lib/libvtkfortran.a

OBJS = NetCDF_reader.o SampleNetCDF2.o import_bath_data.o read_netcdf_interface.o

Expand Down
2 changes: 2 additions & 0 deletions climatology/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_executable(create_climatology_atlas EXCLUDE_FROM_ALL create_climatology_atlas.cpp)
target_link_libraries(create_climatology_atlas fluidity vtkfortran ${spatialindex} adaptivity ${VTK_LIBRARIES} ${MPI_LIBRARIES} ${PETSC_PACKAGE_LIBS} ${PETSC_LIB} ${ZOLTAN_LIB} ${SPUD_LIB} ${JUDY_LIB} ${UDUNITS_LIB} ${MBA2D_LIBS} ${PYTHON_LIBRARIES})
Loading