Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Fix build for UNIX
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Aug 26, 2011
1 parent 25175c7 commit 7cad73a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 5 deletions.
5 changes: 3 additions & 2 deletions include/uv-unix.h
Expand Up @@ -157,7 +157,8 @@ typedef int uv_file;
#define UV_PROCESS_PRIVATE_FIELDS \
ev_child child_watcher;

#define UV_FS_PRIVATE_FIELDS \
#define UV_WORK_PRIVATE_FIELDS \
#define UV_FS_PRIVATE_FIELDS

#define UV_WORK_PRIVATE_FIELDS

#endif /* UV_UNIX_H */
7 changes: 7 additions & 0 deletions src/uv-unix.c
Expand Up @@ -3116,3 +3116,10 @@ int uv_fs_fchown(uv_fs_t* req, uv_file file, int uid, int gid, uv_fs_cb cb) {
assert(0 && "implement me");
return -1;
}


int uv_queue_work(uv_work_t* req, uv_work_cb work_cb,
uv_after_work_cb after_work_cb) {
assert(0 && "implement me");
return -1;
}
46 changes: 43 additions & 3 deletions test/test-fs.c
Expand Up @@ -19,12 +19,19 @@
* IN THE SOFTWARE.
*/

/* FIXME we shouldnt need to branch in this file */
#define UNIX (defined(__unix__) || defined(__POSIX__) || defined(__APPLE__))

#include "uv.h"
#include "task.h"

#include <direct.h>
#if !UNIX
# include <direct.h>
# include <io.h>
#endif

#include <string.h> /* memset */
#include <fcntl.h>
#include <io.h>
#include <sys/stat.h>

static int close_cb_count;
Expand Down Expand Up @@ -233,8 +240,12 @@ TEST_IMPL(fs_file_async) {
int r;

/* Setup. */
#if UNIX
ASSERT(0 && "implement me");
#else
_unlink("test_file");
_unlink("test_file2");
#endif

uv_init();

Expand Down Expand Up @@ -282,9 +293,13 @@ TEST_IMPL(fs_file_async) {
ASSERT(write_cb_count == 1);
ASSERT(ftruncate_cb_count == 1);

#if UNIX
ASSERT(0 && "implement me");
#else
/* Cleanup. */
_unlink("test_file");
_unlink("test_file2");
#endif

return 0;
}
Expand All @@ -293,9 +308,13 @@ TEST_IMPL(fs_file_async) {
TEST_IMPL(fs_file_sync) {
int r;

#if UNIX
ASSERT(0 && "implement me");
#else
/* Setup. */
_unlink("test_file");
_unlink("test_file2");
#endif

uv_init();

Expand Down Expand Up @@ -363,8 +382,12 @@ TEST_IMPL(fs_file_sync) {
uv_fs_req_cleanup(&unlink_req);

/* Cleanup */
#if UNIX
ASSERT(0 && "implement me");
#else
_unlink("test_file");
_unlink("test_file2");
#endif

return 0;
}
Expand All @@ -374,9 +397,13 @@ TEST_IMPL(fs_async_dir) {
int r;

/* Setup */
#if UNIX
ASSERT(0 && "implement me");
#else
_unlink("test_dir/file1");
_unlink("test_dir/file2");
_rmdir("test_dir");
#endif

uv_init();

Expand Down Expand Up @@ -432,19 +459,27 @@ TEST_IMPL(fs_async_dir) {
ASSERT(rmdir_cb_count == 1);

/* Cleanup */
#if UNIX
ASSERT(0 && "implement me");
#else
_unlink("test_dir/file1");
_unlink("test_dir/file2");
_rmdir("test_dir");
#endif

return 0;
}


TEST_IMPL(fs_async_sendfile) {
int f, r;
struct _stat s1, s2;

/* Setup. */
#if UNIX
ASSERT(0 && "implement me");
#else
struct _stat s1, s2;

_unlink("test_file");
_unlink("test_file2");

Expand All @@ -462,6 +497,7 @@ TEST_IMPL(fs_async_sendfile) {

r = _close(f);
ASSERT(r == 0);
#endif

/* Test starts here. */
uv_init();
Expand Down Expand Up @@ -489,13 +525,17 @@ TEST_IMPL(fs_async_sendfile) {
ASSERT(r == 0);
uv_fs_req_cleanup(&close_req);

#if UNIX
ASSERT(0 && "implement me");
#else
_stat("test_file", &s1);
_stat("test_file2", &s2);
ASSERT(65548 == s2.st_size && s1.st_size == s2.st_size);

/* Cleanup. */
_unlink("test_file");
_unlink("test_file2");
#endif

return 0;
}

0 comments on commit 7cad73a

Please sign in to comment.