Add TestCreateTwoOperations
Adds test to generate project with simple task set with some fixes to task I/O.
Note that this MR might have conflicts with !2922 (merged). Recommend merging !2922 (merged) first.
Merge request reports
Activity
assigned to @john.tourtellott
Errors:
- commit b64373bc is not allowed; missing newline at the end of file in
data/projects/GroupTaskExample/after.project.smtk
. - commit b64373bc is not allowed because the following files are not formatted according to the 'clang-format' check:
smtk/project/testing/cxx/TestCreateTwoOperationProject.cxx
. Post a comment ending in the lineDo: reformat
to rewrite the MR source branch automatically. - commit d08cd055 is not allowed because the following files are not formatted according to the 'clang-format' check:
smtk/project/operators/Read.cxx
,smtk/project/testing/cxx/TestCreateTwoOperationProject.cxx
. Post a comment ending in the lineDo: reformat
to rewrite the MR source branch automatically.
Warnings:
- please consider adding a changelog entry in a file ending with
.rst
indoc/release/notes
.
The warnings do not need to be fixed, but it is recommended to do so.
Please rewrite commits to fix the errors listed above (adding fixup commits will not resolve the errors) and force-push the branch again to update the merge request.
- commit b64373bc is not allowed; missing newline at the end of file in
Errors:
- commit 9bf0fe80 is not allowed; missing newline at the end of file in
data/projects/GroupTaskExample/after.project.smtk
.
Warnings:
- please consider adding a changelog entry in a file ending with
.rst
indoc/release/notes
.
The warnings do not need to be fixed, but it is recommended to do so.
Please rewrite commits to fix the errors listed above (adding fixup commits will not resolve the errors) and force-push the branch again to update the merge request.
- commit 9bf0fe80 is not allowed; missing newline at the end of file in
requested review from @dcthomp
added area:testing component:task-system ~3849 labels
Errors:
- commit c8ae8c91 is not allowed because the following files are not formatted according to the 'clang-format' check:
smtk/task/adaptor/ConfigureOperation.cxx
. Post a comment ending in the lineDo: reformat
to rewrite the MR source branch automatically.
Warnings:
- please consider adding a changelog entry in a file ending with
.rst
indoc/release/notes
.
The warnings do not need to be fixed, but it is recommended to do so.
Please rewrite commits to fix the errors listed above (adding fixup commits will not resolve the errors) and force-push the branch again to update the merge request.
- commit c8ae8c91 is not allowed because the following files are not formatted according to the 'clang-format' check:
109 110 project->setLocation(filename); 110 111 project->resources().setManager(this->managers()->get<smtk::resource::Manager::Ptr>()); 111 112 project->operations().setManager(this->managers()->get<smtk::operation::Manager::Ptr>()); 113 smtk::task::Registrar::registerTo(project->taskManager().shared_from_this()); This is not enough; it only registers
smtkCore
's tasks to the project manager. If there are really problems registering task types, then the solution is to have the plugin manager iterate over all theRegistrar
classes that have aregisterTo(const std::shared_ptr<task::Manager>&)
method and invoke each of them. I believe this would besmtk::plugin::Manager::instance()->registerPluginsTo(project->taskManager().shared_from_this())
.Hmmm.... your comment leaves me the impression that I need to create the (project and) task manager before reading the file so that I can call theregisterPlugins
method before reading the file. Is that the case?Sooooo..... I need to call both functions?
smtk::task::Registrar::registerTo(project->taskManager().shared_from_this()); smtk::plugin::Manager::instance()->registerPluginsTo(project->taskManager().shared_from_this());
Edited by John TourtellottI might have to go back to gdb and/or printf's. Adding the
registerPluginsTo()
call and leaving out theregisterTo()
method makes the test fail.158: Test command: /home/local/KHQ/john.tourtellott/projects/cmb-master/build/smtk/bin/UnitTests_smtk_project_testing_cxx "TestCreateTwoOperationProject" 158: Test timeout computed to be: 120 158: Deleting existing directory "/home/local/KHQ/john.tourtellott/projects/cmb-master/build/smtk/Testing/Temporary/TwoOperations/" 158: Imported operattion "math_op.MathOp" 158: Wrote /home/local/KHQ/john.tourtellott/projects/cmb-master/build/smtk/Testing/Temporary/TwoOperations/TwoOperations.project.smtk 158: ## TEST FAILURE ## 158: 158: Input project wrong number of tasks; should be 5 not 0 158: 158: ## TEST FAILURE ## 158: terminate called after throwing an instance of 'std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >' 1/1 Test #158: TestCreateTwoOperationProject ....Subprocess aborted***Exception: 0.46 sec
modelbuilder must be initializing something that the test is not...
I finally figured out why calling
smtk::plugin::Manager::instance()->registerPluginsTo()
in test programs does not get the default task types registered. After some reverse engineering:Part 1: Why TestCreateTwoOperations does NOT register tasks. In brief, when calling
smtk::plugin::Manager::instance()->registerPluginsTo()
, itsm_clients
member data (std::vector) is empty and the method skips the part that would have called the code to register task types.Part 2: So how does modelbuilder register tasks and (therefore) successfully create projects with task managers? When modelbuilder starts, the import/registration of the
vtkPVPlugin
ends up calling functions with names likesmtk::plugin::init::smtk_resource_Registrar()
. These functions are generated during the build process and essentially populate the m_clients member insmtk::plugin::Manager
.So, mimicking the code in
smtkPluginInitializersmtk_task_Registrar.cxx
at the start of the test program eliminated the need for explicitly registering task types. (The change is just a one-line instantiation of typesmtk::plugin::Client<smtk::task::Registrar, smtk::task::Manager>
.)Maybe some wordsmithed version of this lore should be put in smtk docs somewhere. In the meantime, this gets me over the hump when creating projects with tasks. I still need to look into a problem with task managers in projects that are read from file.
changed this line in version 7 of the diff