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

Test suite autodetect datastream. #4657

Merged
merged 2 commits into from
Jul 25, 2019
Merged

Conversation

matejak
Copy link
Member

@matejak matejak commented Jul 25, 2019

The frequent use case is that a single datastream is built in the build directory, and one wants it to be tested by the test suite.
This change add autodetection capabilities, so the --datastream option can be left out. If it is left out and there is not a single datastream in the build dir, an error is displayed instead.

As a side-effect, the --datastream option won't be required any longer, which is generally recommended.

Required options are generally considered bad form because users expect options to be optional, and thus they should be avoided when possible.

The frequent use case is that a single datastream is built in the build directory,
and one wants it to be tested by the test suite.
This change add autodetection capabilities, so the --datastream option can be left out.
If it is left out and there is not a single datastream in the build dir,
an error is displayed instead.
@matejak matejak added this to the 0.1.46 milestone Jul 25, 2019
@yuumasato yuumasato self-assigned this Jul 25, 2019
Copy link
Member

@yuumasato yuumasato left a comment

Choose a reason for hiding this comment

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

This is a very welcome change, I just suggest changing expectation of having one datastream in build dir.

if len(datastreams) == 1:
return datastreams[0]
msg = ("Unable to auto-detect the datastream, "
"expected to find a single one in the build dir, but")
Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't say that it is expected that there is only single datastream in build dir, I have othen more than one.

if not datastreams:
raise RuntimeError(msg + " found none.")
raise RuntimeError(
msg + " found multiple ones: {0}".format(datastreams))
Copy link
Member

Choose a reason for hiding this comment

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

If multiple DataStreams are found, the tool should recommend use of --datastream option.

@matejak
Copy link
Member Author

matejak commented Jul 25, 2019

Thanks for the feedback, comments are addressed.

raise RuntimeError(
msg + " found multiple ones: {0}".format(datastreams))
msg + " there are {0} of them. Use the --datastream option to select "
Copy link
Member

Choose a reason for hiding this comment

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

The line can get rather long:

Setting console output to log level INFO
ERROR - Error occurred during options normalization: Autodetection of the datastream file is possible only when there is a single one in the build dir, but there are 28 of them. Use the --datastream option to select e.g. ['../build/ssg-debian8-ds.xml', '../build/ssg-rhel7-ds.xml', '../build/ssg-wrlinux8-ds.xml', '../build/ssg-wrlinux1019-ds.xml', '../build/ssg-ubuntu1404-ds.xml', '../build/ssg-ol8-ds.xml', '../build/ssg-centos6-ds.xml', '../build/ssg-fuse6-ds.xml', '../build/ssg-centos7-ds.xml', '../build/ssg-eap6-ds.xml', '../build/ssg-ubuntu1604-ds.xml', '../build/ssg-ubuntu1804-ds.xml', '../build/ssg-rhv4-ds.xml', '../build/ssg-rhosp13-ds.xml', '../build/ssg-chromium-ds.xml', '../build/ssg-fedora-ds.xml', '../build/ssg-ol7-ds.xml', '../build/ssg-sl6-ds.xml', '../build/ssg-rhel8-ds.xml', '../build/ssg-sle12-ds.xml', '../build/ssg-firefox-ds.xml', '../build/ssg-sl7-ds.xml', '../build/ssg-sle11-ds.xml', '../build/ssg-rhel6-ds.xml', '../build/ssg-opensuse-ds.xml', '../build/ssg-jre-ds.xml', '../build/ssg-ocp3-ds.xml', '../build/ssg-centos8-ds.xml']

And in the terminal it actually wraps up.
I like that they short and easy to copy-paste when adding --datastream option.

@yuumasato yuumasato merged commit 67531fc into ComplianceAsCode:master Jul 25, 2019
@matejak matejak deleted the infer_ds branch August 8, 2019 11:36
This pull request was closed.
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.

2 participants