-
Notifications
You must be signed in to change notification settings - Fork 55
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
Pull request for adding simple command line based tutorial. #282
Conversation
…pt for a test. Add those values then cout the result. Test needs to be ran from bash script and not directly. Will add some kind of assertion that a command line option has been taken otherwise ERROR out.
…s and accompanying test files. Both tests utilise bash scripts and are found one directory above the respective test. A generic command line arguement example has been added alongside a use case for a vertex mesh.
Improving comments.
Adding some extra comments.
Improving commenting.
Slight editing of comments.
Removing null assertion for now as it breaks due to outp not being a pointer. Will be added back in later.
Changing test locations with recent changes to Chaste
* be used to run multiple tests with varying parameter inputs. | ||
*/ | ||
|
||
// NOTE: This test will not work if directlly executed from terminal due to requiring command line arguements. |
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.
Sounds as if it will make the test pack fail as well then? We can't really be having that, might need to put heads together on how to do a tutorial a different way...
It should be easy to do an "overwriting defaults" using e.g.
unsigned outp1 = 0;
if CommandLineArguments::Instance()->OptionExists("-opt1")
{
outp1 = CommandLineArguments::Instance()->GetUnsignedCorrespondingToOption("-opt1");
}
and then we can put in comments saying "Please rerun the executable with arguments to see how the output changes, but note you will have to do this outside the ctest
framework".
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 can think of one alternative way. The test could have some default conditions that are ran if command line arguments are not detected. Allowing the tutorial to simply run with those default initial conditions.
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.
This will similarly be changed for TestCommandLineArgumentsTutorial
…into 267-command-line-tutorial
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.
A few suggestions, I think I would simplify quite a bit as there's nothing vertexey or cell based about wanting to pass in arguments, and would complicate the tutorial to show off more of the capabilities of the CommandLineArguments
class!
Modified command line global tutorial to have two tests. First for simple command line arguments and second showing off taking in doubles and utilising a vector of arguments. Each test now also checks if command line options have been given and if not will default to a basic set of parameters to ensure the test will run correctly. Included a paste of the bash script within the test for tutorial purposes.
Possible further additions I can think of now, it may be best to add some simple testing into the default cases or exceptions/assertions to ensure it is running as expected. Additionally , as the CommandLineArguments has the |
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.
A few tweaks @BJackal I think it is getting there, the main one is probably to just get the tutorial to put the bash script in a code block, and give instructions to copy and paste into a bash script in the build folder, then you can remove the script and the need for hardcoded paths I think.
(you can manually run the generate tutorials and website build to see how the generated webpage looks following these instructions: #193 (comment)) |
Committing suggested edits. Co-authored-by: Gary Mirams <gary.mirams@gmail.com>
Committing suggested edits. Co-authored-by: Gary Mirams <gary.mirams@gmail.com>
Committing suggested edits. Co-authored-by: Gary Mirams <gary.mirams@gmail.com>
Committing suggested edits. Co-authored-by: Gary Mirams <gary.mirams@gmail.com>
Committing suggested edits. Co-authored-by: Gary Mirams <gary.mirams@gmail.com>
Committing suggested edits. Co-authored-by: Gary Mirams <gary.mirams@gmail.com>
Committing suggested tidying. Co-authored-by: Gary Mirams <gary.mirams@gmail.com>
Committing suggested edits. Co-authored-by: Gary Mirams <gary.mirams@gmail.com>
… ran from inside the build directory. Removed bash script within main chaste source code as this should now be created by the user in their build directory.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #282 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1029 1029
Lines 51386 51383 -3
=========================================
- Hits 51386 51383 -3 ☔ View full report in Codecov by Sentry. |
Didn't mean to delete branch, we'll do that when ticket is closed! We'll want to add (manually) an entry to the "Core Functionality" part of the menu page: https://chaste.github.io/docs/user-tutorials/ |
Added two new tutorials for executing Chaste tests with command line arguments through bash scripts.
The first is a very simple Hello World style example which takes in multiple command line arguments and outputs the sum. For now this has been placed in global as it seemed the most appropriate location.
Another example has been added for running a bash script with command line arguments to execute multiple vertex based simulations with the height and width of tissue based on command line parameters. This is a slightly expanded version of the vertex based simulation tutorial.