Skip to content

Commit

Permalink
Merge 752c21e into d4cbf3f
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed Dec 2, 2020
2 parents d4cbf3f + 752c21e commit c2fc61b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 2 additions & 0 deletions epregressions/builds/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def autodetect_build_dir_type(build_dir: str) -> str:
return KnownBuildTypes.VisualStudio
elif 'Makefile' in generator_name:
return KnownBuildTypes.Makefile
elif 'Ninja' in generator_name:
return KnownBuildTypes.Makefile
return KnownBuildTypes.Unknown


Expand Down
22 changes: 16 additions & 6 deletions epregressions/tests/builds/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def test_detect_visual_studio(self):
self.add_cache_file('CMAKE_GENERATOR:INTERNAL=Visual Studio 2019')
self.assertEqual(KnownBuildTypes.VisualStudio, autodetect_build_dir_type(self.build_dir))

def test_detect_ninja(self):
self.add_cache_file('CMAKE_GENERATOR:INTERNAL=Ninja')
self.assertEqual(KnownBuildTypes.Makefile, autodetect_build_dir_type(self.build_dir))


class TestBaseBuildMethods(unittest.TestCase):

Expand All @@ -58,11 +62,17 @@ def test_verify_without_setting_build_dir(self):
def test_get_idfs(self):
temp_idf_dir = tempfile.mkdtemp()
self.assertSetEqual(set(), self.base_build.get_idfs_in_dir(temp_idf_dir))
open(os.path.join(temp_idf_dir, 'file1.idf'), 'w').write('hi')
open(os.path.join(temp_idf_dir, 'file2.iQQ'), 'w').write('he')
open(os.path.join(temp_idf_dir, 'file3.idf'), 'w').write('ha')
open(os.path.join(temp_idf_dir, 'file4.imf'), 'w').write('ha') # macro
open(os.path.join(temp_idf_dir, '_ExternalInterface-actuator.idf'), 'w').write('ha') # ext interface as FMU
open(os.path.join(temp_idf_dir, 'HVAC3ZoneGeometry.imf'), 'w').write('ha') # macro resource file
with open(os.path.join(temp_idf_dir, 'file1.idf'), 'w') as f:
f.write('hi')
with open(os.path.join(temp_idf_dir, 'file2.iQQ'), 'w') as f:
f.write('he')
with open(os.path.join(temp_idf_dir, 'file3.idf'), 'w') as f:
f.write('ha')
with open(os.path.join(temp_idf_dir, 'file4.imf'), 'w') as f:
f.write('ha') # macro
with open(os.path.join(temp_idf_dir, '_ExternalInterface-actuator.idf'), 'w') as f:
f.write('ha') # ext interface as FMU
with open(os.path.join(temp_idf_dir, 'HVAC3ZoneGeometry.imf'), 'w') as f:
f.write('ha') # macro resource file
# TODO: Modify the test to expect relevant IMF files as well and fix the function
self.assertEqual(3, len(self.base_build.get_idfs_in_dir(temp_idf_dir)))

0 comments on commit c2fc61b

Please sign in to comment.