Skip to content

Commit

Permalink
Merge pull request #761 from pivotal-energy-solutions/resnet-test-con…
Browse files Browse the repository at this point in the history
…ditional-compare

Add conditional checks and suppress specific log warnings
  • Loading branch information
shorowit authored Jan 8, 2025
2 parents 2f59720 + d2ba348 commit 6666021
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
require 'minitest/autorun'
require 'minitest/reporters'
require 'minitest/reporters/spec_reporter' # Needed when run via OS CLI
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new # spec-like progress
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new unless ENV['RM_INFO'] # spec-like progress
24 changes: 16 additions & 8 deletions workflow/tests/resnet_hers_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ def test_resnet_ashrae_140

htg_loads, clg_loads = _write_ashrae_140_results(all_results, test_results_csv)

# Check results
_check_ashrae_140_results(htg_loads, clg_loads)
# Check results if we have them all
if all_results.size > 1
_check_ashrae_140_results(htg_loads, clg_loads)
end
end

def test_resnet_hers_reference_home_auto_generation
Expand Down Expand Up @@ -98,8 +100,10 @@ def test_resnet_hvac

hvac_energy = _write_hers_hvac_results(all_results, test_results_csv)

# Check results
_check_hvac_test_results(hvac_energy)
# Check result if we have them all
if all_results.size > 1
_check_hvac_test_results(hvac_energy)
end
end

def test_resnet_dse
Expand All @@ -125,8 +129,10 @@ def test_resnet_dse

dse_energy = _write_hers_dse_results(all_results, test_results_csv)

# Check results
_check_dse_test_results(dse_energy)
# Check results if we have them all
if all_results.size > 1
_check_dse_test_results(dse_energy)
end
end

def test_resnet_hot_water
Expand All @@ -148,7 +154,9 @@ def test_resnet_hot_water

dhw_energy = _write_hers_hot_water_results(all_results, test_results_csv)

# Check results
_check_hot_water(dhw_energy)
# Check results if we have them all
if all_results.size > 1
_check_hot_water(dhw_energy)
end
end
end
21 changes: 13 additions & 8 deletions workflow/tests/resnet_other_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,20 @@ def test_resnet_hers_iad_home_auto_generation
end
assert(all_results.size > 0)

# Write results to csv
# Write results to CSV
CSV.open(test_results_csv, 'w') do |csv|
csv << ['Component', 'Test 1 Results', 'Test 2 Results', 'Test 3 Results', 'Test 4 Results']
all_results['01-L100.xml'].keys.each do |component|
csv << [component,
all_results['01-L100.xml'][component],
all_results['02-L100.xml'][component],
all_results['03-L304.xml'][component],
all_results['04-L324.xml'][component]]
# Write the header row with filenames
header = ['Component'] + all_results.keys
csv << header

# Dynamically get the first file's components
first_file = all_results.keys.first

# Iterate over the components in the first file
all_results[first_file].keys.each do |component|
# Gather results from all files for the current component
row = [component] + all_results.keys.map { |file| all_results[file][component] }
csv << row
end
end
puts "Wrote results to #{test_results_csv}."
Expand Down
22 changes: 14 additions & 8 deletions workflow/tests/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def _run_workflow(xml, test_name, timeseries_frequency: 'none', component_loads:
run_log.each do |log_line|
next unless log_line.include? 'OS Message:'
next if log_line.include?('OS Message: Minutes field (60) on line 9 of EPW file')
next if log_line.include?('OS Message: Error removing temporary directory at')

flunk "Unexpected warning found in #{log_path} run.log: #{log_line}"
end
Expand Down Expand Up @@ -309,15 +310,20 @@ def _test_resnet_hers_reference_home_auto_generation(test_name, dir_name, versio
end
assert(all_results.size > 0)

# Write results to csv
# Write results to CSV
CSV.open(test_results_csv, 'w') do |csv|
csv << ['Component', 'Test 1 Results', 'Test 2 Results', 'Test 3 Results', 'Test 4 Results']
all_results['01-L100.xml'].keys.each do |component|
csv << [component,
all_results['01-L100.xml'][component],
all_results['02-L100.xml'][component],
all_results['03-L304.xml'][component],
all_results['04-L324.xml'][component]]
# Write the header row with filenames
header = ['Component'] + all_results.keys
csv << header

# Dynamically get the first file's components
first_file = all_results.keys.first

# Iterate over the components in the first file
all_results[first_file].keys.each do |component|
# Gather results from all files for the current component
row = [component] + all_results.keys.map { |file| all_results[file][component] }
csv << row
end
end
puts "Wrote results to #{test_results_csv}."
Expand Down

0 comments on commit 6666021

Please sign in to comment.