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

Initial test case validation using pyucis #23

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

nsdjg
Copy link

@nsdjg nsdjg commented May 16, 2022

Starting point for pyucis validation.

@nsdjg
Copy link
Author

nsdjg commented May 17, 2022

This works for the pyucis test.

@@ -103,7 +103,7 @@ SC_MODULE(stimulus) {
bin<int>("invalid", 0)
};

cross<int, int, int> reset_valid_cross = cross<int, int, int> (this, "reset valid",
cross<int, int, int> reset_valid_cross = cross<int, int, int> (this, "reset_valid",
Copy link

Choose a reason for hiding this comment

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

Is the rename necessary?

Copy link
Author

Choose a reason for hiding this comment

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

The spaces in the name cause problems with my bash code parser. Its a preference to fix. FWIW, the output does not match the golden coverage report either. ie. foo[1] vs foo_1. I can handle either but spaces cause me to have to tweak the code.

If its a problem I can reverse this one. I was just thinking ahead. I don't know if the pyucis one has a problem with it to be honest. I do know the sample I am looking at has all _ separated names. FWIW the spec says this, but I am not entirely clear about the spec:

4.8.3 Variable names as naming components
Variables and parts of variables are identified by language-appropriate string names with no unnecessary white space.

@@ -246,7 +246,7 @@ class covergroup : public cvg_base
<< "\" line=\""
<< "1"
<< "\" inlineCount=\"1\"/>\n";
stream << "<ucis:cgSourceId file=\"" << file_name << "\" "
stream << "<ucis:cgSourceId file=\"1\" "
Copy link

Choose a reason for hiding this comment

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

This does not look ready to go.

Copy link
Author

Choose a reason for hiding this comment

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

There are hardcoded 1's and "KEY" in the code. The sample xml I am looking at has 4625 key="0" in it. It also has 54 entires which look like this

<ucis:cgSourceId file="1" line="1" inlineCount="1"/>

None have a value other than 1.

@@ -0,0 +1,22 @@
# venv notes
Copy link

Choose a reason for hiding this comment

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

These are personal notes and don't belong to this project.

Copy link
Author

Choose a reason for hiding this comment

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

I figured it would help with someone who wanted to run the same setup, but sure I can back it out.

@@ -0,0 +1,13 @@

Copy link

Choose a reason for hiding this comment

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

Can this test (and directory) fit into established Makefile-based testing harness developed by the author?

Copy link
Author

@nsdjg nsdjg May 17, 2022

Choose a reason for hiding this comment

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

I can redo as a test in the makefile or even with bazel. I'm just trying to get something in simply as part of the small diff procedure and elaborate on it as time progresses. Your call as to which objective.

@@ -0,0 +1,13 @@

from io import BytesIO
Copy link

Choose a reason for hiding this comment

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

Generally files name test_XYZ are unit tests and are compatible with unittest python (i.e., executed with python -m unittest)

Copy link
Author

Choose a reason for hiding this comment

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

Yes, it should have a "expect this vs actual result" and be a proper test.

from io import BytesIO
import os
from ucis.xml import validate_ucis_xml

Copy link

Choose a reason for hiding this comment

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

File not pylint clean.

Copy link
Author

Choose a reason for hiding this comment

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

indeed. I'll do a apt install pylint. Its currently not installed.

@nsdjg
Copy link
Author

nsdjg commented May 17, 2022

This has pylint in requirements.txt, suggested mods and afterwards

(venv) ✔ ~/progs/fc4sc/test/pyucis-fir [master|✔] 
14:09 $ pylint validate_ucis_xml.py 

------------------------------------
Your code has been rated at 10.00/10

@nsdjg
Copy link
Author

nsdjg commented May 17, 2022

hmm I'm thinking about modifying the example/fir/Makefile and the test in an upper directory. My first inclination would be to have a parent Makefile and a second test/Makefile and a third test/pyucis-fir/Makefile. That might be overkill but perhaps I can use a top level dir spec. I'll also assume the user is using a similar venv setup.

@nsdjg
Copy link
Author

nsdjg commented May 17, 2022

Added two Makefiles to get test scaffolding in place.

@nsdjg
Copy link
Author

nsdjg commented May 17, 2022

hmm. pyucis repo has a makefile in its docs folder which uses venv. It will setup venv for you. That is a clever approach which should be done here.

@nsdjg
Copy link
Author

nsdjg commented May 17, 2022

This is in conjunction with this pull request for pyucis later I will convert to google unit tests instead of unittest unittests.

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

2 participants