summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-05-04 02:06:38 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-05-04 02:06:38 +0200
commitbfca876038d4100ed484420bcbd1124e2ac7ee82 (patch)
treede0b11a1ec4831e2c02eadb67bf58460964cf232 /tests
parentMerge "Remove EXPAND/STRINGIFY macros." am: b00c66faf7 am: 3642b99073 (diff)
parentMerge "fuse_sideload: Change the minimal block size to 4096." am: 4e8e56eaea (diff)
downloadandroid_bootable_recovery-bfca876038d4100ed484420bcbd1124e2ac7ee82.tar
android_bootable_recovery-bfca876038d4100ed484420bcbd1124e2ac7ee82.tar.gz
android_bootable_recovery-bfca876038d4100ed484420bcbd1124e2ac7ee82.tar.bz2
android_bootable_recovery-bfca876038d4100ed484420bcbd1124e2ac7ee82.tar.lz
android_bootable_recovery-bfca876038d4100ed484420bcbd1124e2ac7ee82.tar.xz
android_bootable_recovery-bfca876038d4100ed484420bcbd1124e2ac7ee82.tar.zst
android_bootable_recovery-bfca876038d4100ed484420bcbd1124e2ac7ee82.zip
Diffstat (limited to 'tests')
-rw-r--r--tests/Android.mk1
-rw-r--r--tests/component/sideload_test.cpp19
2 files changed, 18 insertions, 2 deletions
diff --git a/tests/Android.mk b/tests/Android.mk
index 4e125ccce..02a240127 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -126,6 +126,7 @@ LOCAL_STATIC_LIBRARIES := \
libimgpatch \
libbsdiff \
libbspatch \
+ libfusesideload \
libotafault \
librecovery \
libupdater \
diff --git a/tests/component/sideload_test.cpp b/tests/component/sideload_test.cpp
index ea93e9b84..40cfc6975 100644
--- a/tests/component/sideload_test.cpp
+++ b/tests/component/sideload_test.cpp
@@ -13,9 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include <unistd.h>
+
#include <gtest/gtest.h>
-TEST(SideloadTest, fusedevice) {
- ASSERT_NE(-1, access("/dev/fuse", R_OK | W_OK));
+#include "fuse_sideload.h"
+
+TEST(SideloadTest, fuse_device) {
+ ASSERT_EQ(0, access("/dev/fuse", R_OK | W_OK));
+}
+
+TEST(SideloadTest, run_fuse_sideload_wrong_parameters) {
+ provider_vtab vtab;
+ vtab.close = [](void*) {};
+
+ ASSERT_EQ(-1, run_fuse_sideload(&vtab, nullptr, 4096, 4095));
+ ASSERT_EQ(-1, run_fuse_sideload(&vtab, nullptr, 4096, (1 << 22) + 1));
+
+ // Too many blocks.
+ ASSERT_EQ(-1, run_fuse_sideload(&vtab, nullptr, ((1 << 18) + 1) * 4096, 4096));
}