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

Make tests stop build on error #165

Merged

Conversation

fredrik-sk
Copy link
Contributor

Update script to make the automatic tests catch when testfiles should be updated.
(It just happend again.)

@lategoodbye
Copy link
Collaborator

I like this change, but i want to add normalized output into test before merging this.

@fredrik-sk
Copy link
Contributor Author

I'm not sure what normalized outputs means.
I would like this to be merged ASAP so noone can issue a pull request and forgot to update tests.

If you modify the output, you will have to touch all "golden files".

@lategoodbye
Copy link
Collaborator

I'm not sure what normalized outputs means.

mbus_parse_hex supports a option -n. This supports parsing the M-Bus frame the new (normalized value) way found in mbus-protocol-aux. The normalized output is better for machine processing, while the default output (mbus-protocol) is more intended for humans.

I would like this to be merged ASAP so noone can issue a pull request and forgot to update tests.

I understand but your check would only handle half of the truth.

If you modify the output, you will have to touch all "golden files".

No, we need to add all the normalized output files.

@lategoodbye
Copy link
Collaborator

Here as an example for allmess_cf50.hex

default output:

    <DataRecord id="4">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Flow temperature (1e-1 deg C)</Unit>
        <Value>1288</Value>
    </DataRecord>

normalized output:

    <DataRecord id="4">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>°C</Unit>
        <Quantity>Flow temperature</Quantity>
        <Value>128.800000</Value>
    </DataRecord>

@lategoodbye
Copy link
Collaborator

lategoodbye commented Jun 28, 2020

The necessary changes for generate-xml.sh are available in #168

@fredrik-sk fredrik-sk force-pushed the make-tests-stop-build-on-error branch from bc1dc0a to d114d53 Compare July 1, 2020 11:06
fredrik-sk added a commit to fredrik-sk/libmbus that referenced this pull request Jul 1, 2020
fredrik-sk added a commit to fredrik-sk/libmbus that referenced this pull request Jul 1, 2020
Usefull when placing the output in another directory.
@fredrik-sk
Copy link
Contributor Author

Updated/rebased onto rscada/generate-norm-xml. Found one or two things that have bothered me. Please review!

@fredrik-sk fredrik-sk closed this Jul 7, 2020
@fredrik-sk fredrik-sk force-pushed the make-tests-stop-build-on-error branch from da6b744 to 6c1e202 Compare July 7, 2020 11:07
fredrik-sk added a commit to fredrik-sk/libmbus that referenced this pull request Jul 7, 2020
fredrik-sk added a commit to fredrik-sk/libmbus that referenced this pull request Jul 7, 2020
Usefull when placing the output in another directory.
fredrik-sk added a commit to fredrik-sk/libmbus that referenced this pull request Jul 7, 2020
For enhanced readability, split the commands over several lines.
@fredrik-sk
Copy link
Contributor Author

Pushed a new version

@fredrik-sk fredrik-sk reopened this Jul 7, 2020
fredrik-sk pushed a commit to fredrik-sk/libmbus that referenced this pull request Jul 7, 2020
@fredrik-sk
Copy link
Contributor Author

@lategoodbye : Can you review this PR please?

fi

# Check that there was exactly the correct number of files that failed to parse
EXPECTED_PARSE_ERRORS=4
Copy link
Collaborator

Choose a reason for hiding this comment

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

The fact that we expect parse errors is bad. I suggest to move the relevant hex files into unsupported-frames.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There can be a point in doing negative tests.
I see that we have two more directories, unsupported-frames and error-frames.

Should we do execute the code for these directories as well?

Since the files are named: invalid_length.hex and invalid_length2.hex, maybe error-frames/ is more appropriate?

Copy link
Collaborator

@lategoodbye lategoodbye Jul 7, 2020

Choose a reason for hiding this comment

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

Yes, negative tests are a good point. The only one we currently have are invalid_length*.hex
If you want to integrate this in the pull request make two different directories like test-frames-good and test-frames-bad. But if you go this way, this logic should good out of generate-xml.sh

error-frames are valid errors messages send by the slave. The mentioned hex files doesn't fit in there. unsupported-frames are for currently unsupported frames so executing code on these directories doesn't make sense to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a simple if statement for the names of the directories that should contain errors.
It seem simplest to keep this information in this script, otherwise we would have some other script know that error-frames should have 30 parse errors, and pass that information to generate-xml.sh.

See 62b5829 and 50e3141.

Copy link
Collaborator

@lategoodbye lategoodbye Jul 8, 2020

Choose a reason for hiding this comment

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

The fact that we code the expectation of x parse errors is the whole problem. I don't want this in a script to generate XML files. Please keep it simple and easy to maintain. Also i don't want that we run generate-xml on the unsupported frames as a test. Except of that i'm happy to pull.

fredrik-sk added a commit to fredrik-sk/libmbus that referenced this pull request Jul 7, 2020
fredrik-sk added a commit to fredrik-sk/libmbus that referenced this pull request Jul 7, 2020
fredrik-sk added a commit to fredrik-sk/libmbus that referenced this pull request Jul 7, 2020
Usefull when placing the output in another directory.
fredrik-sk added a commit to fredrik-sk/libmbus that referenced this pull request Jul 7, 2020
For enhanced readability, split the commands over several lines.
fredrik-sk pushed a commit to fredrik-sk/libmbus that referenced this pull request Jul 7, 2020
@fredrik-sk fredrik-sk force-pushed the make-tests-stop-build-on-error branch from e0e8a50 to 933da03 Compare July 7, 2020 14:01
fredrik-sk added a commit to fredrik-sk/libmbus that referenced this pull request Jul 7, 2020
fredrik-sk added a commit to fredrik-sk/libmbus that referenced this pull request Jul 7, 2020
fredrik-sk added a commit to fredrik-sk/libmbus that referenced this pull request Jul 7, 2020
Usefull when placing the output in another directory.
@fredrik-sk fredrik-sk force-pushed the make-tests-stop-build-on-error branch from 933da03 to a2cd149 Compare July 7, 2020 18:56
fredrik-sk pushed a commit to fredrik-sk/libmbus that referenced this pull request Jul 7, 2020
@fredrik-sk fredrik-sk force-pushed the make-tests-stop-build-on-error branch from a2cd149 to 50e3141 Compare July 7, 2020 19:01
@fredrik-sk
Copy link
Contributor Author

@lategoodbye , could you have another look?

@fredrik-sk fredrik-sk force-pushed the make-tests-stop-build-on-error branch from 50e3141 to 6c76468 Compare July 8, 2020 12:12
@fredrik-sk
Copy link
Contributor Author

@lategoodbye : New version, where I no longer check the count of errors, and instead accept that the two other directories does not exit with code zero.

@lategoodbye lategoodbye merged commit f498cf1 into rscada:master Jul 8, 2020
lategoodbye pushed a commit that referenced this pull request Jul 8, 2020
lategoodbye pushed a commit that referenced this pull request Jul 8, 2020
Usefull when placing the output in another directory.
lategoodbye pushed a commit that referenced this pull request Jul 8, 2020
For enhanced readability, split the commands over several lines.
@lategoodbye
Copy link
Collaborator

Thanks

lategoodbye pushed a commit that referenced this pull request Jul 19, 2020
lategoodbye pushed a commit that referenced this pull request Jul 19, 2020
Usefull when placing the output in another directory.
Apollon77 pushed a commit to Apollon77/libmbus that referenced this pull request Aug 2, 2020
Apollon77 pushed a commit to Apollon77/libmbus that referenced this pull request Aug 2, 2020
Apollon77 pushed a commit to Apollon77/libmbus that referenced this pull request Aug 2, 2020
Usefull when placing the output in another directory.

(cherry picked from commit e89f929)
Apollon77 pushed a commit to Apollon77/libmbus that referenced this pull request Aug 2, 2020
For enhanced readability, split the commands over several lines.

(cherry picked from commit 3897ac7)
Apollon77 pushed a commit to Apollon77/libmbus that referenced this pull request Aug 2, 2020
Apollon77 pushed a commit to Apollon77/libmbus that referenced this pull request Aug 2, 2020
Apollon77 pushed a commit to Apollon77/libmbus that referenced this pull request Aug 2, 2020
Apollon77 pushed a commit to Apollon77/libmbus that referenced this pull request Aug 2, 2020
Usefull when placing the output in another directory.
Apollon77 pushed a commit to Apollon77/libmbus that referenced this pull request Aug 2, 2020
For enhanced readability, split the commands over several lines.
Apollon77 pushed a commit to Apollon77/libmbus that referenced this pull request Aug 2, 2020
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.

None yet

3 participants