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 #5315 - OpenStudio CLI unable to require uuid in OpenStudio 3.9 (thereby breaking dependencies like openstudio-extension) #5316

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Dec 12, 2024

Pull request overview

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

@jmarrec jmarrec added component - CLI Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. component - Ruby bindings labels Dec 12, 2024
@jmarrec jmarrec self-assigned this Dec 12, 2024
Comment on lines +206 to +209
# Test for 5315
add_test(NAME OpenStudioCLI.EmbeddedScripting.uuid
COMMAND $<TARGET_FILE:openstudio> ${CMAKE_CURRENT_SOURCE_DIR}/test/ensure_uuid_can_be_loaded.rb
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before fix on on Windows:

    Start 3757: OpenStudioCLI.EmbeddedScripting.uuid

3757: Test command: C:\src\OpenStudio\build-release\Products\openstudio.exe "C:/src/OpenStudio/src/cli/test/ensure_uuid_can_be_loaded.rb"
3757: Working Directory: C:/src/OpenStudio/build-release/src/cli
3757: Test timeout computed to be: 1500
3757:
3757: NoMethodError: undefined method `flock' for #<StringIO:0x0000021f46ae7380>
3757: Backtrace:
3757:   :/ruby/3.2.0/rubygems.rb:788:in `block in open_file'
3757:   eval:464:in `open'
3757:   :/ruby/3.2.0/rubygems.rb:785:in `open_file'
3757:   :/ruby/3.2.0/rubygems/specification.rb:1158:in `load'
3757:   :/ruby/3.2.0/gems/uuid-2.3.9/lib/uuid.rb:66:in `<module:Version>'
3757:   :/ruby/3.2.0/gems/uuid-2.3.9/lib/uuid.rb:65:in `<class:UUID>'
3757:   :/ruby/3.2.0/gems/uuid-2.3.9/lib/uuid.rb:62:in `<main>'
3757:   eval:236:in `eval'
3757:   eval:236:in `require_embedded_absolute'
3757:   eval:221:in `block in require_embedded'
3757:   eval:215:in `each'
3757:   eval:215:in `require_embedded'
3757:   eval:190:in `rescue in require'
3757:   eval:184:in `require'
3757:   <internal::/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
3757:   C:/src/OpenStudio/src/cli/test/ensure_uuid_can_be_loaded.rb:1:in `<top (required)>'
3757:   eval:182:in `require'
3757:   eval:182:in `require'
3757:   <internal::/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
3757:   eval:4:in `<main>'
3757: Failed to execute 'C:/src/OpenStudio/src/cli/test/ensure_uuid_can_be_loaded.rb'
1/1 Test #3757: OpenStudioCLI.EmbeddedScripting.uuid ...***Failed    2.67 sec

Comment on lines 61 to 70
# We patch Kernel.open, and IO.open
# to read embedded files as a StringIO, not as a FileIO
# But Gem.open_file for eg expects it to be a File, not a StringIO, and on
# Windows it will call File::flock (file lock) to protect access, but StringIO
# does not have this method
class FakeFileAsStringIO < StringIO
def flock
return 0
end
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Kernel.open and IO.open, when we returned a StringIO, we now return this FakeFileAsStringIO which will have the flock method...

@jmarrec
Copy link
Collaborator Author

jmarrec commented Dec 12, 2024

@wenyikuang concerned that the Windows hapilly reports green, when in reality tests have failed here.

@wenyikuang
Copy link
Collaborator

wenyikuang commented Dec 12, 2024

Hi Julien, @jmarrec You mean these ones:

The following tests FAILED:

	685 - BCLFixture.BCLMeasure_CTor_throw_invalid_xml (Failed)

	3801 - OpenStudioCLI.Run_AlfalfaWorkflow (Failed)

	3945 - CLITest-test_bundle-bundle (Failed)

	3946 - CLITest-test_bundle-bundle_git (Failed)

	3948 - CLITest-test_bundle-bundle_native_embedded (Failed)

	3950 - CLITest-test_bundle-no_bundle (Failed)

	3951 - CLITest-test_bundle-bundle_default (Failed)

	3987 - CLITest-test_encodings-encoding_external (Failed)

Right?

@jmarrec
Copy link
Collaborator Author

jmarrec commented Dec 12, 2024

Way more than these on this commit:
https://ci.openstudio.net/blue/organizations/jenkins/openstudio-incremental-windows/detail/PR-5316/2/

The test I just added failed. All of workflow based ones have been failing silently since before 3.9.0 (I fixed the add_dll_directory on this PR after realizing).

The following tests FAILED:

	685 - BCLFixture.BCLMeasure_CTor_throw_invalid_xml (Failed)

	3772 - OpenStudioTest.LoggerGlobal (Failed)

	3778 - OpenStudioCLI.python_version (Failed)

	3784 - OpenStudioCLI.python_execute_line (Exit code 0xc0000409

)

	3789 - OpenStudioCLI.execute_python_script (Failed)

	3790 - OpenStudioCLI.execute_python_script.forward_flags (Failed)

	3791 - OpenStudioCLI.execute_python_script.forward_flags.omit_execute (Failed)

	3792 - OpenStudioCLI.EmbeddedScripting.uuid (Failed)

	3797 - OpenStudioCLI.Run_PythonOnly (Failed)

	3798 - OpenStudioCLI.Run_PythonOnly_TwoMeasure (Failed)

	3799 - OpenStudioCLI.Run_RubyPython (Failed)

	3800 - OpenStudioCLI.Run_PythonRuby (Failed)

	3801 - OpenStudioCLI.Run_AlfalfaWorkflow (Failed)

	3802 - OpenStudioCLI.Run_RubyPythonPlugin (Failed)

	3811 - OpenStudioCLI.test_logger_py (Failed)

	3817 - OpenStudioCLI.execute_python_script.forward_flags.forward_help (Failed)

	3823 - OpenStudioCLI.execute_python_script.forward_flags.path_forwardslash (Failed)

	3824 - OpenStudioCLI.execute_python_script.forward_flags.path_backwardslash (Failed)

	3825 - OpenStudioCLI.execute_python_script.numpy.explicit_sys_path_insert (Failed)

	3826 - OpenStudioCLI.execute_python_script.numpy.python_path (Failed)

	3827 - OpenStudioCLI.execute_python_script.numpy.python_home (Failed)

	3945 - CLITest-test_bundle-bundle (Failed)

	3946 - CLITest-test_bundle-bundle_git (Failed)

	3948 - CLITest-test_bundle-bundle_native_embedded (Failed)

	3950 - CLITest-test_bundle-no_bundle (Failed)

	3951 - CLITest-test_bundle-bundle_default (Failed)

	3987 - CLITest-test_encodings-encoding_external (Failed)

	3988 - PythonEngineFixture.BadMeasure (Failed)

	3989 - PythonEngineFixture.WrongMethodMeasure (Failed)

	3990 - PythonEngineFixture.StackLevelTooDeepMeasure (Failed)

	3991 - PythonEngineFixture.AlfalfaMeasure (Failed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - CLI component - Ruby bindings Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.
Projects
None yet
3 participants