summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2016-11-08 22:13:54 +0100
committerandroid-build-merger <android-build-merger@google.com>2016-11-08 22:13:54 +0100
commitb66b94c56c476fbe7bf8a6e8328caffe9fd44b8f (patch)
treeb50adfbb125d7652719820a61b2cd0d02b8d4ddb /tests
parentMerge "Move recovery_test.cpp out of unit test" am: 8bfd96c0f8 am: e9390679c9 am: a1c121e034 (diff)
parentMerge "Make make_parent() to take const argument" am: 52e2a97aa7 am: 1fd9f0aff7 (diff)
downloadandroid_bootable_recovery-b66b94c56c476fbe7bf8a6e8328caffe9fd44b8f.tar
android_bootable_recovery-b66b94c56c476fbe7bf8a6e8328caffe9fd44b8f.tar.gz
android_bootable_recovery-b66b94c56c476fbe7bf8a6e8328caffe9fd44b8f.tar.bz2
android_bootable_recovery-b66b94c56c476fbe7bf8a6e8328caffe9fd44b8f.tar.lz
android_bootable_recovery-b66b94c56c476fbe7bf8a6e8328caffe9fd44b8f.tar.xz
android_bootable_recovery-b66b94c56c476fbe7bf8a6e8328caffe9fd44b8f.tar.zst
android_bootable_recovery-b66b94c56c476fbe7bf8a6e8328caffe9fd44b8f.zip
Diffstat (limited to '')
-rw-r--r--tests/component/updater_test.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/component/updater_test.cpp b/tests/component/updater_test.cpp
index f922933cd..acc2b4040 100644
--- a/tests/component/updater_test.cpp
+++ b/tests/component/updater_test.cpp
@@ -208,4 +208,26 @@ TEST_F(UpdaterTest, rename) {
// Already renamed.
expect(temp_file2.path, script2.c_str(), kNoCause);
+
+ // Parents create successfully.
+ TemporaryFile temp_file3;
+ TemporaryDir td;
+ std::string temp_dir = std::string(td.path) + "/aaa/bbb/a.txt";
+ std::string script3("rename(\"" + std::string(temp_file3.path) + "\", \"" +
+ temp_dir + "\")");
+ expect(temp_dir.c_str(), script3.c_str(), kNoCause);
+}
+
+TEST_F(UpdaterTest, symlink) {
+ // symlink expects 1+ argument.
+ expect(nullptr, "symlink()", kArgsParsingFailure);
+
+ // symlink should fail if src is an empty string.
+ TemporaryFile temp_file1;
+ std::string script1("symlink(\"" + std::string(temp_file1.path) + "\", \"\")");
+ expect(nullptr, script1.c_str(), kSymlinkFailure);
+
+ // symlink failed to remove old src.
+ std::string script2("symlink(\"" + std::string(temp_file1.path) + "\", \"/proc\")");
+ expect(nullptr, script2.c_str(), kSymlinkFailure);
}