Skip to content

Avoid using DataStringConstants::NL whenever possible and trust OS#8178

Merged
Myoldmopar merged 3 commits intodevelopfrom
fix-errorfile-newlines
Aug 12, 2020
Merged

Avoid using DataStringConstants::NL whenever possible and trust OS#8178
Myoldmopar merged 3 commits intodevelopfrom
fix-errorfile-newlines

Conversation

@lefticus
Copy link
Contributor

  • On windows, with a text file, '\n' does the right thing

Very simple PR. Should specifically fix the issues that @mjwitte noticed for error output files.

 - On windows, with a text file, '\n' does the right thing
@lefticus lefticus added the Defect Includes code to repair a defect in EnergyPlus label Jul 28, 2020
@lefticus lefticus assigned lefticus and mjwitte and unassigned lefticus Jul 28, 2020
@lefticus lefticus requested review from Myoldmopar and mjwitte July 28, 2020 17:07
Copy link
Member

@Myoldmopar Myoldmopar left a comment

Choose a reason for hiding this comment

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

I haven't tested this, but the changes look top notch.


if (UtilityRoutines::outputErrorHeader && err_stream) {
*err_stream << "Program Version," + VerString + ',' + IDDVerString + DataStringGlobals::NL;
*err_stream << "Program Version," << VerString << ',' << IDDVerString << '\n';
Copy link
Member

Choose a reason for hiding this comment

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

What, not std::endl?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I missed your "not" being a link :D

namespace ObjexxFCL {

extern char const CMA;
extern char const NL;
Copy link
Member

Choose a reason for hiding this comment

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

Nice nice nice. One less to manage.

Copy link
Contributor

@mjwitte mjwitte left a comment

Choose a reason for hiding this comment

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

Tested locally on windows. All good now.

@mjwitte
Copy link
Contributor

mjwitte commented Jul 29, 2020

But I did not run unit tests locally...
Many unit tests are failing on windows due to line ending differences in error message string compares. Here's one example:

[ RUN ] EnergyPlusFixture.HeatBalanceIntRadExchange_CarrollMRT
C:\ci\runs\clone_branch\tst\EnergyPlus\unit\Fixtures\EnergyPlusFixture.cc(204): error: Expected: expected_string
Which is: " ** Severe ** Geometry not compatible with Carroll MRT Zone Radiant Exchange method.\r\n"
To be equal to: stream_str
Which is: " ** Severe ** Geometry not compatible with Carroll MRT Zone Radiant Exchange method.\n"
C:\ci\runs\clone_branch\tst\EnergyPlus\unit\HeatBalanceIntRadExchange.unit.cc(128): error: Value of: compare_err_stream(error_string, true)
Actual: false
Expected: true

expected_string is constructed with EnergyPlusFixture::delimited_string which is using DataStringGlobals::NL as the default delimiter.

DataStringGlobals::NL is used in main.cc, InputProcessor.cc, EnergyPlusFixture.hh, and IdfParserFixture.hh. And IdfParser.cc is rolling it's own local NL.

@mbadams5
Copy link
Contributor

@mjwitte All those uses of NL can be changed to the new approach. I just did it in various spots to be consistent with the rest of EnergyPlus previously.

@mjwitte
Copy link
Contributor

mjwitte commented Jul 31, 2020

@lefticus Will you be able to address this?

@Myoldmopar
Copy link
Member

@mjwitte it looks like you are saying there is still a step to be made to fix up the unit tests, is that still the case here?

@mjwitte
Copy link
Contributor

mjwitte commented Aug 7, 2020

@Myoldmopar Yes, this still needs more work. See the lastest Windows CI results

@Myoldmopar
Copy link
Member

OK, I can tackle that cleanup. I built and ran it on Linux but the unit tests run fine. I'll need to build and run on Windows to see it, which isn't a big problem. I'll try to do that soon. Unless @lefticus is already making these changes...

@Myoldmopar
Copy link
Member

OK, on Windows the unit test suite now passes. I just moved all the failing tests and worker functions to use plain old \n. @mbadams5 if you could bless my changes in f9823b8 that would be great.

@mbadams5
Copy link
Contributor

@Myoldmopar The changes seem reasonable and the unit tests seem to pass.

@Myoldmopar
Copy link
Member

@mjwitte do you want to re-run with my fix? It looks like it is good to go to me.

@lefticus
Copy link
Contributor Author

Sorry, missed this ongoing conversation @Myoldmopar the changes you made are inline with similar changes I've had to make as I've updated each output file to being in text mode instead of binary mode.

@mjwitte
Copy link
Contributor

mjwitte commented Aug 12, 2020

@Myoldmopar I've re-run with this branch. Output files look good. Converted between idf and epJSON in both directions and the converted files look good. Other than the failed movefile_test on windows this is good to go. I'm assuming that's a random test failure. The test passes locally.

@Myoldmopar
Copy link
Member

Thanks @lefticus and @mjwitte, merging this in now.

@Myoldmopar Myoldmopar merged commit 1ccbd8d into develop Aug 12, 2020
@Myoldmopar Myoldmopar deleted the fix-errorfile-newlines branch August 12, 2020 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Defect Includes code to repair a defect in EnergyPlus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants