From 597bbde151cda8b9d5bf092342a0f36b0d76f6b1 Mon Sep 17 00:00:00 2001 From: Steinar Foss Date: Sat, 29 Jun 2019 08:20:01 +0200 Subject: [PATCH] jenkins will build python. (#865) Jenkins will build with -DOPM_ENABLE_PYTHON=ON --- jenkins/build-opm-module.sh | 2 ++ python/CMakeLists.txt | 8 ++------ python/pycmake/PythonPackage.cmake | 4 ++-- python/tests/CMakeLists.txt | 2 +- python/tests/group_tree.py | 5 ++++- python/tests/grupnet.py | 5 ++++- python/tests/parse.py | 5 ++++- python/tests/wells.py | 2 +- 8 files changed, 20 insertions(+), 13 deletions(-) diff --git a/jenkins/build-opm-module.sh b/jenkins/build-opm-module.sh index c4563f96c..8a2d1d901 100755 --- a/jenkins/build-opm-module.sh +++ b/jenkins/build-opm-module.sh @@ -4,6 +4,8 @@ declare -A configurations declare -A EXTRA_MODULE_FLAGS EXTRA_MODULE_FLAGS[opm-simulators]="-DBUILD_EBOS_EXTENSIONS=ON -DBUILD_EBOS_DEBUG_EXTENSIONS=ON" +EXTRA_MODULE_FLAGS[opm-common]="-DOPM_ENABLE_PYTHON=ON" +EXTRA_MODULE_FLAGS[libecl]="-DCMAKE_POSITION_INDEPENDENT_CODE=1" # Parse revisions from trigger comment and setup arrays # Depends on: 'upstreams', upstreamRev', diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 540a909c4..57c027da8 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,13 +1,9 @@ find_package(PythonInterp REQUIRED) -set( warnings "-Wall -Wextra -pedantic -Wpointer-arith" ) -set( warnings "${warnings} -Wformat-nonliteral -Wcast-align" ) -set( warnings "${warnings} -Wmissing-declarations -Wcast-qual" ) -set( warnings "${warnings} -Wwrite-strings -Wchar-subscripts " ) -set( warnings "${warnings} -Wredundant-decls" ) -set( CMAKE_CXX_FLAGS "-std=c++11 ${warnings} ${CMAKE_CXX_FLAGS}" ) +set( CMAKE_CXX_FLAGS "-std=c++11" ) +set( PYTHON_DIR ${CMAKE_SOURCE_DIR}/python ) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/python/pycmake) diff --git a/python/pycmake/PythonPackage.cmake b/python/pycmake/PythonPackage.cmake index 89e6cd50e..b3826fbc0 100644 --- a/python/pycmake/PythonPackage.cmake +++ b/python/pycmake/PythonPackage.cmake @@ -68,12 +68,12 @@ function(add_python_package PACKAGE_NAME PACKAGE_PATH PYTHON_FILES) install(FILES ${PYTHON_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX}/${PACKAGE_PATH}) endfunction() -function(add_python_test TESTNAME PYTHON_TEST_FILE) +function(add_python_test TESTNAME PYTHON_TEST_FILE arg) configure_file(${PYTHON_TEST_FILE} ${PYTHON_TEST_FILE} COPYONLY) add_test(NAME ${TESTNAME} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/python/tests - COMMAND python pycmake_test_runner.py ${PYTHON_TEST_FILE} + COMMAND python pycmake_test_runner.py ${PYTHON_TEST_FILE} ${arg} ) to_path_list(pythonpath "${CMAKE_BINARY_DIR}/python" "$ENV{PYTHONPATH}") diff --git a/python/tests/CMakeLists.txt b/python/tests/CMakeLists.txt index 1832e17eb..475bbb5c2 100644 --- a/python/tests/CMakeLists.txt +++ b/python/tests/CMakeLists.txt @@ -10,5 +10,5 @@ configure_file(data/schedule/TEMPLATE.SCH data/schedule/TEMPLATE.SCH COPYONLY) configure_file(utils.py utils.py COPYONLY) foreach(prog time_vector connection deck group_tree grupnet parse_deck parse state props schedule wells) - add_python_test(${prog} ${prog}.py) + add_python_test(${prog} ${prog}.py ${PYTHON_DIR}) endforeach() diff --git a/python/tests/group_tree.py b/python/tests/group_tree.py index 4dba782d9..52f5010e4 100644 --- a/python/tests/group_tree.py +++ b/python/tests/group_tree.py @@ -1,10 +1,13 @@ +import sys import unittest + import sunbeam +python_dir = sys.argv[2] class TestGroupTree(unittest.TestCase): def setUp(self): - norne = '../../../python/examples/data/norne/NORNE_ATW2013.DATA' + norne = python_dir + '/examples/data/norne/NORNE_ATW2013.DATA' self.sch = sunbeam.parse(norne, [('PARSE_RANDOM_SLASH', sunbeam.action.ignore)]).schedule def test_group(self): diff --git a/python/tests/grupnet.py b/python/tests/grupnet.py index 679ca9990..0e1fe237f 100644 --- a/python/tests/grupnet.py +++ b/python/tests/grupnet.py @@ -1,11 +1,14 @@ +import sys import unittest + import sunbeam +python_dir = sys.argv[2] class TestGrupnet(unittest.TestCase): @classmethod def setUpClass(cls): - norne = '../../../python/examples/data/norne/NORNE_ATW2013.DATA' + norne = python_dir + '/examples/data/norne/NORNE_ATW2013.DATA' cls.sch = sunbeam.parse(norne, [('PARSE_RANDOM_SLASH', sunbeam.action.ignore)]).schedule def test_vfp_table(self): diff --git a/python/tests/parse.py b/python/tests/parse.py index 20fcd3965..2f80bb6eb 100644 --- a/python/tests/parse.py +++ b/python/tests/parse.py @@ -1,6 +1,9 @@ import unittest import sunbeam import os.path +import sys + +python_dir = sys.argv[2] class TestParse(unittest.TestCase): @@ -29,7 +32,7 @@ FIPNUM def setUp(self): self.spe3fn = 'spe3/SPE3CASE1.DATA' - self.norne_fname = os.path.abspath('../../../python/examples/data/norne/NORNE_ATW2013.DATA') + self.norne_fname = os.path.abspath(python_dir + '/examples/data/norne/NORNE_ATW2013.DATA') def test_parse(self): spe3 = sunbeam.parse(self.spe3fn) diff --git a/python/tests/wells.py b/python/tests/wells.py index 0ed261f11..2415df358 100644 --- a/python/tests/wells.py +++ b/python/tests/wells.py @@ -88,7 +88,7 @@ class TestWells(unittest.TestCase): self.assertEqual(2, len(flowing)) self.assertEqual(0, len(closed)) - flowing1 = filter(lambda x: not sunbeam.Well.closed(1)(x), wells) + flowing1 = filter(lambda x: not sunbeam.Well.closed()(x), wells) closed1 = filter(sunbeam.Well.closed(), wells) self.assertListEqual(list(closed), list(closed1))