AU/unittest: new syscall wrappers for testing
BUG=chromium:236465
TEST=None
Change-Id: I405aedbd719c8412cd2dbe81b8cf6d7351c9994b
Reviewed-on: https://gerrit.chromium.org/gerrit/62325
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/test_utils.h b/test_utils.h
index e8f337d..4285c4d 100644
--- a/test_utils.h
+++ b/test_utils.h
@@ -5,6 +5,10 @@
#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__
#define CHROMEOS_PLATFORM_UPDATE_ENGINE_TEST_UTILS_H__
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
#include <set>
#include <string>
#include <vector>
@@ -46,6 +50,18 @@
return system(cmd.c_str());
}
+inline int Symlink(const std::string& oldpath, const std::string& newpath) {
+ return symlink(oldpath.c_str(), newpath.c_str());
+}
+
+inline int Chmod(const std::string& path, mode_t mode) {
+ return chmod(path.c_str(), mode);
+}
+
+inline int Mkdir(const std::string& path, mode_t mode) {
+ return mkdir(path.c_str(), mode);
+}
+
void FillWithData(std::vector<char>* buffer);
namespace {