| Index: tests/syscalls/syscalls.cc
|
| diff --git a/tests/syscalls/syscalls.cc b/tests/syscalls/syscalls.cc
|
| index ba2099d893b9c3ef2cab9f9cecb7a1e30df00265..3657bec932e40b78b89771f9e56d6124d095a920 100644
|
| --- a/tests/syscalls/syscalls.cc
|
| +++ b/tests/syscalls/syscalls.cc
|
| @@ -17,6 +17,7 @@
|
| #include <stdio.h>
|
| #include <string.h>
|
| #include <unistd.h>
|
| +#include <utime.h>
|
|
|
| #include "native_client/src/include/nacl_assert.h"
|
| #include "native_client/src/trusted/service_runtime/include/sys/nacl_syscalls.h"
|
| @@ -26,13 +27,16 @@
|
| #define TEXT_LINE_SIZE 1024
|
|
|
| /*
|
| - * TODO(sbc): remove this test once these declarations get added to the prebuilt
|
| + * TODO(sbc): remove this test once these declarations get added to the
|
| * newlib toolchain
|
| */
|
| #ifndef __GLIBC__
|
| -extern "C" int gethostname(char *name, size_t len);
|
| -extern "C" int utimes(const char *filename, const struct timeval times[2]);
|
| -extern "C" int eaccess(const char *pathname, int mode);
|
| +extern "C" {
|
| +int gethostname(char *name, size_t len);
|
| +int utimes(const char *filename, const struct timeval times[2]);
|
| +int utime(const char *filename, const struct utimbuf *times);
|
| +int eaccess(const char *pathname, int mode);
|
| +}
|
| #endif
|
|
|
| /*
|
| @@ -475,6 +479,23 @@ bool test_utimes(const char *test_file) {
|
| return passed("test_utimes", "all");
|
| }
|
|
|
| +bool test_utime(const char *test_file) {
|
| + // TODO(mseaborn): Implement utimes for unsandboxed mode.
|
| + if (NONSFI_MODE)
|
| + return true;
|
| + printf("test_utime");
|
| + struct utimbuf times;
|
| + times.actime = 0;
|
| + times.modtime = 0;
|
| + // utimes() is currently not implemented and should always
|
| + // fail with ENOSYS
|
| + printf("test_utime 2");
|
| +
|
| + ASSERT_EQ(utime("dummy", ×), -1);
|
| + ASSERT_EQ(errno, ENOSYS);
|
| + return passed("test_utime", "all");
|
| +}
|
| +
|
| bool test_truncate(const char *test_file) {
|
| char temp_file[PATH_MAX];
|
| snprintf(temp_file, PATH_MAX, "%s.tmp_truncate", test_file);
|
| @@ -1077,6 +1098,7 @@ bool testSuite(const char *test_file) {
|
| ret &= test_truncate(test_file);
|
| #endif
|
| ret &= test_utimes(test_file);
|
| + ret &= test_utime(test_file);
|
| return ret;
|
| }
|
|
|
|
|