Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix C API Tests #4

Merged
merged 24 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a6b3a66
Use CMake to build C API test, add to Mac
Myoldmopar Mar 27, 2020
a0bc6e2
Try using full path to built binary, enable mac
Myoldmopar Mar 27, 2020
c3fbd50
Dont do doc checks on Mac yet
Myoldmopar Mar 27, 2020
d0b2cf0
Fix issues with paths on Mac, add better reporting, move to v9.3.0
Myoldmopar Mar 27, 2020
8cef532
Switch back to RC2 since it is built, flake8 also
Myoldmopar Mar 27, 2020
faf3f51
First attempt at adding Windows
Myoldmopar Mar 28, 2020
0ece079
Try just forwarding exceptions, unmute linux cmake run
Myoldmopar Mar 28, 2020
dea701e
Add verbose flag, split build arguments for Linux?
Myoldmopar Mar 28, 2020
269e7b9
sanitize windows path
Myoldmopar Mar 28, 2020
7d586e8
Try delayed loading...who knows
Myoldmopar Mar 30, 2020
2d04f03
Tweaking
Myoldmopar Mar 30, 2020
35e90e7
Try windows only script for delayed DLL loading
Myoldmopar Mar 30, 2020
5a21294
Try to make sure Windows is picked up properly
Myoldmopar Mar 30, 2020
a411c16
Yeah you need iostream huh
Myoldmopar Mar 30, 2020
3b37ecb
Hack Windows fix
Myoldmopar Mar 30, 2020
ab9195c
Fix newlines
Myoldmopar Mar 30, 2020
d8ecf13
Properly escape dll path
Myoldmopar Mar 30, 2020
be68b44
Turn Verbose OFF
Myoldmopar Mar 30, 2020
8ec6e47
Fleshing out possible use cases for delayed DLL loading
Myoldmopar Mar 30, 2020
ca2f704
Cleanup API and testing
Myoldmopar Mar 30, 2020
579fdb4
Fixup config object, always download on Travis
Myoldmopar Mar 30, 2020
4b3c4c4
flake8
Myoldmopar Mar 30, 2020
5541c89
Add second Mac API try
Myoldmopar Mar 30, 2020
921de23
No need to do case B on Mac
Myoldmopar Mar 30, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions ep_testing/config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
import os
from tempfile import mkdtemp


class TestConfiguration:
THIS_VERSION = '9.3'
TAG_THIS_VERSION = 'v9.3.0-RC2'
LAST_VERSION = '9.2'
TAG_LAST_VERSION = 'v9.2.0'

# If this is turned on, it expects to find an asset named target_file_name in the download_dir
SKIP_DOWNLOAD = False
SKIPPED_DOWNLOAD_DIR = '/tmp/'

def __init__(self):
self.this_version = '9.3'
self.tag_this_version = 'v9.3.0-RC2'
self.last_version = '9.2'
self.tag_last_version = 'v9.2.0'

# If this is turned on, it expects to find an asset named target_file_name in the download_dir
self.skip_download = True
self.skipped_download_dir = '/tmp/'

# But if we are on Travis, we override it to always download a new asset
if os.environ.get('TRAVIS', None) is not None:
self.skip_download = False

if self.skip_download:
self.download_dir = self.skipped_download_dir
else:
self.download_dir = mkdtemp()
12 changes: 6 additions & 6 deletions ep_testing/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class Downloader:
Release_url = 'https://api.github.com/repos/NREL/EnergyPlus/releases'
User_url = 'https://api.github.com/user'

def __init__(self, config: TestConfiguration, download_dir: str, announce: callable = None):
self.release_tag = config.TAG_THIS_VERSION
self.download_dir = download_dir
def __init__(self, config: TestConfiguration, announce: callable = None):
self.release_tag = config.tag_this_version
self.download_dir = config.download_dir
self.announce = announce # hijacking this instance method is mildly dangerous, like 1/5 danger stars
github_token = os.environ.get('GITHUB_TOKEN', None)
if github_token is None:
Expand All @@ -29,7 +29,7 @@ def __init__(self, config: TestConfiguration, download_dir: str, announce: calla
self._my_print('Executing download operations as Github user: ' + user_response.json()['login'])
this_platform = platform.system()
extract_dir_name = 'ep_package'
self.extract_path = os.path.join(download_dir, extract_dir_name)
self.extract_path = os.path.join(config.download_dir, extract_dir_name)
if this_platform == 'Linux':
self.asset_pattern = 'Linux-x86_64.tar.gz'
target_file_name = 'ep.tar.gz'
Expand All @@ -50,8 +50,8 @@ def __init__(self, config: TestConfiguration, download_dir: str, announce: calla
releases = self._get_all_packages()
matching_release = self._find_matching_release(releases)
asset = self._find_matching_asset_for_release(matching_release)
self.download_path = os.path.join(download_dir, target_file_name)
if config.SKIP_DOWNLOAD:
self.download_path = os.path.join(config.download_dir, target_file_name)
if config.skip_download:
if not os.path.exists(self.download_path):
raise EPTestingException('Download skipped, but package not available at ' + self.download_path)
else:
Expand Down
22 changes: 15 additions & 7 deletions ep_testing/tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from platform import system

from ep_testing.config import TestConfiguration
from ep_testing.tests.api import TestPythonAPIAccess, TestCAPIAccess
from ep_testing.tests.api import TestPythonAPIAccess, TestCAPIAccess, TestCppAPIDelayedAccess
from ep_testing.tests.documentation import TestVersionInfoInDocumentation
from ep_testing.tests.energyplus import TestPlainDDRunEPlusFile
from ep_testing.tests.expand_objects import TestExpandObjectsAndRun
Expand All @@ -29,20 +29,28 @@ def run(self):
self.install_path, {'test_file': 'HVACTemplate-5ZoneFanCoil.idf'}
)
TransitionOldFile().run(
self.install_path, {'last_version': self.config.TAG_LAST_VERSION}
self.install_path, {'last_version': self.config.tag_last_version}
)
# to use the DLL at link-time, Windows requires the lib file, so just build this on Mac/Linux
if system() == 'Linux' or system() == 'Darwin': # windows needs lib or def
TestCAPIAccess().run(
self.install_path, {}
)
else:
print("Building against the DLL at link time on Linux/Mac ONLY until we get a .lib file")
# however, linking at run-time works just fine on all three platforms
TestCppAPIDelayedAccess().run(
self.install_path, {}
)
if system() == 'Linux':
TestVersionInfoInDocumentation().run(
self.install_path, {'pdf_file': 'AuxiliaryPrograms.pdf', 'version_string': self.config.THIS_VERSION}
self.install_path, {'pdf_file': 'AuxiliaryPrograms.pdf', 'version_string': self.config.this_version}
)
TestPythonAPIAccess().run(
self.install_path, {}
)
TestCAPIAccess().run(
self.install_path, {}
)
else:
print("Skipping API and Doc stuff on Linux FOR NOW!!!!")
print("Running Python API and Doc stuff on Linux ONLY FOR NOW!!!!")
except Exception:
raise
finally:
Expand Down
Loading