mirror of https://github.com/QMCPACK/qmcpack.git
nexus: remove redundant example ctests and fix failing nexus settings ctest
This commit is contained in:
parent
01b95d5595
commit
2045395c92
|
@ -893,7 +893,6 @@ IF(NOT(QMC_BUILD_LEVEL GREATER 4))
|
||||||
SUBDIRS(examples)
|
SUBDIRS(examples)
|
||||||
IF(IS_DIRECTORY "${PROJECT_SOURCE_DIR}/nexus")
|
IF(IS_DIRECTORY "${PROJECT_SOURCE_DIR}/nexus")
|
||||||
SUBDIRS(nexus/tests)
|
SUBDIRS(nexus/tests)
|
||||||
SUBDIRS(nexus/examples)
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
|
|
||||||
# Add tests for Nexus examples
|
|
||||||
|
|
||||||
INCLUDE("${qmcpack_SOURCE_DIR}/CMake/python.cmake")
|
|
||||||
|
|
||||||
FUNCTION(ADD_EXAMPLE_TEST test_name test_dir nexus_file)
|
|
||||||
#MESSAGE("Adding Nexus test ${test_name}")
|
|
||||||
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/${test_dir}" "${CMAKE_CURRENT_BINARY_DIR}/${test_dir}")
|
|
||||||
ADD_TEST(NAME nexus_example_${test_name} COMMAND python nexus_example_test.py "${CMAKE_CURRENT_BINARY_DIR}/${test_dir}" --nexus-file "${nexus_file}" --nexus-path "${CMAKE_CURRENT_SOURCE_DIR}/../library")
|
|
||||||
SET_TESTS_PROPERTIES(nexus_example_${test_name} PROPERTIES TIMEOUT 240)
|
|
||||||
SET_TESTS_PROPERTIES(nexus_example_${test_name} PROPERTIES LABELS "nexus")
|
|
||||||
|
|
||||||
ENDFUNCTION()
|
|
||||||
|
|
||||||
SET(NEXUS_PYTHON_REQS numpy)
|
|
||||||
CHECK_PYTHON_REQS(NEXUS_PYTHON_REQS "" ADD_TEST)
|
|
||||||
|
|
||||||
if (ADD_TEST)
|
|
||||||
MESSAGE("Adding Nexus example tests")
|
|
||||||
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/nexus_example_test.py" "${CMAKE_CURRENT_BINARY_DIR}")
|
|
||||||
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/qmcpack/pseudopotentials" "${CMAKE_CURRENT_BINARY_DIR}/qmcpack/pseudopotentials")
|
|
||||||
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/quantum_espresso/pseudopotentials" "${CMAKE_CURRENT_BINARY_DIR}/quantum_espresso/pseudopotentials")
|
|
||||||
ADD_EXAMPLE_TEST(c20 qmcpack/c20 c20.py)
|
|
||||||
ADD_EXAMPLE_TEST(diamond qmcpack/diamond diamond.py)
|
|
||||||
ADD_EXAMPLE_TEST(diamond_vacancy qmcpack/diamond diamond_vacancy.py)
|
|
||||||
ADD_EXAMPLE_TEST(graphene qmcpack/graphene graphene.py)
|
|
||||||
ADD_EXAMPLE_TEST(H2O qmcpack/H2O H2O.py)
|
|
||||||
ADD_EXAMPLE_TEST(LiH qmcpack/LiH LiH.py)
|
|
||||||
ADD_EXAMPLE_TEST(oxygen_dimer qmcpack/oxygen_dimer oxygen_dimer.py)
|
|
||||||
ADD_EXAMPLE_TEST(relax_Ge_T_vs_kpoints quantum_espresso/relax_Ge_T_vs_kpoints relax_vs_kpoints_example.py)
|
|
||||||
ELSE()
|
|
||||||
MESSAGE("Skipping Nexus example tests because numpy is not present in python installation")
|
|
||||||
ENDIF()
|
|
|
@ -1,67 +0,0 @@
|
||||||
#from __future__ import print_function
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
def run_one_nexus_test(nexus_file):
|
|
||||||
okay = True
|
|
||||||
g = dict()
|
|
||||||
|
|
||||||
g['override_generate_only_setting'] = True
|
|
||||||
try:
|
|
||||||
execfile(nexus_file, g)
|
|
||||||
except Exception as e:
|
|
||||||
print('Error ',type(e),e)
|
|
||||||
okay = False
|
|
||||||
except SystemExit:
|
|
||||||
print('system exit called')
|
|
||||||
okay = False
|
|
||||||
|
|
||||||
if okay:
|
|
||||||
print(" pass")
|
|
||||||
else:
|
|
||||||
print(" FAIL")
|
|
||||||
|
|
||||||
return okay
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
parser = argparse.ArgumentParser(description='Test Nexus examples')
|
|
||||||
parser.add_argument('test_dir',
|
|
||||||
help='Directory of test to run')
|
|
||||||
parser.add_argument('--nexus-file',
|
|
||||||
help='Name of Nexus file for this example')
|
|
||||||
parser.add_argument('--nexus-path',
|
|
||||||
help='Path to Nexus library (for setting PYTHONPATH)')
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
test_dir = args.test_dir
|
|
||||||
if not os.path.exists(test_dir):
|
|
||||||
print("Test not found: ", test_dir)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
curr_dir = os.getcwd()
|
|
||||||
os.chdir(test_dir)
|
|
||||||
|
|
||||||
|
|
||||||
nexus_path = args.nexus_path
|
|
||||||
if nexus_path:
|
|
||||||
if not os.path.exists(nexus_path):
|
|
||||||
print("Nexus path not found: ", nexus_path)
|
|
||||||
sys.exit(1)
|
|
||||||
sys.path.append(nexus_path)
|
|
||||||
|
|
||||||
nexus_file = args.nexus_file
|
|
||||||
if not os.path.exists(nexus_file):
|
|
||||||
print("Nexus file not found: ", nexus_file)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
ret = run_one_nexus_test(args.nexus_file)
|
|
||||||
|
|
||||||
os.chdir(curr_dir)
|
|
||||||
|
|
||||||
if ret:
|
|
||||||
sys.exit(0)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
|
@ -1614,7 +1614,11 @@ def settings_operation():
|
||||||
#end check_settings_core_noncore
|
#end check_settings_core_noncore
|
||||||
|
|
||||||
def check_empty_settings():
|
def check_empty_settings():
|
||||||
settings()
|
settings(
|
||||||
|
command_line = False,
|
||||||
|
)
|
||||||
|
settings.command_line = True
|
||||||
|
nexus_core.command_line = True
|
||||||
check_settings_core_noncore()
|
check_settings_core_noncore()
|
||||||
# nexus core sets basic run stages and Pseudopotentials object
|
# nexus core sets basic run stages and Pseudopotentials object
|
||||||
nassert(nexus_core.stages_set==set(nexus_core_defaults.primary_modes))
|
nassert(nexus_core.stages_set==set(nexus_core_defaults.primary_modes))
|
||||||
|
@ -1660,6 +1664,7 @@ def settings_operation():
|
||||||
status_only = 0,
|
status_only = 0,
|
||||||
generate_only = 1,
|
generate_only = 1,
|
||||||
machine = 'ws16',
|
machine = 'ws16',
|
||||||
|
command_line = False,
|
||||||
)
|
)
|
||||||
check_settings_core_noncore()
|
check_settings_core_noncore()
|
||||||
nassert(nexus_core.status_only==0)
|
nassert(nexus_core.status_only==0)
|
||||||
|
|
Loading…
Reference in New Issue