Fix error attribute naming for Linux 5.0

There was a slight change to one of the error attributes as part of the
OCC driver upstreaming process. This commit also adds unit tests for the
error attributes. This required some refactoring to support the unit
tests.

Resolves openbmc/openbmc#3505

Signed-off-by: Eddie James <eajames@us.ibm.com>
Change-Id: I665b46e44b18befc8a728f7246bcda82f1f1a71c
diff --git a/occ_errors.hpp b/occ_errors.hpp
index ebacc8a..f623704 100644
--- a/occ_errors.hpp
+++ b/occ_errors.hpp
@@ -36,7 +36,7 @@
     Error(EventPtr& event, const fs::path& file,
           std::function<void(bool)> callBack = nullptr) :
         event(event),
-        file(fs::path(DEV_PATH) / file), callBack(callBack)
+        file(file), callBack(callBack)
     {
         // Nothing to do here.
     }
@@ -49,12 +49,23 @@
         }
     }
 
-    /** @brief Starts to monitor for error conditions */
-    void addWatch();
+    /** @brief Starts to monitor for error conditions
+     *
+     *  @param[in] poll - Indicates whether or not the error file should
+     *                    actually be polled for changes. Disabling polling is
+     *                    necessary for error files that don't support the poll
+     *                    file operation.
+     */
+    void addWatch(bool poll = true);
 
     /** @brief Removes error watch */
     void removeWatch();
 
+    inline void setFile(const fs::path& f)
+    {
+        file = f;
+    }
+
   private:
     /** @brief sd_event wrapped in unique_ptr */
     EventPtr& event;
@@ -95,7 +106,7 @@
     int fd = -1;
 
     /** Error file */
-    const fs::path file;
+    fs::path file;
 
     /** @brief Optional function to call on error scenario */
     std::function<void(bool)> callBack;