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 #5178 - Init the RUBY_DESCRIPTION properly #5179

Merged
merged 4 commits into from
May 2, 2024

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented May 2, 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 May 2, 2024
@jmarrec jmarrec self-assigned this May 2, 2024
@jmarrec jmarrec requested a review from kbenne May 2, 2024 10:36
Comment on lines +17 to +19
struct ruby_cmdline_options;
typedef struct ruby_cmdline_options ruby_cmdline_options_t;
void Init_ruby_description(ruby_cmdline_options_t*);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Forward declare.

In 2.7.2, it was simpler, just void Init_ruby_description(void)

@@ -22,6 +25,8 @@ void RubyEngine::initRubyEngine() {
RUBY_INIT_STACK;
ruby_init();

Init_ruby_description(nullptr);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Use it.

We don't just MJIT or YJIT, so it just doesn't use the param ruby_cmdline_options_t *opt anyways.

See https://github.com/ruby/ruby/blob/e51014f9c05aa65cbf203442d37fef7c12390015/version.c#L129-L162

Comment on lines +8 to +13
class ConstantsTest < Minitest::Test

# Note: putting all of these tests under the same one because of the way we
# run the tests with the CLI (we run a CLI instance for each individual test,
# and it takes almost 20 seconds for each which is ridiculous)
def test_ruby_constants
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

new test. Grouping everything under a single minitest because it is WWAAAAAY to slow otherwise with the CLI.

Comment on lines +17 to +18
refute_empty(RUBY_DESCRIPTION)
assert_match(/ruby 3.2.2 \(.*\) \[.*\]/, RUBY_DESCRIPTION)
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

Run options: --seed 12379

# Running:

E

Finished in 0.001386s, 721.3269 runs/s, 721.3269 assertions/s.

  1) Error:
ConstantsTest#test_ruby_constants:
NameError: uninitialized constant ConstantsTest::RUBY_DESCRIPTION
    eval:414:in `const_missing'
    /home/julien/Software/Others/OpenStudio/ruby/test/Constants_Test.rb:17:in `test_ruby_constants'

1 runs, 1 assertions, 0 failures, 1 errors, 0 skips

Comment on lines +644 to +647
boost::optional<int> month_ = getInt(OS_SizingPeriod_DesignDayFields::Month);
if (month_ && (*month_ == 2)) {
boost::optional<int> day_ = this->getInt(OS_SizingPeriod_DesignDayFields::DayofMonth);
if (day_ && (*day_ == 29)) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unrelated, but fix cppcheck workflow that has been failing for some time

@jmarrec jmarrec merged commit 39b42ba into develop May 2, 2024
3 of 6 checks passed
@jmarrec jmarrec deleted the 5178_RUBY_DESCRIPTION branch May 2, 2024 13:20
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
Development

Successfully merging this pull request may close these issues.

Embedded ruby 3.2.2 in CLI is missing "RUBY_DESCRIPTION" global constant
2 participants