Ensure we have the off64_t variant of every function that takes an off_t.

Change-Id: Ib2eee0cf13162be3b62559b84e90c6dcf5aab1c3
This commit is contained in:
Elliott Hughes
2013-09-19 16:27:24 -07:00
parent f8e71bac14
commit b4f7616fd6
18 changed files with 298 additions and 12 deletions

View File

@@ -15,6 +15,7 @@
*/
#include <gtest/gtest.h>
#include "TemporaryFile.h"
#include <stdint.h>
#include <unistd.h>
@@ -32,3 +33,43 @@ TEST(unistd, sbrk) {
void* final_break = sbrk(0);
ASSERT_EQ(final_break, new_break);
}
TEST(unistd, truncate) {
TemporaryFile tf;
ASSERT_EQ(0, close(tf.fd));
ASSERT_EQ(0, truncate(tf.filename, 123));
struct stat sb;
ASSERT_EQ(0, stat(tf.filename, &sb));
ASSERT_EQ(123, sb.st_size);
}
TEST(unistd, truncate64) {
TemporaryFile tf;
ASSERT_EQ(0, close(tf.fd));
ASSERT_EQ(0, truncate64(tf.filename, 123));
struct stat sb;
ASSERT_EQ(0, stat(tf.filename, &sb));
ASSERT_EQ(123, sb.st_size);
}
TEST(unistd, ftruncate) {
TemporaryFile tf;
ASSERT_EQ(0, ftruncate(tf.fd, 123));
ASSERT_EQ(0, close(tf.fd));
struct stat sb;
ASSERT_EQ(0, stat(tf.filename, &sb));
ASSERT_EQ(123, sb.st_size);
}
TEST(unistd, ftruncate64) {
TemporaryFile tf;
ASSERT_EQ(0, ftruncate64(tf.fd, 123));
ASSERT_EQ(0, close(tf.fd));
struct stat sb;
ASSERT_EQ(0, stat(tf.filename, &sb));
ASSERT_EQ(123, sb.st_size);
}