Ensure we have the off64_t variant of every function that takes an off_t.
Change-Id: Ib2eee0cf13162be3b62559b84e90c6dcf5aab1c3
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user