simple test failing :(
parent
30c4715f14
commit
e2ff8d395c
@ -0,0 +1,44 @@
|
|||||||
|
[General]
|
||||||
|
simDir=tests/integration/tmp_output
|
||||||
|
startJob=0
|
||||||
|
[Iterables]
|
||||||
|
p=[10,39,15]
|
||||||
|
seeds=[5462,2]
|
||||||
|
lc=[4]
|
||||||
|
connectivity=[1,2,3]
|
||||||
|
variances=[1]
|
||||||
|
|
||||||
|
[Generation]
|
||||||
|
Nx = 16
|
||||||
|
Ny = 16
|
||||||
|
Nz = 16
|
||||||
|
variogram_type=1
|
||||||
|
binary = yes
|
||||||
|
kh = 100
|
||||||
|
kl = 0.01
|
||||||
|
compute_lc = yes
|
||||||
|
lcBin=yes
|
||||||
|
genera=yes
|
||||||
|
|
||||||
|
|
||||||
|
[Connectivity]
|
||||||
|
keep_aspect= yes
|
||||||
|
block_size = 4
|
||||||
|
indicators_MinBlockSize =4
|
||||||
|
Max_sample_size = 12
|
||||||
|
compGconec= 1
|
||||||
|
conec=yes
|
||||||
|
|
||||||
|
|
||||||
|
[Solver]
|
||||||
|
num_of_cores = 1
|
||||||
|
ref = 2
|
||||||
|
solve = yes
|
||||||
|
rtol = 1e-4
|
||||||
|
|
||||||
|
[K-Postprocess]
|
||||||
|
MinBlockSize =1
|
||||||
|
Max_sample_size = 4
|
||||||
|
kperm=yes
|
||||||
|
postprocess=yes
|
||||||
|
SaveVfield=yes
|
@ -0,0 +1,78 @@
|
|||||||
|
import filecmp
|
||||||
|
import os.path
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
def are_dir_trees_equal(dir1, dir2):
|
||||||
|
"""
|
||||||
|
Compare two directories recursively. Files in each directory are
|
||||||
|
assumed to be equal if their names and contents are equal.
|
||||||
|
|
||||||
|
@param dir1: First directory path
|
||||||
|
@param dir2: Second directory path
|
||||||
|
|
||||||
|
@return: True if the directory trees are the same and
|
||||||
|
there were no errors while accessing the directories or files,
|
||||||
|
False otherwise.
|
||||||
|
"""
|
||||||
|
|
||||||
|
dirs_cmp = filecmp.dircmp(dir1, dir2)
|
||||||
|
if len(dirs_cmp.left_only)>0 or len(dirs_cmp.right_only)>0 or \
|
||||||
|
len(dirs_cmp.funny_files)>0:
|
||||||
|
print("error aca :(")
|
||||||
|
return False
|
||||||
|
(_, mismatch, errors) = filecmp.cmpfiles(
|
||||||
|
dir1, dir2, dirs_cmp.common_files, shallow=False)
|
||||||
|
if (len(mismatch)>0 or len(errors)>0) and dirs_cmp.common_files[0] != 'config.ini':
|
||||||
|
print(dir1)
|
||||||
|
print(dir2)
|
||||||
|
#print(dirs_cmp.common_files)
|
||||||
|
print(mismatch)
|
||||||
|
print(errors)
|
||||||
|
print("error aca 2 :(")
|
||||||
|
|
||||||
|
return False
|
||||||
|
print(dirs_cmp.common_dirs)
|
||||||
|
for common_dir in dirs_cmp.common_dirs:
|
||||||
|
print(common_dir)
|
||||||
|
new_dir1 = os.path.join(dir1, common_dir)
|
||||||
|
new_dir2 = os.path.join(dir2, common_dir)
|
||||||
|
are_equal = are_dir_trees_equal(new_dir1, new_dir2)
|
||||||
|
if not are_equal:
|
||||||
|
print("error aca 3 :(")
|
||||||
|
return False
|
||||||
|
print("todo ok!")
|
||||||
|
print(dir1, dir2)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def equal_binaries(path_original, path):
|
||||||
|
binary_original = np.load(path_original)
|
||||||
|
|
||||||
|
binary = np.load(path)
|
||||||
|
|
||||||
|
diffs = binary_original - binary
|
||||||
|
|
||||||
|
comparisons = np.array([abs(x) < 0.001 for x in diffs]) #NO ME DA TAMPOCO CON ESTE ERROR
|
||||||
|
|
||||||
|
if comparisons.all():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def test():
|
||||||
|
os.chdir('../..') #LO COMENTE PARA EVITAR VOLVER A CORRERLO
|
||||||
|
#config_file = os.path.abspath("./tests/integration/conf_test.ini")
|
||||||
|
#os.system("CONFIG_FILE_PATH="+ config_file + " mpirun python mpirunner.py")
|
||||||
|
|
||||||
|
#are_equal = are_dir_trees_equal("./tests/integration/tmp_output","./test_loop")
|
||||||
|
|
||||||
|
for i in range(90): # HABRIA QUE HACER ESTO PERO PARA TODOS
|
||||||
|
path = './tests/integration/tmp_output/{}/D.npy'.format(i)
|
||||||
|
path_original = './test_loop/{}/D.npy'.format(i)
|
||||||
|
|
||||||
|
if not equal_binaries(path_original, path):
|
||||||
|
print("Failure :( on {}".format(i))
|
||||||
|
return
|
||||||
|
|
||||||
|
print("Success!")
|
||||||
|
|
||||||
|
test()
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue