-
Notifications
You must be signed in to change notification settings - Fork 117
[feat] Add built-ins to manage test variables and parameters #1699
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
Conversation
|
Hello @jjotero, Thank you for updating! Cheers! There are no PEP8 issues in this Pull Request!Do see the ReFrame Coding Style Guide Comment last updated at 2021-02-18 11:39:59 UTC |
Codecov Report
@@ Coverage Diff @@
## master #1699 +/- ##
==========================================
+ Coverage 87.27% 87.46% +0.19%
==========================================
Files 46 49 +3
Lines 7708 7900 +192
==========================================
+ Hits 6727 6910 +183
- Misses 981 990 +9
Continue to review full report at Codecov.
|
|
There seems to be a strange side effect: And this generates this in the build script: module load daint-gpu
module load PrgEnv-cray
cd posts/cuda-aware-mpi-example/src
cc eatmemory.c -o ./MemoryOverconsumptionCheckWhich is apparently very strange :-D |
jjotero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added some more comments into the metaclass and also extended the docs.
Before we move forward with this, I think we can already address the naming issue in this PR for the parameterized tests with the built-in parameter (see comment).
😱😱😱😱😱😱😱😱😱😱 |
|
The issue with the self.prebuild_cmds += ['cd posts/cuda-aware-mpi-example/src']This changed default value of All this would not be a problem if all tests do the first assignment as a new list, but that is simply too dangerous. So to fix this, the values that get injected into the variables are now deep-copies of the original class-default values, which totally removes this cross-contamination in the tests. The same could have happened for the parameters, so another fix has been implemented in there. To make sure these changes stick, I've added two new unit tests that check this for the variables and parameters. I've also improved the docs on the built-in section. |
vkarak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've only cosmetic suggestions and it's ready to go. I will also give it a try with a full production run.
jjotero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did the full production run pass?
vkarak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! 🎉 Just fix the conflicts with the master and change all the versionadded annotations to 3.4.2, because it's going in today!
|
For the conflicts, just keep your version. I have simply fixed the styling in a previous PR. |
jjotero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated version notes to 3.4.2
Yes. The failures were just ordinary test failures, not related to framework problems. |
victorusu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
@jenkins-cscs retry daint |
This PR introduces some changes suggested in #1568. Building on the same concept as used to implement the extensible parameterized tests, we introduce the
vardirective, which injects a new variable in theRegressionTestclass.This variable is injected into
Spamas a data descriptor (TypedField) though the__new__method. If an alternativeFieldwere needed, thevardirective accepts thefieldargument. The value passed as this argument must be a subclass of theFieldclass located inreframe/core/fields.py.On this
vardirective, thevalueargument is entirely optional, and one might choose to leave the variable undefined. Logically, if that is the case and the variable is referenced in the class, an exception will be raised. However, If one inherits from a class with an undefined variable and need to set its value, or simply overwriting an old value, one can use theset_vardirective.Note that, when using the
set_vardirective, the variablemyTestVariablemust have been declared through thevardirective in a parent class. If that were not the case, another error would be raised.Now with the converse. Suppose you're writing a library extending the work of someone else, but that "base" library has set a value for a variable. Instead of using such value, you can force the users to set the value for themselves by using the
require_vardirective. This directive will effectively undefine the variable, which means that an error will be raised if it hasn't been set.Same as with
set_var, the variable referred to byrequire_varmust have been declared with thevardirective in any of the parent classes. Flagging a variable that is not present in the test as required is implemented as a no-op (a variable that is not present in the test has no meaning to it).There are still a few minor things to be addressed:
This PR will also:
RegressionTestclass (direct consequence of the previous item).RegressionMixinclass. This class supports reframe hooks and directives, solving the limitation introduced by the previous item.Closes #1568.