-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Directory lookup for test-runner on OS X #102
Comments
Cool, for the time being we can fix this by using |
Hmm, @teebrz there seems to be some discrepancies between what the header docs are asking for and the data I'm seeing come back. First, I've lightly instrumented dir.prototype.getDirs = function()
{
var ent;
var dname;
var dirs = [];
while (!ffi.isNullPtr(ent = c.readdir(this.handle)))
{
ent = c.dirent(ent);
dname = ent.d_name.toString();
+ print(">>>", dname, "<<<");
if (dname === '.' || dname === '..')
continue;
if (isDir(ent))
dirs.push(dname);
}
c.rewinddir(this.handle);
return dirs;
}; ... and created relevant typedef's: typedef unsigned long long __uint64_t;
typedef unsigned int __uint32_t;
typedef unsigned short __uint16_t;
typedef unsigned char __uint8_t; With the dirent struct for my OS/arch struct dirent __uint64_t d_fileno;
__uint16_t d_seekoff;
__uint16_t d_reclen;
__uint16_t d_namlen;
__uint8_t d_type;
char d_name[1024]; output
Removing the optional struct dirent __uint64_t d_fileno;
__uint16_t d_reclen;
__uint16_t d_namlen;
__uint8_t d_type;
char d_name[1024]; output
Giving things a try with the 32-bit setup, where struct dirent __uint32_t d_ino;
__uint16_t d_reclen;
__uint8_t d_namlen;
__uint8_t d_type;
char d_name[256];
The closest I was able to get was with a seemingly random definition: struct dirent __uint32_t d_ino;
__uint8_t d_reclen; // __uint16_t => __uint8_t
__uint8_t d_namlen;
__uint8_t d_type;
char d_name[256]; output
Finally... complete directory output, but padded with various ASCII chars in the 0-10'ish range. Any ideas on what could be going on here? |
Hm, not sure except it's some kind of issue with struct layout/alignment - the ffi is trying to read the struct incorrectly or the struct it gets back doesn't look like it expects it to or something like that. I'll take a look and see if I can find anything, thanks for looking into this. |
- added TestDirEnt dec to ffitests.d - added $ir_eq_i64 - added regression tests for issue higgsjs#102
The test-runner is failing when looking up test directories. This appears to be another OS-related problem; this time with
readdir
/dirent
.On Darwin, the struct's used to store the directory entries differ from their Linux counterparts:
The text was updated successfully, but these errors were encountered: