diff options
author | Matthias Hausner <hausner@google.com> | 2017-06-03 21:24:40 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-06-03 21:24:40 +0000 |
commit | 315220d71ebf64f574859661f5f4c7af11aadd8b (patch) | |
tree | 56774b9f79df4d11505f0510d3df19321465155b | |
parent | ea7ea472f1b72570c9e585ab0a6013054793e879 (diff) | |
parent | 7864cb749501acf3dd55525c74024e523bd45a6b (diff) | |
download | bionic-315220d71ebf64f574859661f5f4c7af11aadd8b.tar.gz |
bionic: tests: only test falloc_punch on ext4 am: 47a52109a4
am: 7864cb7495
Change-Id: I3f4ea6bd21e81902c1ea7a7053599dc3314e709d
-rw-r--r-- | tests/fcntl_test.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/fcntl_test.cpp b/tests/fcntl_test.cpp index 275a5dac7..74d367564 100644 --- a/tests/fcntl_test.cpp +++ b/tests/fcntl_test.cpp @@ -20,12 +20,14 @@ #include <fcntl.h> #include <string.h> #include <sys/utsname.h> +#include <sys/vfs.h> #include "TemporaryFile.h" // Glibc v2.19 doesn't include these in fcntl.h so host builds will fail without. #if !defined(FALLOC_FL_PUNCH_HOLE) || !defined(FALLOC_FL_KEEP_SIZE) #include <linux/falloc.h> +#include <linux/magic.h> #endif TEST(fcntl, fcntl_smoke) { @@ -287,7 +289,11 @@ TEST(fcntl, falloc_punch) { if (major < 4 || (major == 4 && minor < 1)) { TemporaryFile tf; - ASSERT_EQ(-1, fallocate(tf.fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1)); - ASSERT_EQ(errno, EOPNOTSUPP); + struct statfs sfs; + ASSERT_EQ(0, fstatfs(tf.fd, &sfs)); + if (sfs.f_type == EXT4_SUPER_MAGIC) { + ASSERT_EQ(-1, fallocate(tf.fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 1)); + ASSERT_EQ(errno, EOPNOTSUPP); + } } } |