summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2018-03-01 15:49:17 +1030
committerAndrew Jeffery <andrew@aj.id.au>2018-04-04 00:31:48 +0930
commit2a4bee743ac7f71b4784ec190badc1764de57c7d (patch)
treec555f87905b161682730a08a312b189a1ad37411
parent817d22164f7a2fdef574e572f1513ab5fe162e0a (diff)
downloadphosphor-mboxd-2a4bee743ac7f71b4784ec190badc1764de57c7d.zip
phosphor-mboxd-2a4bee743ac7f71b4784ec190badc1764de57c7d.tar.gz
test: vpnor: Add ability to deploy patches in VpnorRoot
Change-Id: If557811530f9a886355d023ea73c3412ba5797f8 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
-rw-r--r--test/vpnor/tmpd.cpp11
-rw-r--r--test/vpnor/tmpd.hpp1
2 files changed, 12 insertions, 0 deletions
diff --git a/test/vpnor/tmpd.cpp b/test/vpnor/tmpd.cpp
index 6bdfa09..9adc615 100644
--- a/test/vpnor/tmpd.cpp
+++ b/test/vpnor/tmpd.cpp
@@ -26,6 +26,17 @@ size_t VpnorRoot::write(const std::string &name, const void *data, size_t len)
return len;
}
+size_t VpnorRoot::patch(const std::string &name, const void *data, size_t len)
+{
+ if (!fs::exists(root / "ro" / name))
+ /* It's not in the ToC */
+ throw std::invalid_argument(name);
+
+ std::ofstream(root / "patch" / name).write((const char *)data, len);
+
+ return len;
+}
+
} // test
} // virtual_pnor
} // openpower
diff --git a/test/vpnor/tmpd.hpp b/test/vpnor/tmpd.hpp
index 8ff40ad..2ebb6c6 100644
--- a/test/vpnor/tmpd.hpp
+++ b/test/vpnor/tmpd.hpp
@@ -90,6 +90,7 @@ class VpnorRoot
return fs::path{root} / "patch";
}
size_t write(const std::string& name, const void* data, size_t len);
+ size_t patch(const std::string& name, const void* data, size_t len);
private:
fs::path root;
OpenPOWER on IntegriCloud