Commit dc68d968 authored by Baird, Mark's avatar Baird, Mark Committed by Salko Jr, Robert
Browse files

Correction to tests

Tests need to use the version of python installed during config time
instead of system python.  Also, there was a typo for the conda install
for macs.
parent 5322f605
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
before_script:
  - SRC_DIR=`pwd`

tests:
   type: test
   tags:
      - subkit_tests
   variables:
      BLD_NAME: "tests"
      BLD_DIR: "/tmp/$BLD_NAME"
   artifacts:
      paths:
        - LastTestsFailed.log
@@ -12,10 +18,13 @@ tests:
   script:
      - pwd
      - SRC_DIR=`pwd`
      - mkdir -p build
      - cd build
      - mkdir -p $BLD_DIR
      - cd $BLD_DIR
      - rm -rf *
      - $SRC_DIR/config.sh $SRC_DIR
      - make -j4
      - cd tests
      - ./test_driver.sh
      - make -j16
      - ctest -j16
   after_script:
      - SRC_DIR=`pwd`
      - cd $BLD_DIR
      - cp $BLD_DIR/Testing/Temporary/* $SRC_DIR/
+91 −18
Original line number Diff line number Diff line
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR)
project(SubKit)

IF (NOT TRIBITS_PROCESSING_PACKAGE)
   include("${CMAKE_CURRENT_SOURCE_DIR}/ProjectName.cmake")
   project(${PROJECT_NAME} NONE)
   set(${PROJECT_NAME}_TRIBITS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/wasp/TriBITS/tribits" CACHE PATH "")
   include("${${PROJECT_NAME}_TRIBITS_DIR}/TriBITS.cmake")

   TRIBITS_PROJECT_ENABLE_ALL()
ELSE(NOT TRIBITS_PROCESSING_PACKAGE)
  INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
  INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
  TRIBITS_PACKAGE_DECL(SubKit)
  TRIBITS_PROCESS_SUBPACKAGES()
  TRIBITS_PACKAGE_DEF()
  TRIBITS_PACKAGE_POSTPROCESS()
ENDIF(NOT TRIBITS_PROCESSING_PACKAGE)

file(COPY SubKit doc tests LICENSE MANIFEST.in README.md DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_subdirectory(wasp)

find_package(PythonInterp 2.7 REQUIRED )
find_package(PythonLibs 2.7 REQUIRED )
find_package(PythonInterp 2.7.5 REQUIRED )
find_package(PythonLibs 2.7.5 REQUIRED )
find_program(PYTHON "python")
SET(PYTHON_EXE
    ${PYTHON}
)
# Find if a Python module is installed
# Found at http://www.cmake.org/pipermail/cmake/2011-January/041666.html
# To use do: find_python_module(PyQt4 REQUIRED)
function(find_python_module module)
	string(TOUPPER ${module} module_upper)
	if(NOT PY_${module_upper})
		if(ARGC GREATER 1 AND ARGV1 STREQUAL "REQUIRED")
			set(${module}_FIND_REQUIRED TRUE)
		endif()
		# A module's location is usually a directory, but for binary modules
		# it's a .so file.
		execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
			"import re, ${module}; print(re.compile('/__init__.py.*').sub('',${module}.__file__))"
			RESULT_VARIABLE _${module}_status
			OUTPUT_VARIABLE _${module}_location
			ERROR_QUIET
			OUTPUT_STRIP_TRAILING_WHITESPACE)
		if(NOT _${module}_status)
			set(PY_${module_upper} ${_${module}_location} CACHE STRING
				"Location of Python module ${module}")
		endif(NOT _${module}_status)
	endif(NOT PY_${module_upper})
	find_package_handle_standard_args(PY_${module} DEFAULT_MSG PY_${module_upper})
endfunction(find_python_module)

if (PYTHON)
    set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in")
    set(SETUP_PY    "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
    set(DEPS        "${CMAKE_CURRENT_SOURCE_DIR}/SubKit/__init__.py")
    set(OUTPUT      "${CMAKE_CURRENT_BINARY_DIR}/build/timestamp")

    configure_file(${SETUP_PY_IN} ${SETUP_PY})

    add_custom_command(OUTPUT ${OUTPUT}
                       COMMAND ${PYTHON} ${SETUP_PY} build
                       COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT}
                       DEPENDS ${DEPS})
if(NOT "find_python_module(PyQt4)")
  if(UNIX AND NOT APPLE)
     SET(MAKE_INSTALL_DIR_COMMAND
     "mkdir -p ${CMAKE_CURRENT_BINARY_DIR}"
     )
     SET(PYTHON_CONFIGURE_COMMAND
     "${CMAKE_CURRENT_SOURCE_DIR}/cmake/bundle/linux/Miniconda2-latest-Linux-x86_64.sh -b -u -p ${CMAKE_CURRENT_BINARY_DIR}/conda"
     )
     SET(PYTHON_UPDATE_COMMAND
     "${CMAKE_CURRENT_BINARY_DIR}/conda/bin/pip install -r ${CMAKE_CURRENT_SOURCE_DIR}/cmake/bundle/linux/requirements.txt --no-index --find-links file://${CMAKE_CURRENT_SOURCE_DIR}/cmake/bundle/linux"
     )
     MESSAGE("Building Python via Miniconda")
     execute_process(
         COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX}/conda
         COMMAND bash -c ${PYTHON_CONFIGURE_COMMAND}
         OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/miniconda.log
     )
     execute_process(
          COMMAND bash -c ${PYTHON_UPDATE_COMMAND}
          OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/update_miniconda.log
     )
  else()
     SET(MAKE_INSTALL_DIR_COMMAND
     "mkdir -p ${CMAKE_CURRENT_BINARY_DIR}"
     )
     SET(PYTHON_CONFIGURE_COMMAND
     "${CMAKE_CURRENT_SOURCE_DIR}/cmake/bundle/macos/Miniconda2-latest-MacOSX-x86_64.sh -b -u -p ${CMAKE_CURRENT_BINARY_DIR}/conda"
     )
     SET(PYTHON_UPDATE_COMMAND
     "${CMAKE_CURRENT_BINARY_DIR}/conda/bin/pip install -r ${CMAKE_CURRENT_BINARY_DIR}/cmake/bundle/macos/requirements.txt --no-index --find-links file://${CMAKE_CURRENT_BINARY_DIR}/cmake/bundle/macos"
     )
     MESSAGE("bash  -c ${PYTHON_CONFIGURE_COMMAND}")
     execute_process(
         COMMAND mkdir -p ${CMAKE_INSTALL_PREFIX}/conda
         COMMAND bash -c ${PYTHON_CONFIGURE_COMMAND}
         OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/miniconda.log
     )
     execute_process(
          COMMAND bash -c ${PYTHON_UPDATE_COMMAND}
          OUTPUT_FILE${CMAKE_CURRENT_BINARY_DIR}/update_miniconda.log
     )
  endif()
endif()

    add_custom_target(target ALL DEPENDS ${OUTPUT})
INSTALL( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/conda DESTINATION ${CMAKE_INSTALL_PREFIX} )
INSTALL( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/SubKit DESTINATION ${CMAKE_INSTALL_PREFIX} )

    install(CODE "execute_process(COMMAND ${PYTHON} ${SETUP_PY} install)")
endif()
add_subdirectory(tests)

PackagesList.cmake

0 → 100644
+3 −0
Original line number Diff line number Diff line
TRIBITS_REPOSITORY_DEFINE_PACKAGES(
   wasp wasp PT
)

ProjectName.cmake

0 → 100644
+1 −0
Original line number Diff line number Diff line
SET(PROJECT_NAME SubKit)
+8 −3
Original line number Diff line number Diff line
@@ -9,15 +9,20 @@ import utils.utils as utils
from subprocess import Popen, PIPE, check_call
mypath = os.path.abspath(os.path.dirname(__file__))
localWaspPath = os.path.join(mypath, "../../wasp")
inCTFpath = os.path.join(mypath, '../..')
CIpath = "/Users/rsk/SubKit/SubKit/wasp/build/install"
if os.path.exists(localWaspPath):
    # This is where users should have built and installed WASP
    sys.path.append(sys.path.append(os.path.join(localWaspPath, "wasppy")))
    waspPath = localWaspPath
    waspPath = os.path.join(localWaspPath, 'wasputils')
elif os.path.exists(CIpath):
    # This is where the test CI will look for it on the testing machine
    sys.path.append(os.path.join(CIpath, "wasppy"))
    waspPath = CIpath
    waspPath = os.path.join(CIpath, 'wasputils')
elif os.path.exists(inCTFpath):
    # This is where wasppy will be when SubKit is installed as part of CTF
    sys.path.append(os.path.join(inCTFpath, "wasppy"))
    waspPath = os.path.join(inCTFpath, 'bin')
else:
    raise RuntimeError("WASP package was not found.  It must be installed in SubKit/wasp/build/install to use the input mode.")
from wasp2py import get_json_dict, get_wasp_utility_path
@@ -39,7 +44,7 @@ class InpParse(object):
        #me.inpDict = yaml.safe_load(open(inpFileName).read())

        # First run the validator to check if this is valid before loading it
        validator = os.path.join(waspPath, 'wasputils/ddivalid')
        validator = os.path.join(waspPath, 'ddivalid')
        schemaPath = os.path.join(mypath, 'input.sch')
        cmd = '"' + validator+ '" "' + schemaPath+ '" "' + inpFileName + '"'
        proc = Popen(cmd, shell=True)
Loading