Commit 87572ba0 authored by GILLES Sebastien's avatar GILLES Sebastien

#1248 Modify (with a bit of hardcoding first...) the script to run a test built with cmake.

parent 9c8f3231
......@@ -10,49 +10,6 @@ import CompareDirectories
def ReadConfigurationFile(myfile):
"""Read the configuration file, and load the few values that are relevant to tag the case considered in test.
This is a temporary function: this should be reunited with the similar function used in SCons build.
"""
field_list = {'COMPILER':None, 'COMPILER_DIRECTORY':None, 'MODE':None, 'LIBRARY_TYPE':None, 'BUILD_DIR':None, 'OPEN_MPI_INCL_DIR':None}
with open(myfile, 'r') as f:
for line in f:
comment_sign = line.find('#')
if comment_sign >= 0:
line = line[:comment_sign]
line = line.strip(" \'\n")
if not line:
continue
splitted = line.split('=')
assert(len(splitted) == 2) # Relevant lines should contain one and only one equal sign.
value_read = splitted[1]
value_read = value_read.strip(" \'")
if not value_read:
continue
key_read = splitted[0].strip()
for key,value in six.iteritems(field_list):
if key_read == key:
if value is not None:
raise Exception("Value for {0} in file {1} should be assigned only once!".format(key, myfile))
field_list[key] = value_read
return field_list
def ExtractOutputDirectoryFromLuaFile(lua_file, log):
"""Read the Lua file and find the output directory in it.
......@@ -132,6 +89,7 @@ class CheckMoReFEM:
self.__do_create_reference = do_create_reference
self.__stdout_file = stdout_file
self.__stderr_file = stderr_file
self.__build_directory = os.path.join(self.__morefem_path, "build_clang", "Sources")
self.__work_dir = os.path.join("/Volumes", \
"Data",
os.environ["USER"],
......@@ -176,17 +134,15 @@ class CheckMoReFEM:
def InitLogFile(self):
field_list = ReadConfigurationFile(self.__build_configuration_file)
self.__field_list = field_list
self.__field_list = {}
self.__field_list['COMPILER_DIRECTORY'] = 'clang'
self.__field_list['MODE'] = 'Debug'
self.__field_list['OPEN_MPI_INCL_DIR'] = "/Users/Shared/LibraryVersions/clang/Openmpi/include"
self.__build_directory = os.path.join(field_list['BUILD_DIR'], \
field_list['COMPILER_DIRECTORY'], \
field_list['MODE'], \
field_list['LIBRARY_TYPE'])
self.__mpidir = os.path.normpath(os.path.join(field_list['OPEN_MPI_INCL_DIR'], '..'))
self.__mpidir = os.path.normpath(os.path.join(self.__field_list['OPEN_MPI_INCL_DIR'], '..'))
if os.path.exists(self.__log_file):
......@@ -213,7 +169,7 @@ class CheckMoReFEM:
self.__log.write("=============================================\n")
self.__log.write("Compiling and running model {model}\n".format(model = model_name))
self.__log.write("=============================================\n")
#print("MODEL = {}".format(model_name))
if self.__Compile(model_name, do_call_ensight_output):
for lua_file in lua_file_list:
if ExtractOutputDirectoryFromLuaFile(lua_file, self.__log):
......@@ -253,13 +209,12 @@ class CheckMoReFEM:
def __Compile(self, model_name, do_call_ensight_output):
os.chdir(os.path.join(self.__morefem_path, "Sources"))
os.chdir(os.path.join(self.__morefem_path, "build_clang"))
cmd = (self.__scons_path,
cmd = ("ninja",
"-j",
str(multiprocessing.cpu_count()),
model_name,
"--config_file={0}".format(self.__build_configuration_file))
model_name)
self.__PrintCmd(cmd)
......@@ -273,7 +228,7 @@ class CheckMoReFEM:
self.__log.write("\tSuccessful compilation.\n")
if do_call_ensight_output:
ret = self.__Compile("ensight4{}".format(model_name), do_call_ensight_output = False)
ret = self.__Compile("{}EnsightOutput".format(model_name), do_call_ensight_output = False)
if not ret:
return False
......@@ -306,7 +261,7 @@ class CheckMoReFEM:
def __EnsightOutput(self, model_name, lua_file):
cmd = (os.path.join(self.__build_directory, "ensight4{}".format(model_name)),
cmd = (os.path.join(self.__build_directory, "{}EnsightOutput".format(model_name)),
"--input_parameters",
lua_file)
......@@ -409,9 +364,7 @@ class CheckMoReFEM:
os.environ["USER"],
"MoReFEM",
is_reference_dir and "ReferenceModels" or "Tests",
self.__field_list['COMPILER_DIRECTORY'], \
self.__field_list['MODE'], \
self.__field_list['LIBRARY_TYPE'],
model_name,
lua_filename)
......@@ -422,10 +375,12 @@ if __name__ == "__main__":
target_list = targets.TestAndModelTargetList()
morefem_path = os.path.join("/Users", os.environ['USER'], "Codes", "MoReFEM")
morefem_path = os.path.join("/Users", os.environ['USER'], "Codes", "MoReFEM", "CoreLibrary")
cases = ('clang_debug', 'clang_release', 'gcc_debug', 'gcc_release', 'clang_debug_macro', 'llvm_clang_debug')
cases = ('clang_debug', )# 'clang_release', 'clang_debug_macro', 'llvm_clang_debug')
for case in cases:
stdout = os.path.join("/Volumes", "Data", os.environ["USER"], "MoReFEM", "TestWorkDir", "test_stdout_{case}.txt".format(case = case))
......
......@@ -127,6 +127,12 @@ def TestAndModelTargetList():
ret = list(TestTargetList())
ret.extend(ModelTargetList())
ret = (
Target('MoReFEM4RivlinCube', \
('Sources/ModelInstances/RivlinCube/demo_input_rivlin_cube_hexahedra.lua', \
'Sources/ModelInstances/RivlinCube/demo_input_rivlin_cube_tetrahedra.lua')), \
)
return ret
......
......@@ -9,7 +9,7 @@
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
......
Markdown is supported
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