summaryrefslogtreecommitdiffstats
path: root/tests/component
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-05-04 02:04:08 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-05-04 02:04:08 +0200
commit6bea344d7e08e64f690920e7b3ea9b39de38643c (patch)
treee026e65ac724f21df9ca43697646ae3dcb0807a9 /tests/component
parentMerge "Remove EXPAND/STRINGIFY macros." am: b00c66faf7 (diff)
parentMerge "fuse_sideload: Change the minimal block size to 4096." (diff)
downloadandroid_bootable_recovery-6bea344d7e08e64f690920e7b3ea9b39de38643c.tar
android_bootable_recovery-6bea344d7e08e64f690920e7b3ea9b39de38643c.tar.gz
android_bootable_recovery-6bea344d7e08e64f690920e7b3ea9b39de38643c.tar.bz2
android_bootable_recovery-6bea344d7e08e64f690920e7b3ea9b39de38643c.tar.lz
android_bootable_recovery-6bea344d7e08e64f690920e7b3ea9b39de38643c.tar.xz
android_bootable_recovery-6bea344d7e08e64f690920e7b3ea9b39de38643c.tar.zst
android_bootable_recovery-6bea344d7e08e64f690920e7b3ea9b39de38643c.zip
Diffstat (limited to 'tests/component')
-rw-r--r--tests/component/sideload_test.cpp19
1 files changed, 17 insertions, 2 deletions
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));
}