17 #include <boost/lexical_cast.hpp> 18 #include <boost/system/error_code.hpp> 20 #include "gtest/gtest.h" 55 std::string statusFilePath;
70 std::map<int, std::string> rfs_status;
80 int _activeKernel = 1;
85 std::map<int, std::string> kernel_status;
90 std::map<std::string, dpyStatus::Result> translationStatuMap;
92 bool processUsedKernel(std::string command);
93 bool processUsedRfs(std::string command);
95 void fixStatusFile(std::string path =
"");
96 bool writeDefaultStatus(boost::system::error_code& ec, std::string path =
"");
105 static Status *getInstance();
106 bool init(boost::system::error_code& ec, std::string path, std::string cmdline=
"cat /proc/cmdline");
107 bool readStatus(boost::system::error_code& ec, std::string path =
"");
108 bool writeStatus(boost::system::error_code& ec, std::string path =
"");
123 void repairActiveRFS();
124 void repairActiveKernel();
126 void changeActiveRFS();
127 void changeActiveKernel();
178 return _activeKernel;
187 if (_usedKernel == 1) {
196 FRIEND_TEST(Status_test, readStatus_File_does_not_exist);
197 FRIEND_TEST(Status_test, writeDefaultStatusOK);
198 FRIEND_TEST(Status_test, writeStatusError);
199 FRIEND_TEST(Status_test,readStatusParseError);
200 FRIEND_TEST(Status_test,readStatusValueError);
201 FRIEND_TEST(Status_test,readStatusKeyError);
202 FRIEND_TEST(Status_test,readStatusWrongValueKernel);
203 FRIEND_TEST(Status_test,readStatusWrongValueRfs);
204 FRIEND_TEST(Status_test,processUsedKernel1Correct);
205 FRIEND_TEST(Status_test,processUsedRfs1Correct);
206 FRIEND_TEST(Status_test,processUsedRfs2Correct);
207 FRIEND_TEST(Status_test,processUsedKernel2Correct);
208 FRIEND_TEST(Status_test,changeStatus);
209 FRIEND_TEST(Status_test,currentDefaultStatus);
210 FRIEND_TEST(Status_test,translationMapCreation);
211 FRIEND_TEST(Status_test,StatusInitParseError);
212 FRIEND_TEST(Status_test,StatusInitFileDoesNotExit);
213 FRIEND_TEST(Status_test,StatusInitCorrect);
214 FRIEND_TEST(Status_test,processUsedRfsError);
215 FRIEND_TEST(Status_test,processUsedKernelError);
216 FRIEND_TEST(Status_test,changeActiveKernelCorrect);
217 FRIEND_TEST(Status_test,changeActiveRfsCorrect);
218 FRIEND_TEST(Status_test,repairActiveRfsCorrect);
219 FRIEND_TEST(Status_test,repairActiveKernelCorrect);
UPDATED.
Definition: status.h:32
Manages the status file.
Definition: status.h:44
int usedRFS() const
Definition: status.h:134
int alternativeKernel()
Definition: status.h:185
int activeRFS() const
Definition: status.h:144
int usedKernel() const
Definition: status.h:166
int activeKernel() const
Definition: status.h:176
Result
Defines the possible states.
Definition: status.h:27
int alternativeRFS()
Definition: status.h:153