Skip to content
Snippets Groups Projects
Commit 4aa98b9f authored by Dilawar Singh's avatar Dilawar Singh
Browse files

Merge commit '99b934e9'

parents 9dcbe49f 99b934e9
No related branches found
No related tags found
No related merge requests found
#!/bin/bash - #!/usr/bin/env bash
#=============================================================================== #===============================================================================
# #
# FILE: travis_build_linux.sh # FILE: travis_build_linux.sh
...@@ -22,7 +22,7 @@ set -e ...@@ -22,7 +22,7 @@ set -e
PYTHON2="/usr/bin/python2" PYTHON2="/usr/bin/python2"
PYTHON3="/usr/bin/python3" PYTHON3="/usr/bin/python3"
#MAKEFLAGS="-j 4" #MAKEFLAGS="-j4"
# Bug: `which python` returns /opt/bin/python* etc on travis. For which numpy # Bug: `which python` returns /opt/bin/python* etc on travis. For which numpy
# many not be available. Therefore, it is neccessary to use fixed path for # many not be available. Therefore, it is neccessary to use fixed path for
...@@ -32,6 +32,7 @@ PYTHON3="/usr/bin/python3" ...@@ -32,6 +32,7 @@ PYTHON3="/usr/bin/python3"
# Old makefile based flow. # Old makefile based flow.
$PYTHON2 -m compileall -q . $PYTHON2 -m compileall -q .
if type $PYTHON3 > /dev/null; then $PYTHON3 -m compileall -q . ; fi if type $PYTHON3 > /dev/null; then $PYTHON3 -m compileall -q . ; fi
## CMAKE based flow ## CMAKE based flow
mkdir -p _GSL_BUILD && cd _GSL_BUILD && \ mkdir -p _GSL_BUILD && cd _GSL_BUILD && \
cmake -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON2" .. cmake -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON2" ..
......
set(CMAKE_LEGACY_CYGWIN_WIN32 0) set(CMAKE_LEGACY_CYGWIN_WIN32 0)
cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR) cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(MOOSE)
if(COMMAND cmake_policy) if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW) cmake_policy(SET CMP0003 NEW)
...@@ -9,7 +10,6 @@ if(COMMAND cmake_policy) ...@@ -9,7 +10,6 @@ if(COMMAND cmake_policy)
endif(POLICY CMP0050) endif(POLICY CMP0050)
endif(COMMAND cmake_policy) endif(COMMAND cmake_policy)
project(MOOSE)
include(CheckCXXCompiler.cmake) include(CheckCXXCompiler.cmake)
include(CheckIncludeFileCXX) include(CheckIncludeFileCXX)
...@@ -48,8 +48,6 @@ message( STATUS "MOOSE Version ${MOOSE_VERSION}" ) ...@@ -48,8 +48,6 @@ message( STATUS "MOOSE Version ${MOOSE_VERSION}" )
# sure that we don't have any stray generated files lying around in the tree # sure that we don't have any stray generated files lying around in the tree
# (which would end up getting picked up by header search, instead of the correct # (which would end up getting picked up by header search, instead of the correct
# versions). # versions).
message(STATUS "CMAKE_INSTALL_PREFIX : ${CMAKE_INSTALL_PREFIX}")
if( CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE ) if( CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
message(FATAL_ERROR message(FATAL_ERROR
"======================================================================\n" "======================================================================\n"
...@@ -415,17 +413,26 @@ install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/moose ...@@ -415,17 +413,26 @@ install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/moose
DESTINATION bin DESTINATION bin
) )
# This target is built by pymoose/CMakeLists.txt file. # INSTALL python module.
# This target is built by pymoose/CMakeLists.txt file. Using the --prefix option
# always override debian default installation directory. It will be installed in
# site-packages instead of dist-packages.
# See https://bugs.launchpad.net/ubuntu/+source/python2.6/+bug/362570
# HACK: Some trickery is involved. Don't pass --prefix if CMAKE_INSTALL_PREFIX is
# just /usr. This fixes debian builds.
if(WITH_PYTHON) if(WITH_PYTHON)
if( "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" )
set(EXTRA_ARGS "" )
else()
set(EXTRA_ARGS "--prefix ${CMAKE_INSTALL_PREFIX}")
endif( )
install(CODE install(CODE
" "execute_process(
execute_process( COMMAND ${PYTHON_EXECUTABLE} setup.py install ${EXTRA_ARGS}
COMMAND ${PYTHON_EXECUTABLE} setup.py install --prefix=${CMAKE_INSTALL_PREFIX}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python
)"
) )
"
)
endif(WITH_PYTHON) endif(WITH_PYTHON)
# Print message to start build process # Print message to start build process
......
...@@ -14,6 +14,7 @@ import random ...@@ -14,6 +14,7 @@ import random
import re import re
import matplotlib import matplotlib
import moose import moose
from moose.chemUtil.chemConnectUtil import * from moose.chemUtil.chemConnectUtil import *
from moose.chemUtil.graphUtils import * from moose.chemUtil.graphUtils import *
...@@ -624,6 +625,6 @@ if __name__ == "__main__": ...@@ -624,6 +625,6 @@ if __name__ == "__main__":
output = modelpath+"_.g" output = modelpath+"_.g"
written = write('/'+modelpath,output) written = write('/'+modelpath,output)
if written: if written:
print((" file written to ",output)) print(" file written to ",output)
else: else:
print(" could be written to kkit format") print(" could be written to kkit format")
...@@ -12,9 +12,15 @@ from io import StringIO ...@@ -12,9 +12,15 @@ from io import StringIO
import moose.SBML.readSBML as _readSBML import moose.SBML.readSBML as _readSBML
import moose.SBML.writeSBML as _writeSBML import moose.SBML.writeSBML as _writeSBML
import moose.genesis.writeKkit as _writeKkit
import moose.chemUtil as _chemUtil import moose.chemUtil as _chemUtil
kkitImport_, kkitImport_error_ = True, ''
try:
import moose.genesis.writeKkit as _writeKkit
except ImportError as e:
kkitImport_ = False
kkitImport_err_ = '%s' % e
# Import function from C++ module into moose namespace. # Import function from C++ module into moose namespace.
from moose._moose import * from moose._moose import *
...@@ -88,6 +94,11 @@ def mooseWriteKkit(modelpath, filepath,sceneitems={}): ...@@ -88,6 +94,11 @@ def mooseWriteKkit(modelpath, filepath,sceneitems={}):
modelpath -- model path in moose \n modelpath -- model path in moose \n
filepath -- Path of output file. filepath -- Path of output file.
""" """
global kkitImport_, kkitImport_err_
if not kkitImport_:
print( '[WARN] Could not import module to enable this function' )
print( '\tError was %s' % kkitImport_error_ )
return False
return _writeKkit.mooseWriteKkit(modelpath, filepath,sceneitems) return _writeKkit.mooseWriteKkit(modelpath, filepath,sceneitems)
......
...@@ -110,37 +110,45 @@ def suitable_for_testing( script ): ...@@ -110,37 +110,45 @@ def suitable_for_testing( script ):
return False, 'waits for user input' return False, 'waits for user input'
return True, 'OK' return True, 'OK'
def run_test( index, testfile ): def run_test( index, testfile, timeout, **kwargs):
"""Run a given test """Run a given test
""" """
global test_status_ global test_status_
global total_ global total_
pyExec = os.environ.get( 'PYTHON_EXECUTABLE', '/usr/bin/python' ) pyExec = os.environ.get( 'PYTHON_EXECUTABLE', '/usr/bin/python' )
cmd = Command( [ pyExec, testfile ] ) cmd = Command( [ pyExec, testfile ] )
ti = time.time( ) ti = time.time( )
status = cmd.run( timeout = 60 )
name = os.path.basename( testfile ) name = os.path.basename( testfile )
out = (name + '.' * 50)[:40]
print( '[TEST %3d/%d] %41s ' % (index, total_, out), end='' )
sys.stdout.flush( )
# Run the test.
status = cmd.run( timeout = timeout )
t = time.time( ) - ti t = time.time( ) - ti
print( '% 7.2f ' % t, end='' )
sys.stdout.flush( )
# Change to directory and copy before running then test.
cwd = os.path.dirname( testfile ) cwd = os.path.dirname( testfile )
os.chdir( cwd ) os.chdir( cwd )
with open( os.path.join( cwd, 'matplotlibrc' ), 'w' ) as f: with open( os.path.join( cwd, 'matplotlibrc' ), 'w' ) as f:
_logger.debug( 'Writing matplotlibrc to %s' % cwd ) _logger.debug( 'Writing matplotlibrc to %s' % cwd )
f.write( matplotlibrc_ ) f.write( matplotlibrc_ )
out = (name + '.' * 50)[:50]
print( '[TEST %3d/%d] %50s %.2f sec ' % (index, total_, out, t), end='' )
sys.stdout.flush( )
if status != 0: if status != 0:
if status == -15: if status == -15:
msg = '%2d TIMEOUT' % status msg = '% 4d TIMEOUT' % status
test_status_[ 'TIMED-OUT' ].append( testfile ) test_status_[ 'TIMED-OUT' ].append( testfile )
else: else:
msg = '%2d FAILED' % status msg = '% 4d FAILED' % status
test_status_[ 'FAILED' ].append( testfile ) test_status_[ 'FAILED' ].append( testfile )
print( msg ) print( msg )
else: else:
print( '%2d PASSED' % status ) print( '% 4d PASSED' % status )
test_status_[ 'PASSED' ].append( testfile ) test_status_[ 'PASSED' ].append( testfile )
sys.stdout.flush( ) sys.stdout.flush( )
def print_test_stat( ): def print_test_stat( ):
...@@ -148,7 +156,7 @@ def print_test_stat( ): ...@@ -148,7 +156,7 @@ def print_test_stat( ):
for status in test_status_: for status in test_status_:
print( 'Total %d tests %s' % (len( test_status_[status] ), status ) ) print( 'Total %d tests %s' % (len( test_status_[status] ), status ) )
def test_all( ): def test_all( timeout, **kwargs ):
global test_dir_ global test_dir_
global total_ global total_
scripts = [ ] scripts = [ ]
...@@ -171,20 +179,21 @@ def test_all( ): ...@@ -171,20 +179,21 @@ def test_all( ):
total_ = len( scripts ) total_ = len( scripts )
for i, s in enumerate( scripts ): for i, s in enumerate( scripts ):
_logger.info( 'Running test : %s' % s ) _logger.info( 'Running test : %s' % s )
run_test(i, s ) run_test(i, s, timeout, **kwargs )
def test( ): def test( timeout = 60, **kwargs ):
"""Download and run tests. """Download and run tests.
""" """
print( '[INFO] Running test with timeout %d sec' % timeout )
try: try:
init_test_dir( ) init_test_dir( )
except Exception as e: except Exception as e:
print( '[INFO] Failed to clone moose-examples. Error was %s' % e ) print( '[INFO] Failed to clone moose-examples. Error was %s' % e )
quit( ) quit( )
test_all( ) test_all( timeout = timeout, **kwargs )
print_test_stat( ) print_test_stat( )
if __name__ == '__main__': if __name__ == '__main__':
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment