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

HPCC-30310 esdl ecl output to stdout #17971

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

asselitx
Copy link
Contributor

@asselitx asselitx commented Oct 27, 2023

Update esdl ecl command to allow output to stdout by making the outputDir parameter optional. When using stdout, restrict the use of options to those combinations that result in a single file output.

Disabled verbose output in the call to EsdlCmdHelper::convertECMtoESXDL to avoid printing extra text to stdout.

Update esdl regression test with cases for esdl ecl, though the suite needs independent updates to bring tests of the other commands in line with recent platform changes. This will be handled in the ticket HPCC-30699.

Type of change:

  • This change is a bug fix (non-breaking change which fixes an issue).
  • This change is a new feature (non-breaking change which adds functionality).
  • This change improves the code (refactor or other change that does not change the functionality)
  • This change fixes warnings (the fix does not alter the functionality or the generated code)
  • This change is a breaking change (fix or feature that will cause existing behavior to change).
  • This change alters the query API (existing queries will have to be recompiled)

Checklist:

  • My code follows the code style of this project.
    • My code does not create any new warnings from compiler, build system, or lint.
  • The commit message is properly formatted and free of typos.
    • The commit message title makes sense in a changelog, by itself.
    • The commit is signed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly, or...
    • I have created a JIRA ticket to update the documentation.
    • Any new interfaces or exported functions are appropriately commented.
  • I have read the CONTRIBUTORS document.
  • The change has been fully tested:
    • I have added tests to cover my changes.
    • All new and existing tests passed.
    • I have checked that this change does not introduce memory leaks.
    • I have used Valgrind or similar tools to check for potential issues.
  • I have given due consideration to all of the following potential concerns:
    • Scalability
    • Performance
    • Security
    • Thread-safety
    • Cloud-compatibility
    • Premature optimization
    • Existing deployed queries will not be broken
    • This change fixes the problem, not just the symptom
    • The target branch of this pull request is appropriate for such a change.
  • There are no similar instances of the same problem that should be addressed
    • I have addressed them here
    • I have raised JIRA issues to address them separately
  • This is a user interface / front-end modification
    • I have tested my changes in multiple modern browsers
    • The component(s) render as expected

Smoketest:

  • Send notifications about my Pull Request position in Smoketest queue.
  • Test my draft Pull Request.

Testing:

Added regressions to the testing/esdlcmd tests. Some further work needs to be done on the prior tests in that suite, which will be handled under ticket HPCC-30699

@asselitx asselitx requested a review from timothyklemm October 27, 2023 17:28
@github-actions
Copy link

@asselitx asselitx requested a review from shamser October 31, 2023 16:14
Copy link
Contributor

@shamser shamser left a comment

Choose a reason for hiding this comment

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

Mostly minor comments. However, the change validate_results(self) is required as unexpected test results may be produced when stdout result is empty.

testing/esp/esdlcmd/esdlcmd-test.py Outdated Show resolved Hide resolved

if self.expected_err != None and self.expected_err == self.result.stderr:
success = True
elif self.result.returncode != 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this check be done first before the expected_err != None check (in Line 153)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not in this case. The check on 153 captures any tests that are expected to return an error by making sure the error message printed matches what is expected. Then any other test returning an error return code is a failure. I can't make an analogous check of stderr, because the esdl command prints some non-failure messages to stderr.

if self.stdout:
if self.result.stdout != None and len(self.result.stdout) > 0:
with open((outName / 'from-stdout.ecl'), 'w', encoding='utf-8') as f:
f.write(self.result.stdout)
Copy link
Contributor

Choose a reason for hiding this comment

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

It should probably be do an "else return False" here after line 192. Otherwise, the tests in the next few lines will compare with previously created "from-stdout.ecl" from previous test runs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -231,7 +336,15 @@ def parse_options():
help='Enable debug logging of test cases',
action='store_true', default=False)

parser.add_argument('-c', '--commands',
help='esdl commands to run tests for, use once for each command or pass "all" to test all commands. Defaults to "all".',
action="append", choices=command_values)
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason not to use "default" parameter rather than the extra code in 345.

Copy link
Contributor Author

@asselitx asselitx Nov 28, 2023

Choose a reason for hiding this comment

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

That was my first approach, but I saw that using action="append" with a default always results in the list containing the default in addition to any values supplied on the command line. The behavior was counter-intuitive, but the append action documentation does mention it: https://docs.python.org/3.12/library/argparse.html?highlight=argparse#action

Copy link
Contributor

@shamser shamser left a comment

Choose a reason for hiding this comment

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

Looks good

@asselitx asselitx force-pushed the esdl-stdout-hpcc-30310 branch from 7caa41b to 73dddd7 Compare November 29, 2023 16:05
@asselitx
Copy link
Contributor Author

@timothyklemm I've addressed the issue we talked about yesterday

}
else
{
fprintf(stderr, "\noption detected before required parameters: %s\n", arg);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this removed? The call to usage() produces non-ecl output but doesn't explain the specific problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just missed. Added back, along with another more descriptive error for missing the required parameter

Update esdl ecl command to allow output to stdout by making the outputDir
parameter optional. When using stdout, restrict the use of options to those
combinations that result in a single file output.

Disabled verbose output in the call to EsdlCmdHelper::convertECMtoESXDL to
avoid printing extra text to stdout.

Update esdl regression test with cases for esdl ecl, though the suite needs
independent updates to bring tests of the other commands in line with
recent platform changes. This will be handled in the ticket HPCC-30699.

Signed-off-by: Terrence Asselin <[email protected]>
@asselitx asselitx force-pushed the esdl-stdout-hpcc-30310 branch from 92a36bf to 5747ab4 Compare December 1, 2023 21:33
@asselitx
Copy link
Contributor Author

asselitx commented Dec 1, 2023

@ghalliday squashed and approved to merge

@ghalliday ghalliday merged commit 2a66e73 into hpcc-systems:master Dec 5, 2023
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants