bios.h
1 #pragma once
2 
3 #include <iostream>
4 #include <functional>
5 #include "command.h"
6 
7 #ifdef TESTING
8 #include <gtest/gtest.h>
9 #endif
10 
16 class Bios
17 {
18 
19 public:
20  Bios();
21  virtual ~Bios();
22  static bool updateBios(const std::string &zipLocation, bool removeFile = true);
23  static bool getCurrentVersion(std::string &current_version);
24  static void removeInstalleFiles(const std::string &path);
25 
26 private:
27  static bool getZipVersion(std::string &new_version, std::string &path);
28  static inline std::function<std::string(std::string)> mCmdFunc = Command::GetStdoutFromCommand;
29 
30 #ifdef TESTING
31 public:
32  friend class UpdateBIOS_test;
33  FRIEND_TEST(UpdateBIOS_test,getZipBiosVersionOK);
34  FRIEND_TEST(UpdateBIOS_test,getZipBiosVersionKO);
35  FRIEND_TEST(UpdateBIOS_test,getCurrentBiosVersionOK);
36  FRIEND_TEST(UpdateBIOS_test,getCurrentBiosVersionNotValid2Numbers);
37  FRIEND_TEST(UpdateBIOS_test,getCurrentBiosVersionNotValidVersionLetters);
38  FRIEND_TEST(UpdateBIOS_test,updateBiosUnzipError);
39  FRIEND_TEST(UpdateBIOS_test,updateBiosVersionsMatch);
40  FRIEND_TEST(UpdateBIOS_test,updateBiosDifferentVersionsOK);
41  FRIEND_TEST(UpdateBIOS_test,updateBiosNoSuchFileFwuImage);
42  FRIEND_TEST(Commander_Handlers_test,BIOS_version_error_not_reported);
43  FRIEND_TEST(Commander_Handlers_test,BIOS_version_reported_OK);
44 
45 #endif //TESTING
46 };
Defines a class for executing commands and getting output.
Class that triggers a BIOS update.
Definition: bios.h:16