Skip to content

Commit

Permalink
Merge 9c42a95 into 6ded15d
Browse files Browse the repository at this point in the history
  • Loading branch information
Myoldmopar committed Jul 8, 2019
2 parents 6ded15d + 9c42a95 commit d7b608e
Show file tree
Hide file tree
Showing 27 changed files with 1,284 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ These can be rolled upstream into the CI code, but must be done with much more c

This tool is written to be functional on all three major platforms, but Windows and Mac have known issues.
On Windows the multiprocessing code does not work, causing the runs to be executed serially, which means a long testing time.
On Mac the results tab is currently not showing the results files, making it fairly useless, at least until I write the results to file, in which case they _could_ be processed externally.
On Mac there are a number of theme icons missing, causing the results tab to appear to be empty after a run, when in fact the icons are there just not rendered.

In general, this tool works amazingly well on Ubuntu 18.04.
And it is super easy to set up an EnergyPlus build development environment on Ubuntu.
Expand Down
40 changes: 40 additions & 0 deletions epregressions/diffs/ci_compare_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,42 @@ def main_function(file_name, base_dir, mod_dir, base_sha, mod_sha, make_public,
has_small_diffs = True
print_message("ERR diffs.")

if entry.readvars_audit_diffs and (entry.readvars_audit_diffs.diff_type != TextDifferences.EQUAL):
has_small_diffs = True
print_message("ReadvarsAudit diffs.")

if entry.edd_diffs and (entry.edd_diffs.diff_type != TextDifferences.EQUAL):
has_small_diffs = True
print_message("EDD diffs.")

if entry.wrl_diffs and (entry.wrl_diffs.diff_type != TextDifferences.EQUAL):
has_small_diffs = True
print_message("WRL diffs.")

if entry.sln_diffs and (entry.sln_diffs.diff_type != TextDifferences.EQUAL):
has_small_diffs = True
print_message("SLN diffs.")

if entry.sci_diffs and (entry.sci_diffs.diff_type != TextDifferences.EQUAL):
has_small_diffs = True
print_message("SCI diffs.")

if entry.map_diffs and (entry.map_diffs.diff_type != TextDifferences.EQUAL):
has_small_diffs = True
print_message("MAP diffs.")

if entry.dfs_diffs and (entry.dfs_diffs.diff_type != TextDifferences.EQUAL):
has_small_diffs = True
print_message("DFS diffs.")

if entry.screen_diffs and (entry.screen_diffs.diff_type != TextDifferences.EQUAL):
has_small_diffs = True
print_message("SCREEN diffs.")

if entry.glhe_diffs and (entry.glhe_diffs.diff_type != TextDifferences.EQUAL):
has_small_diffs = True
print_message("GLHE diffs")

# numeric diff
if entry.eso_diffs:
has_diffs, has_small_diffs = process_diffs("ESO", entry.eso_diffs, has_diffs, has_small_diffs)
Expand Down Expand Up @@ -143,6 +179,10 @@ def main_function(file_name, base_dir, mod_dir, base_sha, mod_sha, make_public,
if entry.zsz_diffs:
has_diffs, has_small_diffs = process_diffs("ZSZ", entry.zsz_diffs, has_diffs, has_small_diffs)

# numeric diff
if entry.json_diffs:
has_diffs, has_small_diffs = process_diffs("JSON", entry.json_diffs, has_diffs, has_small_diffs)

if entry.table_diffs:
if entry.table_diffs.big_diff_count > 0:
has_diffs = True
Expand Down
2 changes: 1 addition & 1 deletion epregressions/diffs/mycsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def ismatrice(mat):
if type(cell) not in (float, int):
if sys.version_info[0] == 2:
# I would like to just redefine basestring to str on Python 2 but I don't have time right now
if not isinstance(cell, basestring): # noqa: F821
if not isinstance(cell, basestring): # noqa: F821 # pragma: no cover
return False
else: # python 3
if not isinstance(cell, str):
Expand Down
2 changes: 1 addition & 1 deletion epregressions/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ def idf_selection_list(self, widget): # pragma: no cover - moved core into idf_
Gtk.ButtonsType.OK_CANCEL, None
)
dialog.set_title("Enter list of files to select")
dialog.set_markup('Enter file names to select, one per line\nFile extensions are optional')
dialog.set_markup('Enter file names to select, one per line with extension')
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.set_size_request(400, 400)
scrolled_window.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
Expand Down
254 changes: 252 additions & 2 deletions epregressions/runtests.py

Large diffs are not rendered by default.

72 changes: 71 additions & 1 deletion epregressions/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ class TextDifferences:
SHD = 9
DL_IN = 10
DL_OUT = 11
READ_VARS_AUDIT = 12
EDD = 13
WRL = 14
SLN = 15
SCI = 16
MAP = 17
DFS = 18
SCREEN = 19
GLHE = 20
# diff types
EQUAL = 1
DIFFS = 2
Expand Down Expand Up @@ -65,6 +74,7 @@ class MathDifferences:
MTR = 2
ZSZ = 3
SSZ = 4
JSON = 5

def __init__(self, args_from_math_diff):
self.diff_type = args_from_math_diff[0]
Expand Down Expand Up @@ -165,6 +175,16 @@ def __init__(self, name, epw):
self.shd_diffs = None
self.dl_in_diffs = None
self.dl_out_diffs = None
self.readvars_audit_diffs = None
self.edd_diffs = None
self.wrl_diffs = None
self.sln_diffs = None
self.sci_diffs = None
self.map_diffs = None
self.dfs_diffs = None
self.screen_diffs = None
self.glhe_diffs = None
self.json_diffs = None

def add_summary_result(self, end_err_summary):
self.summary_result = end_err_summary
Expand All @@ -178,6 +198,8 @@ def add_math_differences(self, diffs, diff_type):
self.zsz_diffs = diffs
elif diff_type == MathDifferences.SSZ:
self.ssz_diffs = diffs
elif diff_type == MathDifferences.JSON:
self.json_diffs = diffs

def add_text_differences(self, diffs, diff_type):
if diff_type == TextDifferences.AUD:
Expand All @@ -202,6 +224,24 @@ def add_text_differences(self, diffs, diff_type):
self.dl_in_diffs = diffs
elif diff_type == TextDifferences.DL_OUT:
self.dl_out_diffs = diffs
elif diff_type == TextDifferences.READ_VARS_AUDIT:
self.readvars_audit_diffs = diffs
elif diff_type == TextDifferences.EDD:
self.edd_diffs = diffs
elif diff_type == TextDifferences.WRL:
self.wrl_diffs = diffs
elif diff_type == TextDifferences.SLN:
self.sln_diffs = diffs
elif diff_type == TextDifferences.SCI:
self.sci_diffs = diffs
elif diff_type == TextDifferences.MAP:
self.map_diffs = diffs
elif diff_type == TextDifferences.DFS:
self.dfs_diffs = diffs
elif diff_type == TextDifferences.SCREEN:
self.screen_diffs = diffs
elif diff_type == TextDifferences.GLHE:
self.glhe_diffs = diffs

def add_table_differences(self, diffs):
self.table_diffs = diffs
Expand Down Expand Up @@ -246,6 +286,26 @@ def to_dict(self):
response['dl_in_diffs'] = self.dl_in_diffs.to_dict()
if self.dl_out_diffs:
response['dl_out_diffs'] = self.dl_out_diffs.to_dict()
if self.readvars_audit_diffs:
response['readvars_audit_diffs'] = self.readvars_audit_diffs.to_dict()
if self.edd_diffs:
response['edd_diffs'] = self.edd_diffs.to_dict()
if self.wrl_diffs:
response['wrl_diffs'] = self.wrl_diffs.to_dict()
if self.sln_diffs:
response['sln_diffs'] = self.sln_diffs.to_dict()
if self.sci_diffs:
response['sci_diffs'] = self.sci_diffs.to_dict()
if self.map_diffs:
response['map_diffs'] = self.map_diffs.to_dict()
if self.dfs_diffs:
response['dfs_diffs'] = self.dfs_diffs.to_dict()
if self.screen_diffs:
response['screen_diffs'] = self.screen_diffs.to_dict()
if self.glhe_diffs:
response['glhe_diffs'] = self.glhe_diffs.to_dict()
if self.json_diffs:
response['json_diffs'] = self.json_diffs.to_dict()
return response


Expand Down Expand Up @@ -296,7 +356,8 @@ def add_test_entry(self, this_entry):
this_entry.eso_diffs: "eso",
this_entry.mtr_diffs: "mtr",
this_entry.zsz_diffs: "zsz",
this_entry.ssz_diffs: "ssz"
this_entry.ssz_diffs: "ssz",
this_entry.json_diffs: "json"
}
for diff in math_diff_hash:
file_type = math_diff_hash[diff]
Expand Down Expand Up @@ -334,6 +395,15 @@ def add_test_entry(self, this_entry):
this_entry.err_diffs: "err",
this_entry.dl_in_diffs: "delightin",
this_entry.dl_out_diffs: "delightout",
this_entry.readvars_audit_diffs: "readvars_audit",
this_entry.edd_diffs: "edd",
this_entry.wrl_diffs: "wrl",
this_entry.sln_diffs: "sln",
this_entry.sci_diffs: "sci",
this_entry.map_diffs: "map",
this_entry.dfs_diffs: "dfs",
this_entry.screen_diffs: "screen",
this_entry.glhe_diffs: "glhe",
}
for diff in text_diff_hash:
file_type = text_diff_hash[diff]
Expand Down
20 changes: 20 additions & 0 deletions epregressions/tests/diffs/test_ci_compare_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ def test_main_function(self):
self._write_files_to_both_folders('eplusout.err', 'base err output', 'mod err output')
self._write_files_to_both_folders('eplusout.delightin', 'base delightin output', 'mod delightin output')
self._write_files_to_both_folders('eplusout.delightout', 'base delightout output', 'mod delightout output')
self._write_files_to_both_folders('readvars.audit', 'base readvars audit output', 'mod readvars audit output')
self._write_files_to_both_folders('eplusout.edd', 'base edd output', 'mod edd output')
self._write_files_to_both_folders('eplusout.wrl', 'base wrl output', 'mod wrl output')
self._write_files_to_both_folders('eplusout.sln', 'base sln output', 'mod sln output')
self._write_files_to_both_folders('eplusout.sci', 'base sci output', 'mod sci output')
self._write_files_to_both_folders('eplusmap.csv', 'base map output', 'mod map output')
self._write_files_to_both_folders('eplusout.dfs', 'base dfs output', 'mod dfs output')
self._write_files_to_both_folders('eplusscreen.csv', 'base screen output', 'mod screen output')
self._write_files_to_both_folders('eplusout.glhe', '{"glhe_1":{}}', '{"glhe 2":{}}')
self._write_files_to_both_folders('eplusout_hourly.json', '{"hi":{}}', '{"bye":{}}')
with captured_output() as (out, err):
# should fail if we don't have any .end files
main_function(
Expand Down Expand Up @@ -233,6 +243,16 @@ def test_main_function(self):
'SSZ big diffs',
'ZSZ big diffs',
'Table big diffs',
'ReadvarsAudit diffs',
'EDD diffs',
'WRL diffs',
'SLN diffs',
'SCI diffs',
'MAP diffs',
'DFS diffs',
'SCREEN diffs',
'GLHE diffs',
'JSON big diffs',
'[decent_ci:test_result:warn]'
]
output = out.getvalue().strip()
Expand Down
81 changes: 81 additions & 0 deletions epregressions/tests/resources/dummy.energyplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,87 @@
</html>
""")

# write some dummy text output files
dummy_text_files = [
'readvars.audit',
'eplusout.edd',
'eplusout.wrl',
'eplusout.sln',
'eplusout.sci',
'eplusmap.csv',
'eplusout.dfs',
'eplusscreen.csv'
]
for fn in dummy_text_files:
with open(fn, 'w') as f:
f.write('hello from ' + fn)

# and the glhe json file too
object_to_write = {
"GHLE 1": {
"Phys Data": {
"BH Data": {
"BH 1": {
"X-Location": 0.0,
"Y-Location": 0.0
}
},
"BH Diameter": 0.114,
"BH Length": 100.0,
"BH Top Depth": 1.0,
"Flow Rate": 0.00100944,
"Grout k": 0.7443,
"Grout rhoCp": 3900000.0,
"Max Simulation Years": 1.0,
"Pipe Diameter": 0.03341,
"Pipe Thickness": 0.002984,
"Pipe k": 0.3895,
"Pipe rhoCP": 1770000.0,
"Soil k": 2.5,
"Soil rhoCp": 2500000.0,
"U-tube Dist": 0.04913
},
"Response Factors": {
"GFNC": [
6.495588983283869
],
"LNTTS": [
-3.5
],
"time": [
33552648.247020558
]
}
}
}
with open('eplusout.glhe', 'w') as f_glhe:
f_glhe.write(json.dumps(object_to_write))

# and the json time series output, for now just hourly
object_to_write = {
"Cols": [
{
"Units": "",
"Variable": "SMSTORE8 ZONE EVAP UNIT:Zone Evaporative Cooler Unit Fan Speed Ratio"
},
{
"Units": "J",
"Variable": "SMSTORE8 ZONE EVAP UNIT:Zone Evaporative Cooler Unit Latent Cooling Energy"
}
],
"ReportFrequency": "Hourly",
"Rows": [
{
"12/21 01:00:00": [
0.0,
0.0
]
}
]
}
with open('eplusout_hourly.json', 'w') as f_json:
f_json.write(json.dumps(object_to_write))

# DO THIS LAST - it has sys.exit() calls - eplusout.end
num_warnings = config['num_warnings'] if 'num_warnings' in config else 0
num_severe = config['num_severe'] if 'num_severe' in config else 0
Expand Down
55 changes: 55 additions & 0 deletions epregressions/tests/resources/eplusout_base.glhe
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"GHLE 1": {
"Phys Data": {
"BH Data": {
"BH 1": {
"X-Location": 0.0,
"Y-Location": 0.0
},
"BH 2": {
"X-Location": 0.0,
"Y-Location": 5.0
},
"BH 3": {
"X-Location": 5.0,
"Y-Location": 0.0
},
"BH 4": {
"X-Location": 5.0,
"Y-Location": 5.0
}
},
"BH Diameter": 0.114,
"BH Length": 100.0,
"BH Top Depth": 1.0,
"Flow Rate": 0.00100944,
"Grout k": 0.7443,
"Grout rhoCp": 3900000.0,
"Max Simulation Years": 1.0,
"Pipe Diameter": 0.03341,
"Pipe Thickness": 0.002984,
"Pipe k": 0.3895,
"Pipe rhoCP": 1770000.0,
"Soil k": 2.5,
"Soil rhoCp": 2500000.0,
"U-tube Dist": 0.04913
},
"Response Factors": {
"GFNC": [
-3.825046277704238,
5.760381200418051,
6.495588983283869
],
"LNTTS": [
-14.614018254182046,
-13.9208710736221,
-3.5
],
"time": [
500.0,
20350709.87637131,
33552648.247020558
]
}
}
}
Loading

0 comments on commit d7b608e

Please sign in to comment.