GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
|||
2 |
/*************************************** |
||
3 |
Auteur : Pierre Aubert |
||
4 |
Mail : pierre.aubert@lapp.in2p3.fr |
||
5 |
Licence : CeCILL-C |
||
6 |
****************************************/ |
||
7 |
|||
8 |
#include <iostream> |
||
9 |
|||
10 |
#include "string_utils.h" |
||
11 |
#include "OptionParser.h" |
||
12 |
|||
13 |
#include "RenderProject.h" |
||
14 |
#include "RenderFrontEnd/parseRenderFromToml.h" |
||
15 |
|||
16 |
#include "RenderBackend/backend_jobScript.h" |
||
17 |
#include "RenderBackend/backend_condorSubmit.h" |
||
18 |
#include "RenderBackend/backend_rsync.h" |
||
19 |
#include "RenderBackend/backend_list.h" |
||
20 |
#include "RenderBackend/backend_status.h" |
||
21 |
#include "RenderBackend/backend_push.h" |
||
22 |
#include "RenderBackend/backend_pull.h" |
||
23 |
|||
24 |
///Create the OptionParser of this program |
||
25 |
/** @return OptionParser of this program |
||
26 |
*/ |
||
27 |
7 |
OptionParser createOptionParser(){ |
|
28 |
✓✓ | 14 |
OptionParser parser(true, __PROGRAM_VERSION__); |
29 |
✓✓ | 7 |
parser.setExampleLongOption("phoenix_render --status"); |
30 |
✓✓ | 7 |
parser.setExampleShortOption("phoenix_render -s"); |
31 |
|||
32 |
✓✓✓✓ |
7 |
parser.addOption("status", "s", OptionType::STRING, false, true, "list of the scenes we want a status (empty means all scenes)"); |
33 |
✓✓✓✓ |
7 |
parser.addOption("push", "p", OptionType::STRING, false, true, "list of the scenes we want to submit jobs (empty means all scenes)"); |
34 |
✓✓✓✓ |
7 |
parser.addOption("pull", "g", OptionType::STRING, false, true, "list of the scenes we want to get results (empty means all scenes)"); |
35 |
✓✓✓✓ |
7 |
parser.addOption("list", "l", OptionType::NONE, false, "list the scenes of the project"); |
36 |
✓✓✓✓ |
7 |
parser.addOption("script", "r", OptionType::NONE, false, "list of the scenes we want to generate scripts (empty means all scenes)"); |
37 |
7 |
return parser; |
|
38 |
} |
||
39 |
|||
40 |
///Initialise the build of the given project |
||
41 |
/** @param programOption : option passed to the program |
||
42 |
* @return true on success, false otherwise |
||
43 |
*/ |
||
44 |
7 |
bool callRenderProject(const ProgramOption & programOption){ |
|
45 |
✓✓✓ | 21 |
std::string absoluteProjectDir(removePathDots(makeAbsolutePath(getCurrentDirectory()))); |
46 |
✓✓✓✓ ✓✓✓✓ ✓ |
7 |
std::cout << termCyan() << "Render project"<<termDefault()<<" : '"<<absoluteProjectDir<<"'" << std::endl; |
47 |
✓ | 14 |
std::string configFile(absoluteProjectDir + "/prender.toml"); |
48 |
|||
49 |
✓ | 14 |
RenderProject renderProject; |
50 |
✓✗✓ | 7 |
if(!parseRenderFromToml(renderProject, configFile)){ |
51 |
std::cerr << "Trouble when parsing '"+configFile+"' configuration in file in directory '"<<absoluteProjectDir<<"'" << std::endl; |
||
52 |
return false; |
||
53 |
} |
||
54 |
7 |
bool isSuccess(true); |
|
55 |
✓✓✓✓ |
7 |
if(programOption.getWantList()){backend_list(renderProject);} |
56 |
✓✓✓✓ ✓ |
5 |
else if(backend_status(isSuccess, renderProject, programOption.getWantStatus(), programOption.getVecStatusScene())){} |
57 |
✓✓✓✗ ✓ |
2 |
else if(backend_createSceneScript(isSuccess, renderProject, programOption.getWantScript(), programOption.getVecScriptScene())){} |
58 |
else if(backend_push(isSuccess, renderProject, programOption.getWantPush(), programOption.getVecPushScene())){} |
||
59 |
else if(backend_pull(isSuccess, renderProject, programOption.getWantPull(), programOption.getVecPullScene())){} |
||
60 |
|||
61 |
7 |
return isSuccess; |
|
62 |
} |
||
63 |
|||
64 |
7 |
int main(int argc, char** argv){ |
|
65 |
✓ | 14 |
OptionParser parser = createOptionParser(); |
66 |
✓ | 7 |
parser.parseArgument(argc, argv); |
67 |
|||
68 |
✓ | 7 |
const OptionMode & defaultMode = parser.getDefaultMode(); |
69 |
✓ | 7 |
ProgramOption option; |
70 |
✓✓✓ | 7 |
option.setWantStatus(defaultMode.isOptionExist("status")); |
71 |
✓✓✓ | 7 |
defaultMode.getValue(option.getVecStatusScene(), "status"); |
72 |
✓✓✓ | 7 |
option.setWantPush(defaultMode.isOptionExist("push")); |
73 |
✓✓✓ | 7 |
defaultMode.getValue(option.getVecPushScene(), "push"); |
74 |
✓✓✓ | 7 |
option.setWantPull(defaultMode.isOptionExist("pull")); |
75 |
✓✓✓ | 7 |
defaultMode.getValue(option.getVecPullScene(), "pull"); |
76 |
✓✓✓ | 7 |
option.setWantList(defaultMode.isOptionExist("list")); |
77 |
✓✓✓ | 7 |
option.setWantScript(defaultMode.isOptionExist("script")); |
78 |
✓✓✓ | 7 |
defaultMode.getValue(option.getVecScriptScene(), "script"); |
79 |
✓ | 7 |
bool b(callRenderProject(option)); |
80 |
7 |
return b - 1; |
|
81 |
} |
||
82 |
|||
83 |
|||
84 |
Generated by: GCOVR (Version 4.2) |