OS X compatibility for testing tools.

This commit is contained in:
David Nadlinger
2011-04-17 06:42:37 +02:00
parent a121296bd3
commit 7b04f45d25
4 changed files with 24 additions and 15 deletions

View File

@@ -76,9 +76,9 @@ private{
extern(Windows) BOOL GetFileTime(HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime);
}else version(linux){
import std.c.linux.linux;
version = Unix;
}else version(Unix){
import std.c.unix.unix;
version = Posix;
}else version(Posix){
import std.c.posix.posix;
}else{
static assert(0);
}
@@ -116,7 +116,7 @@ private{
err:
CloseHandle(h);
throw new Exception("failed to query file modification : "~fileName);
}else version(Unix){
}else version(Posix){
char* namez = toStringz(fileName);
struct_stat statbuf;
@@ -124,7 +124,11 @@ err:
throw new FileException(fileName, getErrno());
}
return statbuf.st_mtime;
version(linux){
return statbuf.st_mtime;
}else version(OSX){
return statbuf.st_mtimespec.tv_sec;
}
}else{
static assert(0);
}

View File

@@ -77,9 +77,9 @@ private{
extern(Windows) BOOL GetFileTime(HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime);
}else version(linux){
import std.c.linux.linux;
version = Unix;
}else version(Unix){
import std.c.unix.unix;
version = Posix;
}else version(Posix){
import std.c.posix.posix;
}else{
static assert(0);
}
@@ -117,7 +117,7 @@ private{
err:
CloseHandle(h);
throw new Exception("failed to query file modification : "~fileName);
}else version(Unix){
}else version(Posix){
char* namez = toStringz(fileName);
struct_stat statbuf;
@@ -125,7 +125,12 @@ err:
throw new FileException(fileName, getErrno());
}
return statbuf.st_mtime;
version(linux){
return statbuf.st_mtime;
}else version(OSX){
return statbuf.st_mtimespec.tv_sec;
}
}else{
static assert(0);
}

View File

@@ -23,14 +23,14 @@ BASEPATH=`pwd`
cd dstress
# remove excessive tests
sed -e 's/torture-//g' -i Makefile
sed -e 's/torture-//g' -i '' Makefile
# make sure only .d files in 'run' tests are run
sed -e 's/find run -type f |/find run -type f -name "*\\\\.d" |/' -i Makefile
sed -e 's/find norun -type f |/find norun -type f -name "*\\\\.d" |/' -i Makefile
sed -e 's/find run -type f |/find run -type f -name "*\\\\.d" |/' -i '' Makefile
sed -e 's/find norun -type f |/find norun -type f -name "*\\\\.d" |/' -i '' Makefile
# impose more conservative constraints (10s and 256 MB)
sed -e 's/crashRun 30 1000/crashRun 10 256/' -i dstress.c
sed -e 's/crashRun 30 1000/crashRun 10 256/' -i '' dstress.c
echo
echo "Running new test and storing result in $TARGETFILE ..."

View File

@@ -72,7 +72,7 @@ tangobos.lib : $(LIB_TARGET)
$(LIB_TARGET) : $(ALL_OBJS)
$(RM) $(LIB_MASK)
$(LLVMLINK) -o=$(LIB_TARGET).bc `find -name "*.bc"`
$(LLVMLINK) -o=$(LIB_TARGET).bc `find . -name "*.bc"`
$(LLC) -o=$(LIB_TARGET).s $(LIB_TARGET).bc
$(CC) -c -o $(LIB_TARGET) $(LIB_TARGET).s