File System: Dependency Injection and Mock

1. Add an abstract FileSystemInterface for Dependency Injection
2. Add  FileSystemWrapper for real file system operations, which is
   called in produciton
3. Add FileSystemMock for unit test mock only
4. Add bm_mode_transition_unittest.cpp to cover file system based bm
   mode transition

Tested:
 1/14 eth                        OK              0.22s
 2/14 flash                      OK              0.21s
 3/14 machine                    OK              0.12s
 4/14 bmc_mode                   OK              0.05s
 5/14 cable                      OK              0.27s
 6/14 cpld                       OK              0.25s
 7/14 entity                     OK              0.24s
 8/14 google_accel_oob           OK              0.20s
 9/14 pcie                       OK              0.11s
10/14 poweroff                   OK              0.09s
11/14 psu                        OK              0.08s
12/14 pcie_bifurcation           OK              0.07s
13/14 bm_mode_transition         OK              0.29s
14/14 handler                    OK              0.44s

Ok:                 14
Expected Fail:      0
Fail:               0
Unexpected Pass:    0
Skipped:            0
Timeout:            0

Change-Id: I8d0d9096fbeee7af1946d7e73f548e4a249d3bee
Signed-off-by: Hao Zhou <haoooamazing@google.com>
diff --git a/file_system_wrapper.cpp b/file_system_wrapper.cpp
new file mode 100644
index 0000000..c9a8b79
--- /dev/null
+++ b/file_system_wrapper.cpp
@@ -0,0 +1,44 @@
+// Copyright 2023 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "file_system_wrapper_impl.hpp"
+
+#include <fstream>
+#include <system_error>
+
+namespace google
+{
+namespace ipmi
+{
+namespace fs = std::filesystem;
+
+bool FileSystemWrapper::exists(const fs::path& path, std::error_code& ec) const
+{
+    return fs::exists(path, ec);
+}
+
+void FileSystemWrapper::rename(const fs::path& oldPath, const fs::path& newPath,
+                               std::error_code& ec) const
+{
+    fs::rename(oldPath, newPath, ec);
+}
+
+void FileSystemWrapper::create(const char* path) const
+{
+    std::ofstream ofs;
+    ofs.open(path, std::ofstream::out);
+    ofs.close();
+}
+} // namespace ipmi
+} // namespace google