Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: tests/syscalls/syscalls.cc

Issue 1065963002: Add utime implementation to libnacl (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/untrusted/nacl/utime.c ('K') | « src/untrusted/nacl/utime.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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", &times), -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;
}
« src/untrusted/nacl/utime.c ('K') | « src/untrusted/nacl/utime.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698