summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pr/tests/Makefile.in59
-rw-r--r--pr/tests/accept.c1
-rw-r--r--pr/tests/acceptread.c3
-rw-r--r--pr/tests/acceptreademu.c3
-rw-r--r--pr/tests/addrstr.c3
-rw-r--r--pr/tests/affinity.c1
-rw-r--r--pr/tests/alarm.c1
-rw-r--r--pr/tests/anonfm.c3
-rw-r--r--pr/tests/append.c3
-rw-r--r--pr/tests/atomic.c3
-rw-r--r--pr/tests/attach.c1
-rw-r--r--pr/tests/bigfile.c3
-rw-r--r--pr/tests/bigfile2.c8
-rw-r--r--pr/tests/bigfile3.c8
-rw-r--r--pr/tests/bug1test.c3
-rw-r--r--pr/tests/cleanup.c3
-rw-r--r--pr/tests/cltsrv.c3
-rw-r--r--pr/tests/concur.c3
-rw-r--r--pr/tests/cvar.c3
-rw-r--r--pr/tests/cvar2.c3
-rw-r--r--pr/tests/dbmalloc.c8
-rw-r--r--pr/tests/dbmalloc1.c8
-rw-r--r--pr/tests/dceemu.c7
-rw-r--r--pr/tests/depend.c1
-rw-r--r--pr/tests/dlltest.c1
-rw-r--r--pr/tests/dtoa.c3
-rw-r--r--pr/tests/env.c3
-rw-r--r--pr/tests/errcodes.c4
-rw-r--r--pr/tests/errset.c4
-rw-r--r--pr/tests/exit.c3
-rw-r--r--pr/tests/fdcach.c1
-rw-r--r--pr/tests/fileio.c1
-rw-r--r--pr/tests/foreign.c9
-rw-r--r--pr/tests/forktest.c6
-rw-r--r--pr/tests/formattm.c3
-rw-r--r--pr/tests/freeif.c3
-rw-r--r--pr/tests/fsync.c3
-rw-r--r--pr/tests/getai.c3
-rw-r--r--pr/tests/gethost.c1
-rw-r--r--pr/tests/getproto.c3
-rw-r--r--pr/tests/i2l.c3
-rw-r--r--pr/tests/initclk.c3
-rw-r--r--pr/tests/inrval.c3
-rw-r--r--pr/tests/instrumt.c3
-rw-r--r--pr/tests/intrio.c3
-rw-r--r--pr/tests/intrupt.c3
-rw-r--r--pr/tests/io_timeout.c1
-rw-r--r--pr/tests/io_timeoutk.c1
-rw-r--r--pr/tests/io_timeoutu.c1
-rw-r--r--pr/tests/ioconthr.c1
-rw-r--r--pr/tests/ipv6.c3
-rw-r--r--pr/tests/join.c3
-rw-r--r--pr/tests/joinkk.c3
-rw-r--r--pr/tests/joinku.c3
-rw-r--r--pr/tests/joinuk.c3
-rw-r--r--pr/tests/joinuu.c3
-rw-r--r--pr/tests/layer.c3
-rw-r--r--pr/tests/lazyinit.c3
-rw-r--r--pr/tests/libfilename.c3
-rw-r--r--pr/tests/lltest.c3
-rw-r--r--pr/tests/lock.c1
-rw-r--r--pr/tests/lockfile.c1
-rw-r--r--pr/tests/logger.c3
-rw-r--r--pr/tests/makedir.c3
-rw-r--r--pr/tests/many_cv.c9
-rw-r--r--pr/tests/mbcs.c3
-rw-r--r--pr/tests/multiacc.c1
-rw-r--r--pr/tests/multiwait.c3
-rw-r--r--pr/tests/nameshm1.c3
-rw-r--r--pr/tests/nbconn.c1
-rw-r--r--pr/tests/nblayer.c3
-rw-r--r--pr/tests/nonblock.c3
-rw-r--r--pr/tests/nst_wince.h115
-rw-r--r--pr/tests/ntioto.c3
-rw-r--r--pr/tests/ntoh.c3
-rw-r--r--pr/tests/obsints.c5
-rw-r--r--pr/tests/op_2long.c1
-rw-r--r--pr/tests/op_excl.c3
-rw-r--r--pr/tests/op_filnf.c1
-rw-r--r--pr/tests/op_filok.c1
-rw-r--r--pr/tests/op_noacc.c1
-rw-r--r--pr/tests/op_nofil.c1
-rw-r--r--pr/tests/openfile.c3
-rw-r--r--pr/tests/parent.c3
-rw-r--r--pr/tests/peek.c1
-rw-r--r--pr/tests/perf.c1
-rw-r--r--pr/tests/pipeping.c3
-rw-r--r--pr/tests/pipeping2.c3
-rw-r--r--pr/tests/pipepong.c3
-rw-r--r--pr/tests/pipepong2.c3
-rw-r--r--pr/tests/pipeself.c3
-rwxr-xr-xpr/tests/poll_er.c1
-rw-r--r--pr/tests/poll_nm.c2
-rw-r--r--pr/tests/poll_to.c2
-rw-r--r--pr/tests/pollable.c1
-rw-r--r--pr/tests/prftest.c4
-rw-r--r--pr/tests/prftest1.c3
-rw-r--r--pr/tests/prftest2.c3
-rw-r--r--pr/tests/primblok.c6
-rw-r--r--pr/tests/priotest.c3
-rw-r--r--pr/tests/provider.c3
-rw-r--r--pr/tests/prpoll.c15
-rw-r--r--pr/tests/prpollml.c1
-rw-r--r--pr/tests/prselect.c1
-rw-r--r--pr/tests/randseed.c3
-rw-r--r--pr/tests/ranfile.c17
-rw-r--r--pr/tests/rmdir.c3
-rw-r--r--pr/tests/rwlocktest.c3
-rw-r--r--pr/tests/sel_spd.c1
-rwxr-xr-xpr/tests/selct_er.c1
-rw-r--r--pr/tests/selct_nm.c1
-rw-r--r--pr/tests/selct_to.c1
-rw-r--r--pr/tests/select2.c3
-rw-r--r--pr/tests/selintr.c3
-rw-r--r--pr/tests/sem.c1
-rw-r--r--pr/tests/sema.c1
-rw-r--r--pr/tests/semaerr.c1
-rw-r--r--pr/tests/semaerr1.c1
-rw-r--r--pr/tests/semaping.c1
-rw-r--r--pr/tests/semapong.c1
-rw-r--r--pr/tests/sendzlf.c3
-rw-r--r--pr/tests/server_test.c3
-rw-r--r--pr/tests/servr_kk.c1
-rw-r--r--pr/tests/servr_ku.c3
-rw-r--r--pr/tests/servr_uk.c3
-rw-r--r--pr/tests/servr_uu.c3
-rw-r--r--pr/tests/short_thread.c1
-rw-r--r--pr/tests/sigpipe.c3
-rw-r--r--pr/tests/sleep.c3
-rw-r--r--pr/tests/socket.c7
-rw-r--r--pr/tests/sockopt.c4
-rw-r--r--pr/tests/sockping.c3
-rw-r--r--pr/tests/sockpong.c3
-rw-r--r--pr/tests/sprintf.c1
-rw-r--r--pr/tests/sproc_ch.c3
-rw-r--r--pr/tests/sproc_p.c3
-rw-r--r--pr/tests/stack.c3
-rw-r--r--pr/tests/stat.c3
-rw-r--r--pr/tests/stdio.c1
-rw-r--r--pr/tests/str2addr.c1
-rw-r--r--pr/tests/strod.c3
-rw-r--r--pr/tests/suspend.c5
-rw-r--r--pr/tests/switch.c3
-rw-r--r--pr/tests/system.c3
-rw-r--r--pr/tests/testbit.c3
-rw-r--r--pr/tests/testfile.c43
-rw-r--r--pr/tests/threads.c1
-rw-r--r--pr/tests/thrpool_client.c5
-rw-r--r--pr/tests/thrpool_server.c9
-rw-r--r--pr/tests/thruput.c4
-rw-r--r--pr/tests/time.c3
-rw-r--r--pr/tests/timemac.c1
-rw-r--r--pr/tests/timetest.c1
-rw-r--r--pr/tests/tmoacc.c1
-rw-r--r--pr/tests/tmocon.c5
-rw-r--r--pr/tests/tpd.c3
-rw-r--r--pr/tests/udpsrv.c1
-rw-r--r--pr/tests/vercheck.c3
-rw-r--r--pr/tests/version.c3
-rw-r--r--pr/tests/wince_tester.cpp321
-rw-r--r--pr/tests/writev.c1
-rw-r--r--pr/tests/xnotify.c3
-rw-r--r--pr/tests/y2k.c1
-rw-r--r--pr/tests/y2ktmo.c47
-rw-r--r--pr/tests/yield.c3
-rw-r--r--pr/tests/zerolen.c3
166 files changed, 901 insertions, 156 deletions
diff --git a/pr/tests/Makefile.in b/pr/tests/Makefile.in
index c55acf23..95c32f48 100644
--- a/pr/tests/Makefile.in
+++ b/pr/tests/Makefile.in
@@ -203,6 +203,12 @@ CSRCS = \
zerolen.c \
$(NULL)
+ifeq ($(OS_ARCH),WINCE)
+TESTPROGS = \
+ wince_tester.cpp \
+ $(NULL)
+endif
+
ifeq ($(OS_TARGET),OS2)
CSRCS += \
sleep.c \
@@ -211,13 +217,19 @@ CSRCS += \
$(NULL)
endif
-ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
+ifeq (,$(filter-out WINCE WINNT OS2,$(OS_ARCH)))
PROG_SUFFIX = .exe
+DLL_SUFFIX = .dll
else
PROG_SUFFIX =
+DLL_SUFFIX =
endif
+ifeq ($(OS_ARCH),WINCE)
+PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(DLL_SUFFIX))) $(addprefix $(OBJDIR)/, $(TESTPROGS:.cpp=$(PROG_SUFFIX)))
+else
PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
+endif
TARGETS = $(PROGS)
@@ -229,10 +241,29 @@ ifdef NS_USE_GCC
else
EXTRA_LIBS += wsock32.lib
LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
- ifdef PROFILE
+ ifdef PROFILE
+ LDOPTS += -PROFILE -MAP
+ endif # profile
+endif # NS_USE_GCC
+endif
+
+ifeq ($(OS_ARCH),WINCE)
+ifdef NS_USE_GCC
+ EXTRA_LIBS += -lwsock32
+else
+ EXTRA_LIBS += ws2.lib coredll.lib
+ LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO -PDB:$(@:.dll=.pdb)
+ # NOTE: Need this to have a proper WinCE entry into main(argc, argv)
+# EXE_EXTRA_LDOPTS = -SUBSYSTEM:CONSOLE -ENTRY:mainCRTStartup
+ EXE_EXTRA_LDOPTS = -SUBSYSTEM:CONSOLE
+ ifdef PROFILE
LDOPTS += -PROFILE -MAP
endif # profile
endif # NS_USE_GCC
+
+# Use CC to compile all CPP files / also use all CC flags
+CCC = $(CC)
+CXXFLAGS = $(CFLAGS)
endif
ifeq ($(OS_ARCH),OS2)
@@ -486,10 +517,34 @@ ifdef MT
fi
endif
else
+ifeq ($(OS_ARCH),WINCE)
+ $(PURE) $(LD) $(XCFLAGS) $< $(LDOPTS:.exe=.pdb) $(EXE_EXTRA_LDOPTS) $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -OUT:$@
+else
$(PURE) $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -o $@
+endif # wince
endif # WINNT
endif # AIX_PRE_4_2
+
+ifeq ($(OS_ARCH),WINCE)
+# WinCE HAS to be different. Turns out that the OS swallows crashes
+# and returns a result code of zero -- an indication of success for
+# the shell script. AND, WinCE does not really have a good shell
+# to use for testing, anyway.
+#
+# To combat both issues, we need to build the tests as stand-alone
+# DLLs, then dynamically load the DLLs one at a time inside a test
+# program. Each DLL's test will be run inside a TRY/CATCH construct,
+# allowing the testing program to do what the shell script already
+# does naturally.
+#
+# This section builds DLLs instead of EXEs for each of the tests.
+# - wolfe@lobo.us
+$(OBJDIR)/%$(DLL_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
+ @$(MAKE_OBJDIR)
+ $(PURE) $(LD) $(XCFLAGS) $(LDOPTS) $(LIBPLC) $(LIBNSPR) $(EXTRA_LIBS) -DLL -OUT:$@ $<
+endif # wince
+
export:: $(TARGETS)
clean::
rm -f $(TARGETS)
diff --git a/pr/tests/accept.c b/pr/tests/accept.c
index 4fada1aa..e988b6ab 100644
--- a/pr/tests/accept.c
+++ b/pr/tests/accept.c
@@ -63,6 +63,7 @@
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#include "plgetopt.h"
#include "plerror.h"
diff --git a/pr/tests/acceptread.c b/pr/tests/acceptread.c
index ceb445d0..19f7e1db 100644
--- a/pr/tests/acceptread.c
+++ b/pr/tests/acceptread.c
@@ -45,6 +45,7 @@
#include <plerror.h>
#include <stdlib.h>
+#include "nst_wince.h"
#define DEFAULT_PORT 12273
#define GET "GET / HTTP/1.0\n\n"
@@ -182,7 +183,7 @@ static void AcceptingThread(void *arg)
PL_FPrintError(err_out, "PR_Close (server) failed");
} /* AcceptingThread */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRHostEnt he;
PRStatus status;
diff --git a/pr/tests/acceptreademu.c b/pr/tests/acceptreademu.c
index 8d17f31a..40362b51 100644
--- a/pr/tests/acceptreademu.c
+++ b/pr/tests/acceptreademu.c
@@ -51,6 +51,7 @@
#include <plerror.h>
#include <stdlib.h>
+#include "nst_wince.h"
#define DEFAULT_PORT 12273
#define GET "GET / HTTP/1.0\n\n"
@@ -209,7 +210,7 @@ static void AcceptingThread(void *arg)
PL_FPrintError(err_out, "PR_Close (server) failed");
} /* AcceptingThread */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRHostEnt he;
PRStatus status;
diff --git a/pr/tests/addrstr.c b/pr/tests/addrstr.c
index a18f9a8c..c6633b96 100644
--- a/pr/tests/addrstr.c
+++ b/pr/tests/addrstr.c
@@ -40,6 +40,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
const char *testaddrs[] = {
"::", "::",
@@ -71,7 +72,7 @@ const char *badaddrs[] = {
int failed_already = 0;
-int main()
+int main(int argc, char **argv)
{
const char **nexttestaddr = testaddrs;
const char **nextbadaddr = badaddrs;
diff --git a/pr/tests/affinity.c b/pr/tests/affinity.c
index 46f159bf..f24d8e80 100644
--- a/pr/tests/affinity.c
+++ b/pr/tests/affinity.c
@@ -42,6 +42,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifndef XP_BEOS
diff --git a/pr/tests/alarm.c b/pr/tests/alarm.c
index 7af2ed4c..04a44716 100644
--- a/pr/tests/alarm.c
+++ b/pr/tests/alarm.c
@@ -73,6 +73,7 @@
#include "plgetopt.h"
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
#if defined(XP_UNIX)
#include <sys/time.h>
diff --git a/pr/tests/anonfm.c b/pr/tests/anonfm.c
index aeab86b1..bb3da4c5 100644
--- a/pr/tests/anonfm.c
+++ b/pr/tests/anonfm.c
@@ -66,6 +66,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
/*
** Test harness infrastructure
@@ -287,7 +288,7 @@ static void ServerTwo( void )
} /* end ServerTwo() */
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
{
/*
diff --git a/pr/tests/append.c b/pr/tests/append.c
index 3800e2fb..cc07ba54 100644
--- a/pr/tests/append.c
+++ b/pr/tests/append.c
@@ -54,6 +54,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
PRIntn debug = 0;
PRIntn verbose = 0;
@@ -62,7 +63,7 @@ const PRInt32 addedBytes = 1000;
const PRInt32 buf = 1; /* constant written to fd, addedBytes times */
PRInt32 inBuf; /* read it back into here */
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
PRStatus rc;
PRInt32 rv;
diff --git a/pr/tests/atomic.c b/pr/tests/atomic.c
index 5970fe0c..a3676bf3 100644
--- a/pr/tests/atomic.c
+++ b/pr/tests/atomic.c
@@ -38,6 +38,7 @@
#include "prio.h"
#include "prprf.h"
#include "pratom.h"
+#include "nst_wince.h"
/*
* TODO: create a macro to generate the six lines of code that are repeated
@@ -47,7 +48,7 @@
* result |= !(EXPRESSION);
*/
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRInt32 rv, oldval, test, result = 0;
PRFileDesc *output = PR_GetSpecialFD(PR_StandardOutput);
diff --git a/pr/tests/attach.c b/pr/tests/attach.c
index 2eaefdca..cb9a5fc2 100644
--- a/pr/tests/attach.c
+++ b/pr/tests/attach.c
@@ -87,6 +87,7 @@
#elif defined(XP_BEOS)
#include <kernel/OS.h>
#endif
+#include "nst_wince.h"
#define DEFAULT_COUNT 1000
PRIntn failed_already=0;
diff --git a/pr/tests/bigfile.c b/pr/tests/bigfile.c
index 19c0a7f9..1a6416c2 100644
--- a/pr/tests/bigfile.c
+++ b/pr/tests/bigfile.c
@@ -44,6 +44,7 @@
#include "plerror.h"
#include "plgetopt.h"
+#include "nst_wince.h"
#define DEFAULT_COUNT 10
#define DEFAULT_FILESIZE 1
@@ -129,7 +130,7 @@ static void PrintInfo(PRFileInfo64 *info, const char *filename)
output, " creation: %s,\n modify: %s\n", ctime, mtime);
} /* PrintInfo */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRStatus rv;
char *buffer;
diff --git a/pr/tests/bigfile2.c b/pr/tests/bigfile2.c
index 3e8beeeb..9b6d4f33 100644
--- a/pr/tests/bigfile2.c
+++ b/pr/tests/bigfile2.c
@@ -43,8 +43,14 @@
#ifdef _WIN32
#include <windows.h>
#endif
+#include "nst_wince.h"
#define TEST_FILE_NAME "bigfile2.txt"
+#ifdef WINCE
+#define TEST_FILE_NAME_FOR_CREATEFILE L"bigfile2.txt"
+#else
+#define TEST_FILE_NAME_FOR_CREATEFILE TEST_FILE_NAME
+#endif
#define MESSAGE "Hello world!"
#define MESSAGE_SIZE 13
@@ -89,7 +95,7 @@ int main(int argc, char **argv)
memset(buf, 0, sizeof(buf));
#ifdef _WIN32
- hFile = CreateFile(TEST_FILE_NAME, GENERIC_READ, 0, NULL,
+ hFile = CreateFile(TEST_FILE_NAME_FOR_CREATEFILE, GENERIC_READ, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
fprintf(stderr, "CreateFile failed\n");
diff --git a/pr/tests/bigfile3.c b/pr/tests/bigfile3.c
index 3cb806ff..bd4ecd7f 100644
--- a/pr/tests/bigfile3.c
+++ b/pr/tests/bigfile3.c
@@ -43,8 +43,14 @@
#ifdef _WIN32
#include <windows.h>
#endif
+#include "nst_wince.h"
#define TEST_FILE_NAME "bigfile3.txt"
+#ifdef WINCE
+#define TEST_FILE_NAME_FOR_CREATEFILE L"bigfile3.txt"
+#else
+#define TEST_FILE_NAME_FOR_CREATEFILE TEST_FILE_NAME
+#endif
#define MESSAGE "Hello world!"
#define MESSAGE_SIZE 13
@@ -64,7 +70,7 @@ int main(int argc, char **argv)
LL_SHL(offset, offset, 32);
#ifdef _WIN32
- hFile = CreateFile(TEST_FILE_NAME, GENERIC_WRITE, 0, NULL,
+ hFile = CreateFile(TEST_FILE_NAME_FOR_CREATEFILE, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE) {
fprintf(stderr, "CreateFile failed\n");
diff --git a/pr/tests/bug1test.c b/pr/tests/bug1test.c
index fa7d591f..655a8928 100644
--- a/pr/tests/bug1test.c
+++ b/pr/tests/bug1test.c
@@ -46,6 +46,7 @@ before leaving the critical section in _PR_CondWait in hwmon.c).
#include "prinit.h"
#include "prmon.h"
#include "prlog.h"
+#include "nst_wince.h"
typedef struct Arg_s
{
@@ -246,7 +247,7 @@ static void padStack (int argc, char** argv)
pseudoMain (argc, argv, pad);
}
-void main (int argc, char **argv)
+int main(int argc, char **argv)
{
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
diff --git a/pr/tests/cleanup.c b/pr/tests/cleanup.c
index e94979e9..0c493cb6 100644
--- a/pr/tests/cleanup.c
+++ b/pr/tests/cleanup.c
@@ -44,6 +44,7 @@
#include "plgetopt.h"
#include <stdlib.h>
+#include "nst_wince.h"
static void PR_CALLBACK Thread(void *sleep)
{
@@ -64,7 +65,7 @@ static void Help(void)
PR_fprintf(err, "\t-h This message and nothing else\n");
} /* Help */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PLOptStatus os;
PRBool cleanup = PR_FALSE;
diff --git a/pr/tests/cltsrv.c b/pr/tests/cltsrv.c
index e1f82939..aad0c6bf 100644
--- a/pr/tests/cltsrv.c
+++ b/pr/tests/cltsrv.c
@@ -82,6 +82,7 @@
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#if defined(XP_UNIX)
#include <math.h>
@@ -921,7 +922,7 @@ static Verbosity IncrementVerbosity(void)
return (Verbosity)verboge;
} /* IncrementVerbosity */
-PRIntn main(PRIntn argc, char** argv)
+int main(int argc, char** argv)
{
PRUintn index;
PRBool boolean;
diff --git a/pr/tests/concur.c b/pr/tests/concur.c
index 225b2d28..812f7457 100644
--- a/pr/tests/concur.c
+++ b/pr/tests/concur.c
@@ -57,6 +57,7 @@
#endif
#include <stdlib.h>
+#include "nst_wince.h"
#define DEFAULT_RANGE 10
#define DEFAULT_LOOPS 100
@@ -184,7 +185,7 @@ PRIntn PR_CALLBACK Concur(PRIntn argc, char **argv)
return 0;
} /* Concur */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PR_STDIO_INIT();
return PR_Initialize(Concur, argc, argv, 0);
diff --git a/pr/tests/cvar.c b/pr/tests/cvar.c
index 32d9f1be..a8f63f01 100644
--- a/pr/tests/cvar.c
+++ b/pr/tests/cvar.c
@@ -65,6 +65,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
@@ -324,7 +325,7 @@ static PRIntn PR_CALLBACK RealMain(int argc, char **argv)
}
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char *argv[])
{
PRIntn rv;
diff --git a/pr/tests/cvar2.c b/pr/tests/cvar2.c
index 4b01cb4b..dcc67baa 100644
--- a/pr/tests/cvar2.c
+++ b/pr/tests/cvar2.c
@@ -60,6 +60,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
int _debug_on = 0;
#define DPRINTF(arg) if (_debug_on) printf arg
@@ -998,7 +999,7 @@ default_threads, default_threads*2, default_threads*3, default_threads*4);
return 0;
}
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
PRIntn rv;
diff --git a/pr/tests/dbmalloc.c b/pr/tests/dbmalloc.c
index 4295d0c0..0fb84bfb 100644
--- a/pr/tests/dbmalloc.c
+++ b/pr/tests/dbmalloc.c
@@ -53,6 +53,7 @@
#include <time.h>
#include <string.h>
#include "nspr.h"
+#include "nst_wince.h"
void
usage
@@ -235,12 +236,7 @@ test
return;
}
-int
-main
-(
- int argc,
- char *argv[]
-)
+int main(int argc, char **argv)
{
int okay = 0;
int multithread = 0;
diff --git a/pr/tests/dbmalloc1.c b/pr/tests/dbmalloc1.c
index ca1b4cb1..a13b35a2 100644
--- a/pr/tests/dbmalloc1.c
+++ b/pr/tests/dbmalloc1.c
@@ -60,6 +60,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "nspr.h"
+#include "nst_wince.h"
PRIntn failed_already=0;
PRIntn debug_mode;
@@ -117,12 +118,7 @@ r2
}
}
-int
-main
-(
- int argc,
- char *argv[]
-)
+int main(int argc, char **argv)
{
/* main test */
diff --git a/pr/tests/dceemu.c b/pr/tests/dceemu.c
index bc037c83..c713a9be 100644
--- a/pr/tests/dceemu.c
+++ b/pr/tests/dceemu.c
@@ -54,15 +54,16 @@
** Includes
***********************************************************************/
-
-#if defined(_PR_DCETHREADS)
-
#include "prlog.h"
#include "prinit.h"
#include "prpdce.h"
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
+
+#if defined(_PR_DCETHREADS)
+
PRIntn failed_already=0;
PRIntn debug_mode=0;
diff --git a/pr/tests/depend.c b/pr/tests/depend.c
index e3fb691e..b83bfc07 100644
--- a/pr/tests/depend.c
+++ b/pr/tests/depend.c
@@ -59,6 +59,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
static void PrintVersion(
const char *msg, const PRVersion* info, PRIntn tab)
diff --git a/pr/tests/dlltest.c b/pr/tests/dlltest.c
index f8a5f53b..40f4f9d8 100644
--- a/pr/tests/dlltest.c
+++ b/pr/tests/dlltest.c
@@ -64,6 +64,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
typedef PRIntn (PR_CALLBACK *GetFcnType)(void);
typedef void (PR_CALLBACK *SetFcnType)(PRIntn);
diff --git a/pr/tests/dtoa.c b/pr/tests/dtoa.c
index a9258c02..5b26d863 100644
--- a/pr/tests/dtoa.c
+++ b/pr/tests/dtoa.c
@@ -52,10 +52,11 @@
#include <locale.h>
#include "prprf.h"
#include "prdtoa.h"
+#include "nst_wince.h"
static int failed_already = 0;
-int main( int argc, char* argv[] )
+int main(int argc, char **argv)
{
double num;
double num1;
diff --git a/pr/tests/env.c b/pr/tests/env.c
index ff2ba937..ccbc20cc 100644
--- a/pr/tests/env.c
+++ b/pr/tests/env.c
@@ -46,6 +46,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
PRIntn debug = 0;
PRIntn verbose = 0;
@@ -67,7 +68,7 @@ static char * NewBuffer( size_t size )
return(buf);
} /* end NewBuffer() */
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
char *value;
PRStatus rc;
diff --git a/pr/tests/errcodes.c b/pr/tests/errcodes.c
index 76156848..044756c1 100644
--- a/pr/tests/errcodes.c
+++ b/pr/tests/errcodes.c
@@ -46,6 +46,7 @@
#include "plgetopt.h"
#include <stdio.h>
+#include "nst_wince.h"
static int _debug_on = 0;
@@ -130,8 +131,7 @@ struct errinfo errcodes[] = {
{PR_HOST_UNREACHABLE_ERROR, "PR_HOST_UNREACHABLE_ERROR"}
};
-int
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
int count, errnum;
diff --git a/pr/tests/errset.c b/pr/tests/errset.c
index 7d025f12..c0145dd0 100644
--- a/pr/tests/errset.c
+++ b/pr/tests/errset.c
@@ -53,6 +53,7 @@
#include <stdio.h>
#include <string.h>
+#include "nst_wince.h"
static int _debug_on = 0;
@@ -138,8 +139,7 @@ struct errinfo errcodes[] = {
{PR_HOST_UNREACHABLE_ERROR, "PR_HOST_UNREACHABLE_ERROR"}
};
-int
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
int count, errnum;
diff --git a/pr/tests/exit.c b/pr/tests/exit.c
index 6ccbe86d..d378c0c9 100644
--- a/pr/tests/exit.c
+++ b/pr/tests/exit.c
@@ -45,6 +45,7 @@
#include "plgetopt.h"
#include <stdlib.h>
+#include "nst_wince.h"
static PRInt32 dally = 0;
static PRFileDesc *err = NULL;
@@ -127,7 +128,7 @@ static PRIntn PR_CALLBACK RealMain(PRIntn argc, char **argv)
}
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
PRIntn rv;
diff --git a/pr/tests/fdcach.c b/pr/tests/fdcach.c
index 33382fa8..5a9dce3c 100644
--- a/pr/tests/fdcach.c
+++ b/pr/tests/fdcach.c
@@ -46,6 +46,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
/*
* Define ORDER_PRESERVED if the implementation of PR_SetFDCacheSize
diff --git a/pr/tests/fileio.c b/pr/tests/fileio.c
index 0b154047..4d7c3dde 100644
--- a/pr/tests/fileio.c
+++ b/pr/tests/fileio.c
@@ -65,6 +65,7 @@
#include "prlog.h"
#include <stdio.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prsem.h"
diff --git a/pr/tests/foreign.c b/pr/tests/foreign.c
index 2921cd9d..a26e4bbf 100644
--- a/pr/tests/foreign.c
+++ b/pr/tests/foreign.c
@@ -64,6 +64,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
static enum {
thread_nspr, thread_pthread, thread_sproc, thread_win32
@@ -124,7 +125,7 @@ static PRUintn __stdcall windows_start(void *arg)
} /* windows_start */
#endif /* defined(WIN32) */
-static PRStatus CreateThread(StartFn start, void *arg)
+static PRStatus NSPRPUB_TESTS_CreateThread(StartFn start, void *arg)
{
PRStatus rv;
@@ -218,7 +219,7 @@ static PRStatus CreateThread(StartFn start, void *arg)
rv = PR_FAILURE;
}
return rv;
-} /* CreateThread */
+} /* NSPRPUB_TESTS_CreateThread */
static void PR_CALLBACK lazyEntry(void *arg)
{
@@ -325,7 +326,7 @@ static void OneShot(void *arg)
}
} /* OneShot */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRStatus rv;
PRInt32 thread_cnt = DEFAULT_THREAD_COUNT;
@@ -366,7 +367,7 @@ PRIntn main(PRIntn argc, char **argv)
while (thread_cnt-- > 0)
{
- rv = CreateThread(OneShot, (void*)thread_cnt);
+ rv = NSPRPUB_TESTS_CreateThread(OneShot, (void*)thread_cnt);
PR_ASSERT(PR_SUCCESS == rv);
PR_Sleep(PR_MillisecondsToInterval(5));
}
diff --git a/pr/tests/forktest.c b/pr/tests/forktest.c
index ad260ad7..4b222d84 100644
--- a/pr/tests/forktest.c
+++ b/pr/tests/forktest.c
@@ -62,6 +62,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
PRIntn failed_already=0;
@@ -273,10 +274,7 @@ pid_t PR_UnixFork1(void)
#endif /* PR_DCETHREADS */
-int main(
-int argc,
-char *argv[]
-)
+int main(int argc, char **argv)
{
pid_t pid;
int rv;
diff --git a/pr/tests/formattm.c b/pr/tests/formattm.c
index 8b04cd37..42a5c711 100644
--- a/pr/tests/formattm.c
+++ b/pr/tests/formattm.c
@@ -40,8 +40,9 @@
#include "prtime.h"
#include <stdio.h>
+#include "nst_wince.h"
-int main()
+int main(int argc, char **argv)
{
char buffer[256];
char small_buffer[8];
diff --git a/pr/tests/freeif.c b/pr/tests/freeif.c
index 7aa16b49..4a5c861d 100644
--- a/pr/tests/freeif.c
+++ b/pr/tests/freeif.c
@@ -44,6 +44,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
static void Noop(void) { }
@@ -53,7 +54,7 @@ static void Fail(void)
exit(1);
}
-int main()
+int main(int argc, char **argv)
{
int foo = 1;
char *ptr = NULL;
diff --git a/pr/tests/fsync.c b/pr/tests/fsync.c
index cea298b3..eda5b1fc 100644
--- a/pr/tests/fsync.c
+++ b/pr/tests/fsync.c
@@ -42,6 +42,7 @@
#include "plerror.h"
#include "plgetopt.h"
+#include "nst_wince.h"
static PRFileDesc *err = NULL;
@@ -55,7 +56,7 @@ static void Help(void)
PR_fprintf(err, "\t-h This message and nothing else\n");
} /* Help */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRStatus rv;
PLOptStatus os;
diff --git a/pr/tests/getai.c b/pr/tests/getai.c
index bc4a59a7..adc352ff 100644
--- a/pr/tests/getai.c
+++ b/pr/tests/getai.c
@@ -39,8 +39,9 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
-int main(int argc, char *argv[])
+int main(int argc, char **argv)
{
PRAddrInfo *ai;
void *iter;
diff --git a/pr/tests/gethost.c b/pr/tests/gethost.c
index 3af41a3f..37aa6888 100644
--- a/pr/tests/gethost.c
+++ b/pr/tests/gethost.c
@@ -49,6 +49,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
#define DEFAULT_HOST_NAME "mcom.com"
diff --git a/pr/tests/getproto.c b/pr/tests/getproto.c
index 7381bbd8..4e8374c8 100644
--- a/pr/tests/getproto.c
+++ b/pr/tests/getproto.c
@@ -51,8 +51,9 @@
#include "prprf.h"
#include "prnetdb.h"
#include "prerror.h"
+#include "nst_wince.h"
-int main()
+int main(int argc, char **argv)
{
PRFileDesc *prstderr = PR_GetSpecialFD(PR_StandardError);
PRBool failed = PR_FALSE;
diff --git a/pr/tests/i2l.c b/pr/tests/i2l.c
index 4ff67bc0..69e996f1 100644
--- a/pr/tests/i2l.c
+++ b/pr/tests/i2l.c
@@ -44,6 +44,7 @@
#include "plerror.h"
#include "plgetopt.h"
+#include "nst_wince.h"
typedef union Overlay_i
{
@@ -121,7 +122,7 @@ static PRIntn PR_CALLBACK RealMain(PRIntn argc, char **argv)
} /* main */
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
PRIntn rv;
diff --git a/pr/tests/initclk.c b/pr/tests/initclk.c
index 6540519e..a5ee34b1 100644
--- a/pr/tests/initclk.c
+++ b/pr/tests/initclk.c
@@ -50,6 +50,7 @@
#include "prlog.h"
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
/* The timeouts, in milliseconds */
#define SHORT_TIMEOUT 1000
@@ -65,7 +66,7 @@ void ThreadFunc(void *arg)
PR_Unlock(lock1);
}
-int main()
+int main(int argc, char **argv)
{
PRThread *thread;
PRIntervalTime start, end;
diff --git a/pr/tests/inrval.c b/pr/tests/inrval.c
index b057c685..7f7120c9 100644
--- a/pr/tests/inrval.c
+++ b/pr/tests/inrval.c
@@ -72,6 +72,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
static PRIntn debug_mode;
static PRFileDesc *output;
@@ -231,7 +232,7 @@ static PRIntn PR_CALLBACK RealMain(int argc, char** argv)
}
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
PRIntn rv;
diff --git a/pr/tests/instrumt.c b/pr/tests/instrumt.c
index f1577609..617785ed 100644
--- a/pr/tests/instrumt.c
+++ b/pr/tests/instrumt.c
@@ -78,6 +78,7 @@
#include <prtrace.h>
#include <prcountr.h>
#include <prolock.h>
+#include "nst_wince.h"
#define COUNT_LIMIT (10 * ( 1024))
@@ -432,7 +433,7 @@ static void OrderedLockTest( void )
} /* end OrderedLockTest() */
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
#if defined(DEBUG) || defined(FORCE_NSPR_TRACE)
PRUint32 counter;
diff --git a/pr/tests/intrio.c b/pr/tests/intrio.c
index e1dcf661..68548220 100644
--- a/pr/tests/intrio.c
+++ b/pr/tests/intrio.c
@@ -45,6 +45,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
@@ -146,7 +147,7 @@ static void Test(PRThreadScope scope1, PRThreadScope scope2)
}
}
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PR_STDIO_INIT();
lock = PR_NewLock();
diff --git a/pr/tests/intrupt.c b/pr/tests/intrupt.c
index a4d62f77..7ca3871d 100644
--- a/pr/tests/intrupt.c
+++ b/pr/tests/intrupt.c
@@ -54,6 +54,7 @@
#include <stdio.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
@@ -335,7 +336,7 @@ void PR_CALLBACK Intrupt(void *arg)
PR_DestroyLock(ml);
} /* Intrupt */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRThread *intrupt;
PLOptStatus os;
diff --git a/pr/tests/io_timeout.c b/pr/tests/io_timeout.c
index 2a680aa5..997ba07f 100644
--- a/pr/tests/io_timeout.c
+++ b/pr/tests/io_timeout.c
@@ -56,6 +56,7 @@
#include <stdio.h>
#include "nspr.h"
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/io_timeoutk.c b/pr/tests/io_timeoutk.c
index 26e3beeb..141d890c 100644
--- a/pr/tests/io_timeoutk.c
+++ b/pr/tests/io_timeoutk.c
@@ -56,6 +56,7 @@
#include <stdio.h>
#include "nspr.h"
+#include "nst_wince.h"
#define NUM_THREADS 1
#define BASE_PORT 8000
diff --git a/pr/tests/io_timeoutu.c b/pr/tests/io_timeoutu.c
index c17a93f7..021181c6 100644
--- a/pr/tests/io_timeoutu.c
+++ b/pr/tests/io_timeoutu.c
@@ -57,6 +57,7 @@
#include <stdio.h>
#include "nspr.h"
+#include "nst_wince.h"
#define NUM_THREADS 1
#define BASE_PORT 8000
diff --git a/pr/tests/ioconthr.c b/pr/tests/ioconthr.c
index 2e39522d..bd6faaf1 100644
--- a/pr/tests/ioconthr.c
+++ b/pr/tests/ioconthr.c
@@ -42,6 +42,7 @@
#include "nspr.h"
#include <stdio.h>
+#include "nst_wince.h"
int num_threads = 10; /* must be an even number */
PRThreadScope thread_scope = PR_GLOBAL_THREAD;
diff --git a/pr/tests/ipv6.c b/pr/tests/ipv6.c
index 742239ae..5155fb97 100644
--- a/pr/tests/ipv6.c
+++ b/pr/tests/ipv6.c
@@ -49,6 +49,7 @@
#include "obsolete/probslet.h"
#include <string.h>
+#include "nst_wince.h"
#define DNS_BUFFER 100
#define ADDR_BUFFER 100
@@ -109,7 +110,7 @@ static PRStatus PrintAddress(const PRNetAddr* address)
return rv;
} /* PrintAddress */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRStatus rv;
PLOptStatus os;
diff --git a/pr/tests/join.c b/pr/tests/join.c
index 73d7eb83..3b045392 100644
--- a/pr/tests/join.c
+++ b/pr/tests/join.c
@@ -63,6 +63,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
@@ -254,7 +255,7 @@ static PRIntn PR_CALLBACK RealMain(int argc, char **argv)
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
PRIntn rv;
diff --git a/pr/tests/joinkk.c b/pr/tests/joinkk.c
index 0fd991e5..5f4a8b2b 100644
--- a/pr/tests/joinkk.c
+++ b/pr/tests/joinkk.c
@@ -64,6 +64,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
@@ -183,7 +184,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv )
}
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRIntn rv;
diff --git a/pr/tests/joinku.c b/pr/tests/joinku.c
index ecaa24c9..b63d6cdb 100644
--- a/pr/tests/joinku.c
+++ b/pr/tests/joinku.c
@@ -64,6 +64,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
@@ -189,7 +190,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv )
}
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRIntn rv;
diff --git a/pr/tests/joinuk.c b/pr/tests/joinuk.c
index 1564731d..3801db06 100644
--- a/pr/tests/joinuk.c
+++ b/pr/tests/joinuk.c
@@ -64,6 +64,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
@@ -185,7 +186,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv )
}
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRIntn rv;
diff --git a/pr/tests/joinuu.c b/pr/tests/joinuu.c
index ea0d2d70..e803e6f2 100644
--- a/pr/tests/joinuu.c
+++ b/pr/tests/joinuu.c
@@ -64,6 +64,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
@@ -187,7 +188,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv )
}
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRIntn rv;
diff --git a/pr/tests/layer.c b/pr/tests/layer.c
index cb914ba0..25a6ba6b 100644
--- a/pr/tests/layer.c
+++ b/pr/tests/layer.c
@@ -47,6 +47,7 @@
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
/*
** Testing layering of I/O
@@ -279,7 +280,7 @@ static Verbosity ChangeVerbosity(Verbosity verbosity, PRIntn delta)
return (Verbosity)verbage;
} /* ChangeVerbosity */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRStatus rv;
PRIntn mits;
diff --git a/pr/tests/lazyinit.c b/pr/tests/lazyinit.c
index 09f0b6fa..bab48efe 100644
--- a/pr/tests/lazyinit.c
+++ b/pr/tests/lazyinit.c
@@ -61,6 +61,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
static void PR_CALLBACK lazyEntry(void *arg)
{
@@ -68,7 +69,7 @@ static void PR_CALLBACK lazyEntry(void *arg)
} /* lazyEntry */
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
PRUintn pdkey;
PRStatus status;
diff --git a/pr/tests/libfilename.c b/pr/tests/libfilename.c
index ab482936..8dcf6da9 100644
--- a/pr/tests/libfilename.c
+++ b/pr/tests/libfilename.c
@@ -48,6 +48,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
PRBool debug_mode = PR_FALSE;
@@ -80,7 +81,7 @@ static PRStatus RunTest(const char *name, PRFuncPtr addr)
return PR_SUCCESS;
}
-int main(int argc, char *argv[])
+int main(int argc, char **argv)
{
char *name;
PRFuncPtr addr;
diff --git a/pr/tests/lltest.c b/pr/tests/lltest.c
index f8ce4c6a..e808fbc3 100644
--- a/pr/tests/lltest.c
+++ b/pr/tests/lltest.c
@@ -69,6 +69,7 @@
#include "nspr.h"
#include "plgetopt.h"
+#include "nst_wince.h"
/* --- Local Definitions --- */
#define ReportProgress(m) if (verboseMode) PR_fprintf(output, (m));
@@ -828,7 +829,7 @@ Initialize( PRIntn argc, char **argv )
return(0);
}
-PRIntn main( int argc, char **argv )
+int main(int argc, char **argv)
{
PR_STDIO_INIT();
output = PR_GetSpecialFD(PR_StandardError);
diff --git a/pr/tests/lock.c b/pr/tests/lock.c
index e0e23d01..ae31749c 100644
--- a/pr/tests/lock.c
+++ b/pr/tests/lock.c
@@ -82,6 +82,7 @@
#include "plstr.h"
#include <stdlib.h>
+#include "nst_wince.h"
#if defined(XP_UNIX)
#include <string.h>
diff --git a/pr/tests/lockfile.c b/pr/tests/lockfile.c
index 27f8821e..2c0749f9 100644
--- a/pr/tests/lockfile.c
+++ b/pr/tests/lockfile.c
@@ -75,6 +75,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/logger.c b/pr/tests/logger.c
index 58c55d3e..58cb89e5 100644
--- a/pr/tests/logger.c
+++ b/pr/tests/logger.c
@@ -48,6 +48,7 @@
#include "prinrval.h"
#include <stdio.h>
+#include "nst_wince.h"
#ifdef XP_MAC
extern void SetupMacPrintfLog(char *logFile);
@@ -119,7 +120,7 @@ static void UserLogStuff( void )
} /* end UserLogStuff() */
-int main(PRIntn argc, const char **argv)
+int main(int argc, char **argv)
{
PRThread *thread;
diff --git a/pr/tests/makedir.c b/pr/tests/makedir.c
index 2720f13e..7fb07d47 100644
--- a/pr/tests/makedir.c
+++ b/pr/tests/makedir.c
@@ -44,8 +44,9 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
-int main()
+int main(int argc, char **argv)
{
if (PR_MakeDir("tdir0400", 0400) == PR_FAILURE) {
fprintf(stderr, "PR_MakeDir failed\n");
diff --git a/pr/tests/many_cv.c b/pr/tests/many_cv.c
index c61b714d..7f35fe3a 100644
--- a/pr/tests/many_cv.c
+++ b/pr/tests/many_cv.c
@@ -48,12 +48,13 @@
#include "plgetopt.h"
#include <stdlib.h>
+#include "nst_wince.h"
-static PRInt32 Random(void)
+static PRInt32 RandomNum(void)
{
PRInt32 ran = rand() >> 16;
return ran;
-} /* Random */
+} /* RandomNum */
static void Help(void)
{
@@ -118,7 +119,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv )
PR_Lock(ml);
for (nl = 0; nl < cvs; ++nl)
{
- PRInt32 ran = Random() % 8;
+ PRInt32 ran = RandomNum() % 8;
if (0 == ran) PR_NotifyAllCondVar(cv[nl]);
else for (nc = 0; nc < ran; ++nc)
PR_NotifyCondVar(cv[nl]);
@@ -140,7 +141,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv )
}
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRIntn rv;
diff --git a/pr/tests/mbcs.c b/pr/tests/mbcs.c
index 7ab89118..9ccd076e 100644
--- a/pr/tests/mbcs.c
+++ b/pr/tests/mbcs.c
@@ -71,6 +71,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
/*
** Test harness infrastructure
@@ -142,7 +143,7 @@ static void TraverseDirectory( unsigned char *dir )
} /* end TraverseDirectory() */
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
{ /* get command line options */
/*
diff --git a/pr/tests/multiacc.c b/pr/tests/multiacc.c
index ccae270b..3aa7f2ab 100644
--- a/pr/tests/multiacc.c
+++ b/pr/tests/multiacc.c
@@ -48,6 +48,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#define NUM_SERVER_THREADS 10
diff --git a/pr/tests/multiwait.c b/pr/tests/multiwait.c
index 10e22dad..e0acb774 100644
--- a/pr/tests/multiwait.c
+++ b/pr/tests/multiwait.c
@@ -53,6 +53,7 @@
#include "plgetopt.h"
#include <string.h>
+#include "nst_wince.h"
typedef struct Shared
{
@@ -665,7 +666,7 @@ static Verbosity ChangeVerbosity(Verbosity verbosity, PRIntn delta)
return (Verbosity)(verbage += delta);
} /* ChangeVerbosity */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PLOptStatus os;
const char *test_name = NULL;
diff --git a/pr/tests/nameshm1.c b/pr/tests/nameshm1.c
index e70f0e2a..e4f936cc 100644
--- a/pr/tests/nameshm1.c
+++ b/pr/tests/nameshm1.c
@@ -103,6 +103,7 @@
#include <stdlib.h>
#include <string.h>
#include <private/primpl.h>
+#include "nst_wince.h"
#define SEM_NAME1 "/tmp/nameshmSEM1"
#define SEM_NAME2 "/tmp/nameshmSEM2"
@@ -530,7 +531,7 @@ static void ClientServerTest( void )
return;
} /* end ClientServerTest() */
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
{
/*
diff --git a/pr/tests/nbconn.c b/pr/tests/nbconn.c
index 099150a5..22ce59dc 100644
--- a/pr/tests/nbconn.c
+++ b/pr/tests/nbconn.c
@@ -60,6 +60,7 @@
#include "plgetopt.h"
#include <stdio.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#define printf PR_LogPrint
diff --git a/pr/tests/nblayer.c b/pr/tests/nblayer.c
index 4ecc955c..380be9b9 100644
--- a/pr/tests/nblayer.c
+++ b/pr/tests/nblayer.c
@@ -49,6 +49,7 @@
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
/*
** Testing layering of I/O
@@ -530,7 +531,7 @@ static Verbosity ChangeVerbosity(Verbosity verbosity, PRIntn delta)
return (Verbosity)verbage;
} /* ChangeVerbosity */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRStatus rv;
PLOptStatus os;
diff --git a/pr/tests/nonblock.c b/pr/tests/nonblock.c
index 102fd84b..629ecee8 100644
--- a/pr/tests/nonblock.c
+++ b/pr/tests/nonblock.c
@@ -51,6 +51,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
#define NUMBER_ROUNDS 5
@@ -262,7 +263,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv )
return 0;
}
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
PRIntn rv;
diff --git a/pr/tests/nst_wince.h b/pr/tests/nst_wince.h
new file mode 100644
index 00000000..f28ac8a9
--- /dev/null
+++ b/pr/tests/nst_wince.h
@@ -0,0 +1,115 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Netscape Portable Runtime (NSPR) Tests.
+ *
+ * The Initial Developer of the Original Code is John Wolfe
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef nst_wince_h___
+#define nst_wince_h___
+
+#ifndef __WINDOWS__
+#include <windows.h>
+#endif
+
+/***********
+ * NOTE: This file is loaded once in each test - and defines two
+ * functions for each test's eventual executable: WinMain() and
+ * nspr_test_runme() -- both exported functions.
+ *
+ * WinMain() is required to massage a main() entry-point EXE into
+ * a WinMain() entry-point DLL.
+ *
+ * nspr_test_runme() is required so that the WinCE/WinMobile
+ * controlling test program can run each DLL's tests in a standard way.
+ ***********/
+
+#ifdef WINCE
+
+#ifdef perror
+#undef perror
+#endif
+#define perror(x)
+
+
+/***********
+ * Do nothing DllMain -- needed to create a functional DLL
+ ***********/
+BOOL WINAPI DllMain( HINSTANCE hDllHandle,
+ DWORD nReason,
+ LPVOID lpvReserved )
+{
+ BOOLEAN bSuccess = TRUE;
+
+ switch ( nReason )
+ {
+ case DLL_PROCESS_ATTACH:
+ /* Do nothing yet */
+ break;
+
+ case DLL_THREAD_ATTACH:
+ /* Do nothing yet */
+ break;
+
+ case DLL_THREAD_DETACH:
+ /* Do nothing yet */
+ break;
+
+ case DLL_PROCESS_DETACH:
+ /* Do nothing yet */
+ break;
+
+ default:
+ /* SHOULD NOT GET HERE - Do nothing */
+ break;
+ }
+
+ return bSuccess;
+}
+/* end DllMain */
+
+/* NOW, take care of all the other main() functions out there */
+#define main __declspec(dllexport) WINAPI nspr_test_runme
+
+#undef getcwd
+#define getcwd(x, nc) \
+{ \
+ int i; \
+ unsigned short dir[MAX_PATH]; \
+ GetModuleFileName(GetModuleHandle (NULL), dir, MAX_PATH); \
+ for (i = _tcslen(dir); i && dir[i] != TEXT('\\'); i--) {} \
+ dir[i + 1] = L'\0'; \
+ WideCharToMultiByte(CP_ACP, 0, dir, -1, x, nc, NULL, NULL); \
+}
+
+#endif /* WINCE */
+
+#endif /* nst_wince_h___ */
diff --git a/pr/tests/ntioto.c b/pr/tests/ntioto.c
index 0dc0072a..b16b96d3 100644
--- a/pr/tests/ntioto.c
+++ b/pr/tests/ntioto.c
@@ -76,6 +76,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
/*
** Test harness infrastructure
@@ -204,7 +205,7 @@ static void ConnectThread( void *arg )
} /* end ConnectThread() */
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
PRThread *tJitter;
PRThread *tAccept;
diff --git a/pr/tests/ntoh.c b/pr/tests/ntoh.c
index e424f548..7f1d3ab9 100644
--- a/pr/tests/ntoh.c
+++ b/pr/tests/ntoh.c
@@ -45,6 +45,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
/* Byte sequence in network byte order */
static unsigned char bytes_n[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
@@ -54,7 +55,7 @@ static PRUint16 s_h = 0x0102;
static PRUint32 l_h = 0x01020304;
static PRUint64 ll_h = LL_INIT(0x01020304, 0x05060708);
-int main()
+int main(int argc, char **argv)
{
union {
PRUint16 s;
diff --git a/pr/tests/obsints.c b/pr/tests/obsints.c
index 87182f55..69348797 100644
--- a/pr/tests/obsints.c
+++ b/pr/tests/obsints.c
@@ -44,11 +44,12 @@
*/
#include <stdio.h>
+#include "nst_wince.h"
#ifdef NO_NSPR_10_SUPPORT
/* nothing to do */
-int main()
+int main(int argc, char **argv)
{
printf("PASS\n");
return 0;
@@ -58,7 +59,7 @@ int main()
#include "prtypes.h" /* which includes protypes.h */
-int main()
+int main(int argc, char **argv)
{
/*
* Compilation fails if any of these integer types are not
diff --git a/pr/tests/op_2long.c b/pr/tests/op_2long.c
index 27f64d79..548f15a0 100644
--- a/pr/tests/op_2long.c
+++ b/pr/tests/op_2long.c
@@ -56,6 +56,7 @@
#include <stdio.h>
#include "plerror.h"
#include "plgetopt.h"
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/op_excl.c b/pr/tests/op_excl.c
index b0bb6ace..628a3a59 100644
--- a/pr/tests/op_excl.c
+++ b/pr/tests/op_excl.c
@@ -49,6 +49,7 @@
#include <nspr.h>
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
/*
** Test harness infrastructure
@@ -71,7 +72,7 @@ static void Help( void )
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
PRFileDesc *fd;
PRStatus rv;
diff --git a/pr/tests/op_filnf.c b/pr/tests/op_filnf.c
index 5f676250..8ad43a04 100644
--- a/pr/tests/op_filnf.c
+++ b/pr/tests/op_filnf.c
@@ -56,6 +56,7 @@
#include "prerror.h"
#include <stdio.h>
#include "plgetopt.h"
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/op_filok.c b/pr/tests/op_filok.c
index acb86a7e..ac6ee9f5 100644
--- a/pr/tests/op_filok.c
+++ b/pr/tests/op_filok.c
@@ -54,6 +54,7 @@
#include "prio.h"
#include "prerror.h"
#include <stdio.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/op_noacc.c b/pr/tests/op_noacc.c
index ab1254de..32fd15a1 100644
--- a/pr/tests/op_noacc.c
+++ b/pr/tests/op_noacc.c
@@ -55,6 +55,7 @@
#include "prerror.h"
#include <stdio.h>
#include "plgetopt.h"
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/op_nofil.c b/pr/tests/op_nofil.c
index 20bc11e1..7912a687 100644
--- a/pr/tests/op_nofil.c
+++ b/pr/tests/op_nofil.c
@@ -55,6 +55,7 @@
#include "prerror.h"
#include <stdio.h>
#include "plgetopt.h"
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/openfile.c b/pr/tests/openfile.c
index 8f863c06..84593c7c 100644
--- a/pr/tests/openfile.c
+++ b/pr/tests/openfile.c
@@ -46,10 +46,11 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
#define TEMPLATE_FILE_NAME "template.txt"
-int main()
+int main(int argc, char **argv)
{
FILE *template;
char buf[32];
diff --git a/pr/tests/parent.c b/pr/tests/parent.c
index a81d5ec6..2b8e30b7 100644
--- a/pr/tests/parent.c
+++ b/pr/tests/parent.c
@@ -45,6 +45,7 @@
#include "prinit.h"
#include "prproces.h"
#include "prinrval.h"
+#include "nst_wince.h"
typedef struct Child
{
@@ -63,7 +64,7 @@ static void PrintUsage(void)
"Usage: parent [-d] child [options]\n");
}
-PRIntn main (PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRStatus rv;
PRInt32 test_status = 1;
diff --git a/pr/tests/peek.c b/pr/tests/peek.c
index 22fcfec6..97738ce1 100644
--- a/pr/tests/peek.c
+++ b/pr/tests/peek.c
@@ -46,6 +46,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#define BUFFER_SIZE 1024
diff --git a/pr/tests/perf.c b/pr/tests/perf.c
index dda69682..79cd2e78 100644
--- a/pr/tests/perf.c
+++ b/pr/tests/perf.c
@@ -41,6 +41,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
int _debug_on = 0;
#define DPRINTF(arg) if (_debug_on) printf arg
diff --git a/pr/tests/pipeping.c b/pr/tests/pipeping.c
index dd18eb6f..c6331ddb 100644
--- a/pr/tests/pipeping.c
+++ b/pr/tests/pipeping.c
@@ -57,6 +57,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_OS2
static char *child_argv[] = { "pipepong.exe", NULL };
@@ -66,7 +67,7 @@ static char *child_argv[] = { "pipepong", NULL };
#define NUM_ITERATIONS 10
-int main()
+int main(int argc, char **argv)
{
PRFileDesc *in_pipe[2];
PRFileDesc *out_pipe[2];
diff --git a/pr/tests/pipeping2.c b/pr/tests/pipeping2.c
index b1f2b420..a6cc249b 100644
--- a/pr/tests/pipeping2.c
+++ b/pr/tests/pipeping2.c
@@ -56,12 +56,13 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
#define NUM_ITERATIONS 10
static char *child_argv[] = { "pipepong2", NULL };
-int main()
+int main(int argc, char **argv)
{
PRFileDesc *in_pipe[2];
PRFileDesc *out_pipe[2];
diff --git a/pr/tests/pipepong.c b/pr/tests/pipepong.c
index 66771601..4850b5a1 100644
--- a/pr/tests/pipepong.c
+++ b/pr/tests/pipepong.c
@@ -54,10 +54,11 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
#define NUM_ITERATIONS 10
-int main()
+int main(int argc, char **argv)
{
char buf[1024];
size_t nBytes;
diff --git a/pr/tests/pipepong2.c b/pr/tests/pipepong2.c
index 19494bbd..a745e836 100644
--- a/pr/tests/pipepong2.c
+++ b/pr/tests/pipepong2.c
@@ -55,10 +55,11 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
#define NUM_ITERATIONS 10
-int main()
+int main(int argc, char **argv)
{
PRFileDesc *pipe_read, *pipe_write;
PRStatus status;
diff --git a/pr/tests/pipeself.c b/pr/tests/pipeself.c
index 5bb9791a..97db6559 100644
--- a/pr/tests/pipeself.c
+++ b/pr/tests/pipeself.c
@@ -53,6 +53,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#define NUM_ITERATIONS 10
@@ -106,7 +107,7 @@ static void PongThreadFunc(void *arg)
}
}
-int main()
+int main(int argc, char **argv)
{
PRStatus status;
PRThread *pongThread;
diff --git a/pr/tests/poll_er.c b/pr/tests/poll_er.c
index b68c7986..dddb76fc 100755
--- a/pr/tests/poll_er.c
+++ b/pr/tests/poll_er.c
@@ -72,6 +72,7 @@ int main()
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
PRIntn failed_already=0;
PRIntn debug_mode;
diff --git a/pr/tests/poll_nm.c b/pr/tests/poll_nm.c
index 63a64a63..30601ae7 100644
--- a/pr/tests/poll_nm.c
+++ b/pr/tests/poll_nm.c
@@ -78,6 +78,8 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
+
PRIntn failed_already=0;
PRIntn debug_mode;
diff --git a/pr/tests/poll_to.c b/pr/tests/poll_to.c
index 93fcc79d..e8190346 100644
--- a/pr/tests/poll_to.c
+++ b/pr/tests/poll_to.c
@@ -73,6 +73,8 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
+
PRIntn failed_already=0;
PRIntn debug_mode;
diff --git a/pr/tests/pollable.c b/pr/tests/pollable.c
index 20da55a3..df8e2c79 100644
--- a/pr/tests/pollable.c
+++ b/pr/tests/pollable.c
@@ -53,6 +53,7 @@
#include "plgetopt.h"
#include <stdlib.h>
+#include "nst_wince.h"
#define DEFAULT_THREADS 10
#define DEFAULT_LOOPS 100
diff --git a/pr/tests/prftest.c b/pr/tests/prftest.c
index d3e7407d..2f04cd1e 100644
--- a/pr/tests/prftest.c
+++ b/pr/tests/prftest.c
@@ -46,10 +46,12 @@
#include "prprf.h"
#include <string.h>
+#include "nst_wince.h"
#define BUF_SIZE 128
-int main() {
+int main(int argc, char **argv)
+{
PRInt16 i16;
PRIntn n;
PRInt32 i32;
diff --git a/pr/tests/prftest1.c b/pr/tests/prftest1.c
index 5ea26f65..a179e4f4 100644
--- a/pr/tests/prftest1.c
+++ b/pr/tests/prftest1.c
@@ -60,6 +60,7 @@
#include "prprf.h"
#include <string.h>
+#include "nst_wince.h"
#define BUF_SIZE 128
@@ -88,7 +89,7 @@ static void Test_Result (int result)
printf ("FAIL\n");
}
-int main( int argc, char *argv[])
+int main(int argc, char **argv)
{
PRInt16 i16;
PRIntn n;
diff --git a/pr/tests/prftest2.c b/pr/tests/prftest2.c
index 0e5b2244..c87f9544 100644
--- a/pr/tests/prftest2.c
+++ b/pr/tests/prftest2.c
@@ -61,13 +61,14 @@
#include "prprf.h"
#include <string.h>
+#include "nst_wince.h"
#define BUF_SIZE 128
PRIntn failed_already=0;
PRIntn debug_mode;
-int main( int argc, char *argv[])
+int main(int argc, char **argv)
{
PRInt16 i16;
PRIntn n;
diff --git a/pr/tests/primblok.c b/pr/tests/primblok.c
index 8a188834..7b19a317 100644
--- a/pr/tests/primblok.c
+++ b/pr/tests/primblok.c
@@ -45,8 +45,9 @@
#if !defined(WINNT)
#include <stdio.h>
+#include "nst_wince.h"
-int main()
+int main(int argc, char **argv)
{
printf("This test is not relevant on this platform\n");
return 0;
@@ -60,6 +61,7 @@ int main()
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#define TEST_FILE_NAME "primblok.dat"
@@ -105,7 +107,7 @@ static void PR_CALLBACK IOThread(void *arg)
InterlockedExchange(&iothread_done, 1);
}
-int main()
+int main(int argc, char **argv)
{
PRThread *iothread;
diff --git a/pr/tests/priotest.c b/pr/tests/priotest.c
index 16def03d..e80f3bb7 100644
--- a/pr/tests/priotest.c
+++ b/pr/tests/priotest.c
@@ -60,6 +60,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
#define DEFAULT_DURATION 5
@@ -160,7 +161,7 @@ static void CreateThreads(PRUint32 *lowCount, PRUint32 *highCount)
PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0);
} /* CreateThreads */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PLOptStatus os;
PRIntn duration = DEFAULT_DURATION;
diff --git a/pr/tests/provider.c b/pr/tests/provider.c
index 96ceede0..d99e0863 100644
--- a/pr/tests/provider.c
+++ b/pr/tests/provider.c
@@ -81,6 +81,7 @@
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#if defined(XP_UNIX)
@@ -1083,7 +1084,7 @@ static Verbosity IncrementVerbosity(void)
return (Verbosity)verboge;
} /* IncrementVerbosity */
-PRIntn main(PRIntn argc, char** argv)
+int main(int argc, char **argv)
{
PRUintn index;
PRBool boolean;
diff --git a/pr/tests/prpoll.c b/pr/tests/prpoll.c
index bedb56fc..1c870a81 100644
--- a/pr/tests/prpoll.c
+++ b/pr/tests/prpoll.c
@@ -62,6 +62,18 @@
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
+
+#ifdef WINCE
+
+int main(int argc, char **argv)
+{
+ fprintf(stderr, "Invalid/Broken Test for WinCE/WinMobile\n");
+ exit(1);
+}
+
+#else
+
static void
clientThreadFunc(void *arg)
{
@@ -372,3 +384,6 @@ int main(int argc, char **argv)
PR_Cleanup();
return 0;
}
+
+
+#endif /* ifdef WINCE */
diff --git a/pr/tests/prpollml.c b/pr/tests/prpollml.c
index d20f1967..be70f7c3 100644
--- a/pr/tests/prpollml.c
+++ b/pr/tests/prpollml.c
@@ -46,6 +46,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#define POLL_DESC_COUNT 256 /* This should be greater than the
* STACK_POLL_DESC_COUNT macro in
diff --git a/pr/tests/prselect.c b/pr/tests/prselect.c
index ff6ebdc6..5dfea81b 100644
--- a/pr/tests/prselect.c
+++ b/pr/tests/prselect.c
@@ -68,6 +68,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
/***********************************************************************
** PRIVATE FUNCTION: Test_Result
diff --git a/pr/tests/randseed.c b/pr/tests/randseed.c
index fc1fbaeb..1ff169c0 100644
--- a/pr/tests/randseed.c
+++ b/pr/tests/randseed.c
@@ -52,6 +52,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
/*
** Test harness infrastructure
@@ -113,7 +114,7 @@ static void PrintRand( void *buf, PRIntn size )
} /* end PrintRand() */
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
{
/*
diff --git a/pr/tests/ranfile.c b/pr/tests/ranfile.c
index a024bcd8..9f2f6148 100644
--- a/pr/tests/ranfile.c
+++ b/pr/tests/ranfile.c
@@ -69,6 +69,7 @@
#include <string.h>
#include <stdio.h>
+#include "nst_wince.h"
static PRIntn debug_mode = 0;
static PRIntn failed_already=0;
@@ -104,7 +105,7 @@ extern void SetupMacPrintfLog(char *logFile);
#endif
/***********************************************************************
-** PRIVATE FUNCTION: Random
+** PRIVATE FUNCTION: RandomNum
** DESCRIPTION:
** Generate a pseudo-random number
** INPUTS: None
@@ -122,7 +123,7 @@ extern void SetupMacPrintfLog(char *logFile);
** of the product. Seed is then updated with the return value
** promoted to a float-64.
***********************************************************************/
-static PRUint32 Random(void)
+static PRUint32 RandomNum(void)
{
PRUint32 rv;
PRUint64 shift;
@@ -132,7 +133,7 @@ static PRUint32 Random(void)
LL_L2UI(rv, shift);
seed = (PRFloat64)rv;
return rv;
-} /* Random */
+} /* RandomNum */
/***********************************************************************
** PRIVATE FUNCTION: Thread
@@ -175,9 +176,9 @@ static void PR_CALLBACK Thread(void *arg)
while (PR_TRUE)
{
PRUint32 bytes;
- PRUint32 minor = (Random() % cd->limit) + 1;
- PRUint32 random = (Random() % cd->limit) + 1;
- PRUint32 pages = (Random() % cd->limit) + 10;
+ PRUint32 minor = (RandomNum() % cd->limit) + 1;
+ PRUint32 random = (RandomNum() % cd->limit) + 1;
+ PRUint32 pages = (RandomNum() % cd->limit) + 10;
while (minor-- > 0)
{
cd->problem = sg_okay;
@@ -275,7 +276,7 @@ static PRCondVar *cv;
** Random File: Using loops = 2, threads = 10, limit = 57
** Random File: [min [avg] max] writes/sec average
***********************************************************************/
-int main (int argc, char *argv[])
+int main(int argc, char **argv)
{
PRLock *ml;
PRUint32 id = 0;
@@ -357,7 +358,7 @@ int main (int argc, char *argv[])
hammer[active].writes = 0;
hammer[active].action = sg_go;
hammer[active].problem = sg_okay;
- hammer[active].limit = (Random() % limit) + 1;
+ hammer[active].limit = (RandomNum() % limit) + 1;
hammer[active].timein = PR_IntervalNow();
hammer[active].thread = PR_CreateThread(
PR_USER_THREAD, Thread, &hammer[active],
diff --git a/pr/tests/rmdir.c b/pr/tests/rmdir.c
index 81689e8d..a3d9d7d5 100644
--- a/pr/tests/rmdir.c
+++ b/pr/tests/rmdir.c
@@ -51,6 +51,7 @@
#include <prerror.h>
#include <prlog.h>
#include "plgetopt.h"
+#include "nst_wince.h"
#define DIRNAME "xxxBug80884/"
#define FILENAME "file80883"
@@ -69,7 +70,7 @@ static void Help( void ) {
);
} /* --- end Help() */
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
PLOptStatus os;
PLOptState *opt = PL_CreateOptState(argc, argv, "dh");
diff --git a/pr/tests/rwlocktest.c b/pr/tests/rwlocktest.c
index b7c4f1e8..2beccd7f 100644
--- a/pr/tests/rwlocktest.c
+++ b/pr/tests/rwlocktest.c
@@ -53,6 +53,7 @@
#include "nspr.h"
#include "plgetopt.h"
#include "prrwlock.h"
+#include "nst_wince.h"
static int _debug_on;
static void rwtest(void *args);
@@ -72,7 +73,7 @@ PRFileDesc *errhandle;
#define DEFAULT_LOOP_CNT 100
#define TEST_ARRAY_SIZE 100
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRInt32 cnt;
PRStatus rc;
diff --git a/pr/tests/sel_spd.c b/pr/tests/sel_spd.c
index 9ba09eb0..dc22e184 100644
--- a/pr/tests/sel_spd.c
+++ b/pr/tests/sel_spd.c
@@ -47,6 +47,7 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/selct_er.c b/pr/tests/selct_er.c
index e658813f..3977f645 100755
--- a/pr/tests/selct_er.c
+++ b/pr/tests/selct_er.c
@@ -74,6 +74,7 @@ int main()
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
PRIntn failed_already=0;
diff --git a/pr/tests/selct_nm.c b/pr/tests/selct_nm.c
index 56a80a76..238930de 100644
--- a/pr/tests/selct_nm.c
+++ b/pr/tests/selct_nm.c
@@ -74,6 +74,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
PRIntn failed_already=0;
PRIntn debug_mode;
diff --git a/pr/tests/selct_to.c b/pr/tests/selct_to.c
index b5600fa9..3a8b1dd7 100644
--- a/pr/tests/selct_to.c
+++ b/pr/tests/selct_to.c
@@ -75,6 +75,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
PRIntn failed_already=0;
PRIntn debug_mode;
diff --git a/pr/tests/select2.c b/pr/tests/select2.c
index 0651c450..4fc436d3 100644
--- a/pr/tests/select2.c
+++ b/pr/tests/select2.c
@@ -60,6 +60,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#if defined(OS2)
#include <sys/time.h>
#endif
@@ -304,7 +305,7 @@ static void Measure(void (*func)(void), const char *msg)
if (debug_mode) printf("%40s: %6.2f usec avg, %d msec total\n", msg, d / count, tot);
}
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
/* The command line argument: -d is used to determine if the test is being run
diff --git a/pr/tests/selintr.c b/pr/tests/selintr.c
index f47efca4..97eb132c 100644
--- a/pr/tests/selintr.c
+++ b/pr/tests/selintr.c
@@ -58,11 +58,12 @@ int main()
#else /* XP_UNIX */
#include "nspr.h"
+#include "nst_wince.h"
#include <sys/time.h>
#include <stdio.h>
-int main()
+int main(int argc, char **argv)
{
struct timeval timeout;
int rv;
diff --git a/pr/tests/sem.c b/pr/tests/sem.c
index 09c9f3cd..c0a1fdb6 100644
--- a/pr/tests/sem.c
+++ b/pr/tests/sem.c
@@ -63,6 +63,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
PRIntn failed_already=0;
PRIntn debug_mode;
diff --git a/pr/tests/sema.c b/pr/tests/sema.c
index 3dff8a00..03db50b8 100644
--- a/pr/tests/sema.c
+++ b/pr/tests/sema.c
@@ -39,6 +39,7 @@
#include "plgetopt.h"
#include <stdio.h>
+#include "nst_wince.h"
#define SEM_NAME1 "/tmp/foo.sem"
#define SEM_NAME2 "/tmp/bar.sem"
diff --git a/pr/tests/semaerr.c b/pr/tests/semaerr.c
index 8feb8d81..01a9ca42 100644
--- a/pr/tests/semaerr.c
+++ b/pr/tests/semaerr.c
@@ -39,6 +39,7 @@
#include "plgetopt.h"
#include <stdio.h>
+#include "nst_wince.h"
#define NO_SUCH_SEM_NAME "/tmp/nosuchsem.sem"
#define SEM_NAME1 "/tmp/foo.sem"
diff --git a/pr/tests/semaerr1.c b/pr/tests/semaerr1.c
index eeccdc43..334c1522 100644
--- a/pr/tests/semaerr1.c
+++ b/pr/tests/semaerr1.c
@@ -39,6 +39,7 @@
#include "plgetopt.h"
#include <stdio.h>
+#include "nst_wince.h"
#define SEM_NAME1 "/tmp/foo.sem"
#define SEM_NAME2 "/tmp/bar.sem"
diff --git a/pr/tests/semaping.c b/pr/tests/semaping.c
index 7b145fc5..3e545fba 100644
--- a/pr/tests/semaping.c
+++ b/pr/tests/semaping.c
@@ -39,6 +39,7 @@
#include "plgetopt.h"
#include <stdio.h>
+#include "nst_wince.h"
#define SHM_NAME "/tmp/counter"
#define SEM_NAME1 "/tmp/foo.sem"
diff --git a/pr/tests/semapong.c b/pr/tests/semapong.c
index d3733290..ec2760aa 100644
--- a/pr/tests/semapong.c
+++ b/pr/tests/semapong.c
@@ -39,6 +39,7 @@
#include "plgetopt.h"
#include <stdio.h>
+#include "nst_wince.h"
#define SHM_NAME "/tmp/counter"
#define SEM_NAME1 "/tmp/foo.sem"
diff --git a/pr/tests/sendzlf.c b/pr/tests/sendzlf.c
index 5416475b..acf0fad5 100644
--- a/pr/tests/sendzlf.c
+++ b/pr/tests/sendzlf.c
@@ -53,6 +53,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
static void ClientThread(void *arg)
{
@@ -184,7 +185,7 @@ static void ServerThread(void *arg)
}
}
-int main()
+int main(int argc, char **argv)
{
PRFileDesc *listenSock;
PRThread *clientThread;
diff --git a/pr/tests/server_test.c b/pr/tests/server_test.c
index 8bb6d99b..e8318677 100644
--- a/pr/tests/server_test.c
+++ b/pr/tests/server_test.c
@@ -62,6 +62,7 @@
#include "pprthred.h"
#include <string.h>
+#include "nst_wince.h"
#define PORT 15004
#define THREAD_STACKSIZE 0
@@ -568,7 +569,7 @@ static void Measure(void (*func)(void), const char *msg)
}
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
/* The command line argument: -d is used to determine if the test is being run
in debug mode. The regress tool requires only one line output:PASS or FAIL.
diff --git a/pr/tests/servr_kk.c b/pr/tests/servr_kk.c
index 9fbb9b00..1cb580a9 100644
--- a/pr/tests/servr_kk.c
+++ b/pr/tests/servr_kk.c
@@ -64,6 +64,7 @@
#include "pprthred.h"
#include <string.h>
+#include "nst_wince.h"
#define PORT 15004
#define THREAD_STACKSIZE 0
diff --git a/pr/tests/servr_ku.c b/pr/tests/servr_ku.c
index ab2083d0..e7539e0e 100644
--- a/pr/tests/servr_ku.c
+++ b/pr/tests/servr_ku.c
@@ -64,6 +64,7 @@
#include "pprthred.h"
#include <string.h>
+#include "nst_wince.h"
#define PORT 15004
#define THREAD_STACKSIZE 0
@@ -527,7 +528,7 @@ static void Measure(void (*func)(void), const char *msg)
}
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
/* The command line argument: -d is used to determine if the test is being run
in debug mode. The regress tool requires only one line output:PASS or FAIL.
diff --git a/pr/tests/servr_uk.c b/pr/tests/servr_uk.c
index 727b7b47..eaca9439 100644
--- a/pr/tests/servr_uk.c
+++ b/pr/tests/servr_uk.c
@@ -64,6 +64,7 @@
#include "pprthred.h"
#include <string.h>
+#include "nst_wince.h"
#define PORT 15004
#define THREAD_STACKSIZE 0
@@ -529,7 +530,7 @@ static void Measure(void (*func)(void), const char *msg)
}
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
/* The command line argument: -d is used to determine if the test is being run
in debug mode. The regress tool requires only one line output:PASS or FAIL.
diff --git a/pr/tests/servr_uu.c b/pr/tests/servr_uu.c
index 020fadf6..89d4e296 100644
--- a/pr/tests/servr_uu.c
+++ b/pr/tests/servr_uu.c
@@ -64,6 +64,7 @@
#include "pprthred.h"
#include <string.h>
+#include "nst_wince.h"
#define PORT 15004
#define THREAD_STACKSIZE 0
@@ -526,7 +527,7 @@ static void Measure(void (*func)(void), const char *msg)
}
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
/* The command line argument: -d is used to determine if the test is being run
in debug mode. The regress tool requires only one line output:PASS or FAIL.
diff --git a/pr/tests/short_thread.c b/pr/tests/short_thread.c
index 42a52d7c..25c84a43 100644
--- a/pr/tests/short_thread.c
+++ b/pr/tests/short_thread.c
@@ -38,6 +38,7 @@
#include <stdio.h>
#include "nspr.h"
#include "plgetopt.h"
+#include "nst_wince.h"
/*
* Create a thread that exits right away; useful for testing race conditions in thread
diff --git a/pr/tests/sigpipe.c b/pr/tests/sigpipe.c
index d274ee12..4279d1fd 100644
--- a/pr/tests/sigpipe.c
+++ b/pr/tests/sigpipe.c
@@ -66,6 +66,7 @@ int main(void)
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
+#include "nst_wince.h"
static void Test(void *arg)
{
@@ -100,7 +101,7 @@ static void Test(void *arg)
printf("write to broken pipe failed with EPIPE, as expected\n");
}
-int main(void)
+int main(int argc, char **argv)
{
PRThread *thread;
diff --git a/pr/tests/sleep.c b/pr/tests/sleep.c
index 2c84c8e8..edde60cb 100644
--- a/pr/tests/sleep.c
+++ b/pr/tests/sleep.c
@@ -36,6 +36,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nspr.h"
+#include "nst_wince.h"
#if defined(XP_UNIX) || defined(XP_OS2)
@@ -65,7 +66,7 @@ static void Other(void *unused)
if (didit < 5) rv = 1;
}
-PRIntn main ()
+int main(int argc, char **argv)
{
PRUint32 elapsed;
PRThread *thread;
diff --git a/pr/tests/socket.c b/pr/tests/socket.c
index 8e4a899b..cdbdcecd 100644
--- a/pr/tests/socket.c
+++ b/pr/tests/socket.c
@@ -84,6 +84,10 @@ extern void SetupMacPrintfLog(char *logFile);
#define DPRINTF(arg) if (_debug_on) printf arg
+
+#include "nst_wince.h"
+
+
#ifdef XP_PC
char *TEST_DIR = "prdir";
char *SMALL_FILE_NAME = "prsmallf";
@@ -2197,8 +2201,7 @@ done:
* Test Socket NSPR APIs
*/
-int
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
/*
* -d debug mode
diff --git a/pr/tests/sockopt.c b/pr/tests/sockopt.c
index 905e2387..916cf1ed 100644
--- a/pr/tests/sockopt.c
+++ b/pr/tests/sockopt.c
@@ -47,6 +47,8 @@
#include "plerror.h"
+#include "nst_wince.h"
+
static PRFileDesc *err = NULL;
static PRBool failed = PR_FALSE;
@@ -78,7 +80,7 @@ static PRSockOption Incr(PRSockOption *option)
return (PRSockOption)val;
} /* Incr */
-PRIntn main(PRIntn argc, char *argv)
+int main(int argc, char **argv)
{
PRStatus rv;
PRFileDesc *udp = PR_NewUDPSocket();
diff --git a/pr/tests/sockping.c b/pr/tests/sockping.c
index 09365138..fee62250 100644
--- a/pr/tests/sockping.c
+++ b/pr/tests/sockping.c
@@ -56,12 +56,13 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
#define NUM_ITERATIONS 10
static char *child_argv[] = { "sockpong", NULL };
-int main()
+int main(int argc, char **argv)
{
PRFileDesc *sock[2];
PRStatus status;
diff --git a/pr/tests/sockpong.c b/pr/tests/sockpong.c
index e54e3423..a5cdc520 100644
--- a/pr/tests/sockpong.c
+++ b/pr/tests/sockpong.c
@@ -55,10 +55,11 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include "nst_wince.h"
#define NUM_ITERATIONS 10
-int main()
+int main(int argc, char **argv)
{
PRFileDesc *sock;
PRStatus status;
diff --git a/pr/tests/sprintf.c b/pr/tests/sprintf.c
index 7fe2ac19..10a34f82 100644
--- a/pr/tests/sprintf.c
+++ b/pr/tests/sprintf.c
@@ -55,6 +55,7 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
#define countof(a) (sizeof(a)/sizeof(a[0]))
diff --git a/pr/tests/sproc_ch.c b/pr/tests/sproc_ch.c
index 98dee083..8d66d62d 100644
--- a/pr/tests/sproc_ch.c
+++ b/pr/tests/sproc_ch.c
@@ -50,10 +50,11 @@
#include "prinit.h"
#include <stdio.h>
+#include "nst_wince.h"
#if !defined(IRIX)
-int main()
+int main(int argc, char **argv)
{
printf("This test applies to IRIX only.\n");
return 0;
diff --git a/pr/tests/sproc_p.c b/pr/tests/sproc_p.c
index e8ded66b..7c92608d 100644
--- a/pr/tests/sproc_p.c
+++ b/pr/tests/sproc_p.c
@@ -48,10 +48,11 @@
#include "prinit.h"
#include <stdio.h>
+#include "nst_wince.h"
#if !defined(IRIX)
-int main()
+int main(int argc, char **argv)
{
printf("This test applies to IRIX only.\n");
return 0;
diff --git a/pr/tests/stack.c b/pr/tests/stack.c
index c47cb71f..6a05c330 100644
--- a/pr/tests/stack.c
+++ b/pr/tests/stack.c
@@ -50,6 +50,7 @@
#include "nspr.h"
#include "plgetopt.h"
+#include "nst_wince.h"
typedef struct _DataRecord {
PRInt32 data;
@@ -83,7 +84,7 @@ static int _debug_on;
PRFileDesc *output;
PRFileDesc *errhandle;
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRInt32 rv, cnt, sum;
DataRecord *Item;
diff --git a/pr/tests/stat.c b/pr/tests/stat.c
index 73803d05..0d2720c0 100644
--- a/pr/tests/stat.c
+++ b/pr/tests/stat.c
@@ -47,6 +47,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_OS2
#include <io.h>
@@ -101,7 +102,7 @@ static void Measure(void (*func)(void), const char *msg)
printf("%40s: %6.2f usec avg, %d msec total\n", msg, d / count, tot);
}
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
diff --git a/pr/tests/stdio.c b/pr/tests/stdio.c
index d0d84e4e..73fb8381 100644
--- a/pr/tests/stdio.c
+++ b/pr/tests/stdio.c
@@ -52,6 +52,7 @@
#include <stdio.h>
#include <string.h>
+#include "nst_wince.h"
static PRIntn PR_CALLBACK stdio(PRIntn argc, char **argv)
{
diff --git a/pr/tests/str2addr.c b/pr/tests/str2addr.c
index b1d4cf4a..2e26bc50 100644
--- a/pr/tests/str2addr.c
+++ b/pr/tests/str2addr.c
@@ -44,6 +44,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
/* Address string to convert */
#define DEFAULT_IPV4_ADDR_STR "207.200.73.41"
diff --git a/pr/tests/strod.c b/pr/tests/strod.c
index 242617a7..dda1d615 100644
--- a/pr/tests/strod.c
+++ b/pr/tests/strod.c
@@ -42,6 +42,7 @@
#include "plgetopt.h"
#include <stdlib.h>
+#include "nst_wince.h"
static void Help(void)
{
@@ -96,7 +97,7 @@ static PRIntn PR_CALLBACK RealMain(PRIntn argc, char **argv)
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
PRIntn rv;
diff --git a/pr/tests/suspend.c b/pr/tests/suspend.c
index 44ba6f87..de743c39 100644
--- a/pr/tests/suspend.c
+++ b/pr/tests/suspend.c
@@ -63,6 +63,8 @@ int main()
extern void SetupMacPrintfLog(char *logFile);
#endif
+#include "nst_wince.h"
+
PRMonitor *mon;
PRInt32 count;
PRInt32 alive;
@@ -196,8 +198,7 @@ static void CreateThreadsKK(void)
}
-void
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
PR_STDIO_INIT();
diff --git a/pr/tests/switch.c b/pr/tests/switch.c
index 2e42b793..886a9a09 100644
--- a/pr/tests/switch.c
+++ b/pr/tests/switch.c
@@ -60,6 +60,7 @@
#endif
#include <stdlib.h>
+#include "nst_wince.h"
#define INNER_LOOPS 100
#define DEFAULT_LOOPS 100
@@ -263,7 +264,7 @@ PRIntn PR_CALLBACK Switch(PRIntn argc, char **argv)
return ((failed) ? 1 : 0);
} /* Switch */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRIntn result;
PR_STDIO_INIT();
diff --git a/pr/tests/system.c b/pr/tests/system.c
index 1feb066b..19effe4d 100644
--- a/pr/tests/system.c
+++ b/pr/tests/system.c
@@ -41,6 +41,7 @@
#include "prsystem.h"
#include "plerror.h"
+#include "nst_wince.h"
static char *tag[] =
{
@@ -57,7 +58,7 @@ static PRSysInfo Incr(PRSysInfo *cmd)
return (PRSysInfo)tmp;
} /* Incr */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRStatus rv;
PRSysInfo cmd;
diff --git a/pr/tests/testbit.c b/pr/tests/testbit.c
index 1ad0b8f4..1a063369 100644
--- a/pr/tests/testbit.c
+++ b/pr/tests/testbit.c
@@ -42,6 +42,7 @@
*/
#include "nspr.h"
+#include "nst_wince.h"
#define ErrorReport(x) { printf((x)); failed = 1; }
@@ -51,7 +52,7 @@ PRInt32 rc;
PRInt32 i;
PRIntn failed = 0;
-PRIntn main(PRIntn argc, char **argv )
+int main(int argc, char **argv)
{
/*
** Test bitmap things.
diff --git a/pr/tests/testfile.c b/pr/tests/testfile.c
index d5ba6ac0..cf86e0e3 100644
--- a/pr/tests/testfile.c
+++ b/pr/tests/testfile.c
@@ -56,6 +56,8 @@
#include <errno.h>
#endif /* XP_OS2 */
+#include "nst_wince.h"
+
static int _debug_on = 0;
#ifdef XP_MAC
@@ -66,6 +68,10 @@ static int _debug_on = 0;
extern void SetupMacPrintfLog(char *logFile);
#endif
+#ifdef WINCE
+#define setbuf(x,y)
+#endif
+
#ifdef XP_WIN
#define mode_t int
#endif
@@ -113,6 +119,9 @@ char *HIDDEN_FILE_NAME = ".hidden_pr_testfile";
#endif
buffer *in_buf, *out_buf;
char pathname[256], renamename[256];
+#ifdef WINCE
+WCHAR wPathname[256];
+#endif
#define TMPDIR_LEN 64
char testdir[TMPDIR_LEN];
static PRInt32 PR_CALLBACK DirTest(void *argunused);
@@ -741,6 +750,22 @@ HANDLE hfile;
PR_Close(fd_file);
+#elif defined(WINCE)
+ DPRINTF(("Creating hidden test file %s\n",pathname));
+ MultiByteToWideChar(CP_ACP, 0, pathname, -1, wPathname, 256);
+ hfile = CreateFile(wPathname, GENERIC_READ,
+ FILE_SHARE_READ|FILE_SHARE_WRITE,
+ NULL,
+ CREATE_NEW,
+ FILE_ATTRIBUTE_HIDDEN,
+ NULL);
+ if (hfile == INVALID_HANDLE_VALUE) {
+ printf("testfile failed to create/open hidden file %s [0, %d]\n",
+ pathname, GetLastError());
+ return -1;
+ }
+ CloseHandle(hfile);
+
#elif defined(XP_PC) && defined(WIN32)
DPRINTF(("Creating hidden test file %s\n",pathname));
hfile = CreateFile(pathname, GENERIC_READ,
@@ -980,7 +1005,22 @@ int main(int argc, char **argv)
exit(2);
}
#ifdef WIN32
+
+#ifdef WINCE
+ {
+ WCHAR tdir[TMPDIR_LEN];
+ len = GetTempPath(TMPDIR_LEN, tdir);
+ if ((len > 0) && (len < (TMPDIR_LEN - 6))) {
+ /*
+ * enough space for prdir
+ */
+ WideCharToMultiByte(CP_ACP, 0, tdir, -1, testdir, TMPDIR_LEN, 0, 0);
+ }
+ }
+#else
len = GetTempPath(TMPDIR_LEN, testdir);
+#endif /* WINCE */
+
if ((len > 0) && (len < (TMPDIR_LEN - 6))) {
/*
* enough space for prdir
@@ -989,8 +1029,7 @@ int main(int argc, char **argv)
TEST_DIR = testdir;
printf("TEST_DIR = %s\n",TEST_DIR);
}
-
-#endif
+#endif /* WIN32 */
if (FileTest() < 0) {
printf("File Test failed\n");
diff --git a/pr/tests/threads.c b/pr/tests/threads.c
index e1d188d4..eba0bcdf 100644
--- a/pr/tests/threads.c
+++ b/pr/tests/threads.c
@@ -42,6 +42,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/thrpool_client.c b/pr/tests/thrpool_client.c
index 9f6ceb69..10e2ebc3 100644
--- a/pr/tests/thrpool_client.c
+++ b/pr/tests/thrpool_client.c
@@ -61,6 +61,8 @@
#include <process.h>
#endif
+#include "nst_wince.h"
+
static int _debug_on = 0;
static int server_port = -1;
static char *program_name = NULL;
@@ -346,8 +348,7 @@ TCP_Socket_Client_Server_Test(void)
/************************************************************************/
-int
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
/*
* -d debug mode
diff --git a/pr/tests/thrpool_server.c b/pr/tests/thrpool_server.c
index d8b92438..88726b11 100644
--- a/pr/tests/thrpool_server.c
+++ b/pr/tests/thrpool_server.c
@@ -68,6 +68,8 @@
#include <process.h>
#endif
+#include "nst_wince.h"
+
static int _debug_on = 0;
static char *program_name = NULL;
static void serve_client_write(void *arg);
@@ -396,7 +398,9 @@ TCP_Server(void *arg)
int index = 0;
char port[32];
char path[1024 + sizeof("/thrpool_client")];
- (void)getcwd(path, sizeof(path));
+
+ getcwd(path, sizeof(path));
+
(void)strcat(path, "/thrpool_client");
#ifdef XP_PC
(void)strcat(path, ".exe");
@@ -545,8 +549,7 @@ exit:
#define DEFAULT_MAX_THREADS 100
#define DEFAULT_STACKSIZE (512 * 1024)
-int
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
PRInt32 initial_threads = DEFAULT_INITIAL_THREADS;
PRInt32 max_threads = DEFAULT_MAX_THREADS;
diff --git a/pr/tests/thruput.c b/pr/tests/thruput.c
index e6319dbe..6aa9ed28 100644
--- a/pr/tests/thruput.c
+++ b/pr/tests/thruput.c
@@ -60,6 +60,8 @@
#include "plerror.h"
#include "plgetopt.h"
+#include "nst_wince.h"
+
#define ADDR_BUFFER 100
#define PORT_NUMBER 51877
#define SAMPLING_INTERVAL 10
@@ -320,7 +322,7 @@ static void Help(void)
PR_fprintf(err, "\t\tthe server and not act as a client.\n");
} /* Help */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PLOptStatus os;
const char *server_name = NULL;
diff --git a/pr/tests/time.c b/pr/tests/time.c
index b8e7d61a..89928d5c 100644
--- a/pr/tests/time.c
+++ b/pr/tests/time.c
@@ -59,6 +59,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
+#include "nst_wince.h"
#define DEFAULT_COUNT 100000
PRInt32 count;
@@ -152,7 +153,7 @@ static void Measure(void (*func)(void), const char *msg)
if (debug_mode) printf("%40s: %6.2f usec avg, %d msec total\n", msg, d / count, tot);
}
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
/* The command line argument: -d is used to determine if the test is being run
in debug mode. The regress tool requires only one line output:PASS or FAIL.
diff --git a/pr/tests/timemac.c b/pr/tests/timemac.c
index c58c24bd..b8ff47cb 100644
--- a/pr/tests/timemac.c
+++ b/pr/tests/timemac.c
@@ -42,6 +42,7 @@
#include <stdio.h>
#include "prinit.h"
#include "prtime.h"
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/timetest.c b/pr/tests/timetest.c
index c57c15e6..5828d752 100644
--- a/pr/tests/timetest.c
+++ b/pr/tests/timetest.c
@@ -52,6 +52,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/tmoacc.c b/pr/tests/tmoacc.c
index fa974a13..5a2f3f7e 100644
--- a/pr/tests/tmoacc.c
+++ b/pr/tests/tmoacc.c
@@ -42,6 +42,7 @@
#include "plerror.h"
#include "plgetopt.h"
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/tmocon.c b/pr/tests/tmocon.c
index ea4b49de..9cd677a5 100644
--- a/pr/tests/tmocon.c
+++ b/pr/tests/tmocon.c
@@ -64,6 +64,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
/* for getcwd */
#if defined(XP_UNIX) || defined (XP_OS2) || defined(XP_BEOS)
@@ -125,7 +126,9 @@ static PRStatus MakeReceiver(Shared *shared)
{
char *argv[3];
char path[1024 + sizeof("/tmoacc")];
- (void)getcwd(path, sizeof(path));
+
+ getcwd(path, sizeof(path));
+
(void)strcat(path, "/tmoacc");
#ifdef XP_PC
(void)strcat(path, ".exe");
diff --git a/pr/tests/tpd.c b/pr/tests/tpd.c
index c9bc5c78..c24982bc 100644
--- a/pr/tests/tpd.c
+++ b/pr/tests/tpd.c
@@ -54,6 +54,7 @@
#endif
#include "plgetopt.h"
+#include "nst_wince.h"
static PRUintn key[128];
static PRIntn debug = 0;
@@ -310,7 +311,7 @@ static PRIntn PR_CALLBACK Tpd(PRIntn argc, char **argv)
} /* Tpd */
-PRIntn main(PRIntn argc, char *argv[])
+int main(int argc, char **argv)
{
PLOptStatus os;
PLOptState *opt = PL_CreateOptState(argc, argv, "dl:r:");
diff --git a/pr/tests/udpsrv.c b/pr/tests/udpsrv.c
index b9b615a2..e288103b 100644
--- a/pr/tests/udpsrv.c
+++ b/pr/tests/udpsrv.c
@@ -82,6 +82,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include "nst_wince.h"
#ifdef XP_PC
#define mode_t int
diff --git a/pr/tests/vercheck.c b/pr/tests/vercheck.c
index 2f77fcf9..edf496f2 100644
--- a/pr/tests/vercheck.c
+++ b/pr/tests/vercheck.c
@@ -50,6 +50,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "nst_wince.h"
/*
* This release (4.8) is backward compatible with the
@@ -83,7 +84,7 @@ static char *incompatible_version[] = {
"10.0", "11.1", "12.14.20"
};
-int main()
+int main(int argc, char **argv)
{
int idx;
int num_compatible = sizeof(compatible_version) / sizeof(char *);
diff --git a/pr/tests/version.c b/pr/tests/version.c
index 597f5571..ba1516c4 100644
--- a/pr/tests/version.c
+++ b/pr/tests/version.c
@@ -42,10 +42,11 @@
#include "plerror.h"
#include "plgetopt.h"
+#include "nst_wince.h"
PR_IMPORT(const PRVersionDescription *) libVersionPoint(void);
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRIntn rv = 1;
PLOptStatus os;
diff --git a/pr/tests/wince_tester.cpp b/pr/tests/wince_tester.cpp
new file mode 100644
index 00000000..264ee90c
--- /dev/null
+++ b/pr/tests/wince_tester.cpp
@@ -0,0 +1,321 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is the Netscape Portable Runtime (NSPR).
+ *
+ * The Initial Developer of the Original Code is John Wolfe
+ * Portions created by the Initial Developer are Copyright (C) 1998-2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifdef WINCE
+
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+typedef int (*pMainFnc) (int argc, char **argv);
+
+
+#define MAX_ARG_LENGTH 2048
+
+
+/* Set this next global variable to skip down the list of tests */
+/* A "" string will mean that no modules are skipped */
+WCHAR * skip_until = TEXT(""); /* */
+/* WCHAR * skip_until = TEXT("join"); /* */
+
+
+typedef struct TEST_MODULE_ITEM_NAME {
+ WCHAR *pW;
+ CHAR *pC;
+} TestModuleItemName, *pTestModuleItemName;
+
+#define TEST_MODULE_ITEM(x) { TEXT(x), x }
+#define END_POINT_MARKER { NULL, NULL }
+
+
+TestModuleItemName test_module_list[] =
+{
+ TEST_MODULE_ITEM("accept"),
+ TEST_MODULE_ITEM("acceptread"),
+ TEST_MODULE_ITEM("acceptreademu"),
+ TEST_MODULE_ITEM("affinity"),
+ TEST_MODULE_ITEM("alarm"),
+ TEST_MODULE_ITEM("anonfm"),
+ TEST_MODULE_ITEM("atomic"),
+ TEST_MODULE_ITEM("attach"),
+ TEST_MODULE_ITEM("bigfile"),
+ TEST_MODULE_ITEM("cleanup"),
+ TEST_MODULE_ITEM("cltsrv"),
+ TEST_MODULE_ITEM("concur"),
+ TEST_MODULE_ITEM("cvar"),
+ TEST_MODULE_ITEM("cvar2"),
+ TEST_MODULE_ITEM("dlltest"),
+ TEST_MODULE_ITEM("dtoa"),
+ TEST_MODULE_ITEM("errcodes"),
+ TEST_MODULE_ITEM("exit"),
+ TEST_MODULE_ITEM("fdcach"),
+ TEST_MODULE_ITEM("fileio"),
+ TEST_MODULE_ITEM("foreign"),
+ TEST_MODULE_ITEM("formattm"),
+ TEST_MODULE_ITEM("fsync"),
+ TEST_MODULE_ITEM("gethost"),
+ TEST_MODULE_ITEM("getproto"),
+ TEST_MODULE_ITEM("i2l"),
+ TEST_MODULE_ITEM("initclk"),
+ TEST_MODULE_ITEM("inrval"),
+ TEST_MODULE_ITEM("instrumt"),
+ TEST_MODULE_ITEM("intrio"),
+ TEST_MODULE_ITEM("intrupt"),
+ TEST_MODULE_ITEM("io_timeout"),
+ TEST_MODULE_ITEM("ioconthr"),
+ TEST_MODULE_ITEM("join"),
+ TEST_MODULE_ITEM("joinkk"),
+ TEST_MODULE_ITEM("joinku"),
+ TEST_MODULE_ITEM("joinuk"),
+ TEST_MODULE_ITEM("joinuu"),
+ TEST_MODULE_ITEM("layer"),
+ TEST_MODULE_ITEM("lazyinit"),
+ TEST_MODULE_ITEM("libfilename"),
+ TEST_MODULE_ITEM("lltest"),
+ TEST_MODULE_ITEM("lock"),
+ TEST_MODULE_ITEM("lockfile"),
+ TEST_MODULE_ITEM("logger"),
+ TEST_MODULE_ITEM("many_cv"),
+ TEST_MODULE_ITEM("multiwait"),
+ TEST_MODULE_ITEM("nameshm1"),
+ TEST_MODULE_ITEM("nblayer"),
+ TEST_MODULE_ITEM("nonblock"),
+ TEST_MODULE_ITEM("ntioto"),
+ TEST_MODULE_ITEM("ntoh"),
+ TEST_MODULE_ITEM("op_2long"),
+ TEST_MODULE_ITEM("op_excl"),
+ TEST_MODULE_ITEM("op_filnf"),
+ TEST_MODULE_ITEM("op_filok"),
+ TEST_MODULE_ITEM("op_nofil"),
+ TEST_MODULE_ITEM("parent"),
+ TEST_MODULE_ITEM("peek"),
+ TEST_MODULE_ITEM("perf"),
+ TEST_MODULE_ITEM("pipeping"),
+ TEST_MODULE_ITEM("pipeping2"),
+ TEST_MODULE_ITEM("pipeself"),
+ TEST_MODULE_ITEM("poll_nm"),
+ TEST_MODULE_ITEM("poll_to"),
+ TEST_MODULE_ITEM("pollable"),
+ TEST_MODULE_ITEM("prftest"),
+ TEST_MODULE_ITEM("primblok"),
+ TEST_MODULE_ITEM("provider"),
+ TEST_MODULE_ITEM("prpollml"),
+ TEST_MODULE_ITEM("ranfile"),
+ TEST_MODULE_ITEM("randseed"),
+ TEST_MODULE_ITEM("rwlocktest"),
+ TEST_MODULE_ITEM("sel_spd"),
+ TEST_MODULE_ITEM("selct_er"),
+ TEST_MODULE_ITEM("selct_nm"),
+ TEST_MODULE_ITEM("selct_to"),
+ TEST_MODULE_ITEM("selintr"),
+ TEST_MODULE_ITEM("sema"),
+ TEST_MODULE_ITEM("semaerr"),
+ TEST_MODULE_ITEM("semaping"),
+ TEST_MODULE_ITEM("sendzlf"),
+ TEST_MODULE_ITEM("server_test"),
+ TEST_MODULE_ITEM("servr_kk"),
+ TEST_MODULE_ITEM("servr_uk"),
+ TEST_MODULE_ITEM("servr_ku"),
+ TEST_MODULE_ITEM("servr_uu"),
+ TEST_MODULE_ITEM("short_thread"),
+ TEST_MODULE_ITEM("sigpipe"),
+ TEST_MODULE_ITEM("socket"),
+ TEST_MODULE_ITEM("sockopt"),
+ TEST_MODULE_ITEM("sockping"),
+ TEST_MODULE_ITEM("sprintf"),
+ TEST_MODULE_ITEM("stack"),
+ TEST_MODULE_ITEM("stdio"),
+ TEST_MODULE_ITEM("str2addr"),
+ TEST_MODULE_ITEM("strod"),
+ TEST_MODULE_ITEM("switch"),
+ TEST_MODULE_ITEM("system"),
+ TEST_MODULE_ITEM("testbit"),
+ TEST_MODULE_ITEM("testfile"),
+ TEST_MODULE_ITEM("threads"),
+ TEST_MODULE_ITEM("timemac"),
+ TEST_MODULE_ITEM("timetest"),
+ TEST_MODULE_ITEM("tpd"),
+ TEST_MODULE_ITEM("udpsrv"),
+ TEST_MODULE_ITEM("vercheck"),
+ TEST_MODULE_ITEM("version"),
+ TEST_MODULE_ITEM("writev"),
+ TEST_MODULE_ITEM("xnotify"),
+ TEST_MODULE_ITEM("zerolen"),
+ END_POINT_MARKER
+};
+
+
+int main(int argc, char **argv)
+{
+ int i,j;
+ char mydir[MAX_ARG_LENGTH];
+
+ char **pp = argv;
+
+ /* Get File Name, strip back to first '\' and what is left is the
+ * path of the executable.
+ */
+
+ SetLastError(0);
+
+ TestModuleItemName *p = test_module_list;
+
+ int skipped = 0;
+
+ printf("\nNSPR Test Results\n");
+
+ WCHAR dateWStr[100];
+ GetDateFormat(NULL, NULL, NULL, TEXT("ddd, MMM dd yyyy"), dateWStr, 100);
+
+ WCHAR timeWStr[100];
+ GetTimeFormat(NULL, TIME_NOSECONDS, NULL, TEXT(" - h:mm tt"), timeWStr, 100);
+
+ wcscat(dateWStr, timeWStr);
+
+ char dateStr[100];
+ int rv = WideCharToMultiByte(CP_ACP, NULL, dateWStr, 100, dateStr, 100, NULL, NULL);
+
+ printf("BEGIN\t%s\n", dateStr);
+ OutputDebugString(L"BEGINNING TEST RUN\n");
+
+ if ( 0 < wcslen(skip_until) )
+ {
+ /* keep going until we find the module at which we want to start */
+ while ( (0 < wcslen(skip_until)) &&
+ (NULL != p) && (NULL != p->pW) && (0 < wcslen(p->pW)) &&
+ (0 != wcscmp(p->pW, skip_until)) )
+ {
+ p++, skipped++;
+ }
+
+ if ( (NULL == p) || (NULL == p->pW) || (0 == wcslen(p->pW)) ) {
+ printf("main: EXITING - no tests to run (Skipped %d tests)\n", skipped);
+ return 0;
+ }
+ }
+
+ printf(" Test\tResult\n\n");
+
+ int succeeded = 0;
+ int failed = 0;
+ int total = 0;
+
+ while ( (NULL != p) && (NULL != p->pW) && (0 < wcslen(p->pW)) )
+ {
+ int rv = -1;
+ BOOL bFailed = FALSE;
+ HMODULE hDll = NULL;
+ WCHAR wStr[500];
+
+ printf("\nBEGIN TEST %s\n\n", ((NULL != p) ? p->pC : "????")); /* Should be shunted to LOG FILE */
+ wsprintf(wStr, L"BEGIN TEST - %s\n", p->pW);
+ OutputDebugString(wStr);
+
+ __try
+ {
+ WCHAR dllName[256];
+
+ wsprintf(dllName, TEXT("%s.dll"), ((NULL != p) ? p->pW : TEXT("BOGUS_MODULE_NAME")));
+
+ /* Find and load the DLL */
+ hDll = LoadLibrary(dllName);
+
+ if ( NULL != hDll )
+ {
+ /* Call the entry point for testing */
+ pMainFnc pMF = (pMainFnc) GetProcAddress( hDll, "nspr_test_runme" );
+
+ if ( pMF )
+ rv = (*pMF)(0, NULL);
+ }
+
+ /* Check the return code (0 == Success) */
+ if (0 != rv) {
+ failed++;
+ bFailed = TRUE;
+ } else
+ succeeded++;
+ }
+ __except ( 1 ) /* Handle ALL exceptions here */
+ {
+ failed++;
+ bFailed = TRUE;
+ }
+
+ if ( NULL != hDll ) {
+ FreeLibrary( hDll );
+ hDll = NULL;
+ }
+
+ total++;
+
+ printf(" %s\t%s\n", ((NULL != p) ? p->pC : "????"), (bFailed ? "FAILED" : "Passed"));
+
+ {
+ WCHAR str[400];
+ if ( bFailed )
+ wsprintf(str, TEXT("----FAILED----: TEST %s: ------FAILED------\n"), p->pW);
+ else
+ wsprintf(str, TEXT("++++PASSED++++: TEST %s: ++++++PASSED++++++\n"), p->pW);
+ OutputDebugString(str);
+ }
+
+ printf("\nEND TEST %s\n\n", ((NULL != p) ? p->pC : "????")); /* Should be shunted to LOG FILE */
+
+ p++;
+ }
+
+ printf("\n\n**********\nNSPR Test Results:");
+ printf(" Skipped Tests = %d", skipped);
+ printf(" Total Run Tests = %d", total);
+ printf(" Succeeded Tests = %d", succeeded);
+ printf(" Failed Tests = %d\n\n**********\n", failed);
+
+ return 0;
+}
+
+#else /* !WINCE */
+
+int main(int argc, char **argv)
+{
+ printf( "This application is not supported outside of WinCE/WinMobile\n" );
+ return 0;
+}
+
+#endif /* !WINCE */
diff --git a/pr/tests/writev.c b/pr/tests/writev.c
index 603526c9..dd9fc0c9 100644
--- a/pr/tests/writev.c
+++ b/pr/tests/writev.c
@@ -41,6 +41,7 @@
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/xnotify.c b/pr/tests/xnotify.c
index 97f64917..d064d2f6 100644
--- a/pr/tests/xnotify.c
+++ b/pr/tests/xnotify.c
@@ -49,6 +49,7 @@
#include "prinit.h"
#include "prinrval.h"
#include "prthread.h"
+#include "nst_wince.h"
static PRLock *ml = NULL;
static PRIntervalTime base;
@@ -378,7 +379,7 @@ static PRIntn PR_CALLBACK RealMain( PRIntn argc, char **argv )
} /* main */
-PRIntn main(PRIntn argc, char **argv)
+int main(int argc, char **argv)
{
PRIntn rv;
diff --git a/pr/tests/y2k.c b/pr/tests/y2k.c
index 80fc10a5..7565096d 100644
--- a/pr/tests/y2k.c
+++ b/pr/tests/y2k.c
@@ -55,6 +55,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "nst_wince.h"
#ifdef XP_MAC
#include "prlog.h"
diff --git a/pr/tests/y2ktmo.c b/pr/tests/y2ktmo.c
index a37ae072..06626587 100644
--- a/pr/tests/y2ktmo.c
+++ b/pr/tests/y2ktmo.c
@@ -71,10 +71,11 @@
#if defined(XP_UNIX)
#include <sys/time.h> /* for gettimeofday */
#endif
-#if defined(WIN32)
+#if defined(WIN32) && !defined(WINCE)
#include <sys/types.h>
#include <sys/timeb.h> /* for _ftime */
#endif
+#include "nst_wince.h"
#define DEFAULT_LEAD_TIME_SECS 5
#define DEFAULT_TOLERANCE_MSECS 500
@@ -89,8 +90,12 @@ static PRIntervalTime tolerance;
static struct timeval start_time_tv;
#endif
#if defined(WIN32)
+#if defined(WINCE)
+static DWORD start_time_tick;
+#else
static struct _timeb start_time_tb;
#endif
+#endif
static void SleepThread(void *arg)
{
@@ -103,7 +108,7 @@ static void SleepThread(void *arg)
#if defined(XP_UNIX)
struct timeval end_time_tv;
#endif
-#if defined(WIN32)
+#if defined(WIN32) && !defined(WINCE)
struct _timeb end_time_tb;
#endif
@@ -122,10 +127,14 @@ static void SleepThread(void *arg)
+ (end_time_tv.tv_usec - start_time_tv.tv_usec)/1000;
#endif
#if defined(WIN32)
+#if defined(WINCE)
+ elapsed_msecs = GetTickCount() - start_time_tick;
+#else
_ftime(&end_time_tb);
elapsed_msecs = 1000*(end_time_tb.time - start_time_tb.time)
+ (end_time_tb.millitm - start_time_tb.millitm);
#endif
+#endif
#if defined(XP_UNIX) || defined(WIN32)
if (elapsed_msecs + tolerance_msecs < timeout_msecs
|| elapsed_msecs > timeout_msecs + tolerance_msecs) {
@@ -150,7 +159,7 @@ static void AcceptThread(void *arg)
#if defined(XP_UNIX)
struct timeval end_time_tv;
#endif
-#if defined(WIN32)
+#if defined(WIN32) && !defined(WINCE)
struct _timeb end_time_tb;
#endif
PRFileDesc *sock;
@@ -190,10 +199,14 @@ static void AcceptThread(void *arg)
+ (end_time_tv.tv_usec - start_time_tv.tv_usec)/1000;
#endif
#if defined(WIN32)
+#if defined(WINCE)
+ elapsed_msecs = GetTickCount() - start_time_tick;
+#else
_ftime(&end_time_tb);
elapsed_msecs = 1000*(end_time_tb.time - start_time_tb.time)
+ (end_time_tb.millitm - start_time_tb.millitm);
#endif
+#endif
#if defined(XP_UNIX) || defined(WIN32)
if (elapsed_msecs + tolerance_msecs < timeout_msecs
|| elapsed_msecs > timeout_msecs + tolerance_msecs) {
@@ -222,7 +235,7 @@ static void PollThread(void *arg)
#if defined(XP_UNIX)
struct timeval end_time_tv;
#endif
-#if defined(WIN32)
+#if defined(WIN32) && !defined(WINCE)
struct _timeb end_time_tb;
#endif
PRFileDesc *sock;
@@ -265,10 +278,14 @@ static void PollThread(void *arg)
+ (end_time_tv.tv_usec - start_time_tv.tv_usec)/1000;
#endif
#if defined(WIN32)
+#if defined(WINCE)
+ elapsed_msecs = GetTickCount() - start_time_tick;
+#else
_ftime(&end_time_tb);
elapsed_msecs = 1000*(end_time_tb.time - start_time_tb.time)
+ (end_time_tb.millitm - start_time_tb.millitm);
#endif
+#endif
#if defined(XP_UNIX) || defined(WIN32)
if (elapsed_msecs + tolerance_msecs < timeout_msecs
|| elapsed_msecs > timeout_msecs + tolerance_msecs) {
@@ -297,7 +314,7 @@ static void WaitCondVarThread(void *arg)
#if defined(XP_UNIX)
struct timeval end_time_tv;
#endif
-#if defined(WIN32)
+#if defined(WIN32) && !defined(WINCE)
struct _timeb end_time_tb;
#endif
PRLock *ml;
@@ -327,10 +344,14 @@ static void WaitCondVarThread(void *arg)
+ (end_time_tv.tv_usec - start_time_tv.tv_usec)/1000;
#endif
#if defined(WIN32)
+#if defined(WINCE)
+ elapsed_msecs = GetTickCount() - start_time_tick;
+#else
_ftime(&end_time_tb);
elapsed_msecs = 1000*(end_time_tb.time - start_time_tb.time)
+ (end_time_tb.millitm - start_time_tb.millitm);
#endif
+#endif
#if defined(XP_UNIX) || defined(WIN32)
if (elapsed_msecs + tolerance_msecs < timeout_msecs
|| elapsed_msecs > timeout_msecs + tolerance_msecs) {
@@ -357,7 +378,7 @@ static void WaitMonitorThread(void *arg)
#if defined(XP_UNIX)
struct timeval end_time_tv;
#endif
-#if defined(WIN32)
+#if defined(WIN32) && !defined(WINCE)
struct _timeb end_time_tb;
#endif
PRMonitor *mon;
@@ -381,10 +402,14 @@ static void WaitMonitorThread(void *arg)
+ (end_time_tv.tv_usec - start_time_tv.tv_usec)/1000;
#endif
#if defined(WIN32)
+#if defined(WINCE)
+ elapsed_msecs = GetTickCount() - start_time_tick;
+#else
_ftime(&end_time_tb);
elapsed_msecs = 1000*(end_time_tb.time - start_time_tb.time)
+ (end_time_tb.millitm - start_time_tb.millitm);
#endif
+#endif
#if defined(XP_UNIX) || defined(WIN32)
if (elapsed_msecs + tolerance_msecs < timeout_msecs
|| elapsed_msecs > timeout_msecs + tolerance_msecs) {
@@ -410,7 +435,7 @@ static void WaitCMonitorThread(void *arg)
#if defined(XP_UNIX)
struct timeval end_time_tv;
#endif
-#if defined(WIN32)
+#if defined(WIN32) && !defined(WINCE)
struct _timeb end_time_tb;
#endif
int dummy;
@@ -429,10 +454,14 @@ static void WaitCMonitorThread(void *arg)
+ (end_time_tv.tv_usec - start_time_tv.tv_usec)/1000;
#endif
#if defined(WIN32)
+#if defined(WINCE)
+ elapsed_msecs = GetTickCount() - start_time_tick;
+#else
_ftime(&end_time_tb);
elapsed_msecs = 1000*(end_time_tb.time - start_time_tb.time)
+ (end_time_tb.millitm - start_time_tb.millitm);
#endif
+#endif
#if defined(XP_UNIX) || defined(WIN32)
if (elapsed_msecs + tolerance_msecs < timeout_msecs
|| elapsed_msecs > timeout_msecs + tolerance_msecs) {
@@ -507,8 +536,12 @@ int main(int argc, char **argv)
gettimeofday(&start_time_tv, NULL);
#endif
#if defined(WIN32)
+#ifdef WINCE
+ start_time_tick = GetTickCount();
+#else
_ftime(&start_time_tb);
#endif
+#endif
tolerance = PR_MillisecondsToInterval(tolerance_msecs);
threads = PR_Malloc(
diff --git a/pr/tests/yield.c b/pr/tests/yield.c
index 5f441a19..74d8f1bd 100644
--- a/pr/tests/yield.c
+++ b/pr/tests/yield.c
@@ -45,6 +45,7 @@
#include "primpl.h"
#include <os2.h>
#endif
+#include "nst_wince.h"
#define THREADS 10
@@ -65,7 +66,7 @@ threadmain(void *_id)
}
-main()
+int main(int argc, char **argv)
{
int index;
PRThread *a[THREADS];
diff --git a/pr/tests/zerolen.c b/pr/tests/zerolen.c
index f43f60fd..1fa76c39 100644
--- a/pr/tests/zerolen.c
+++ b/pr/tests/zerolen.c
@@ -55,8 +55,9 @@
#ifndef XP_UNIX
#include <stdio.h>
+#include "nst_wince.h"
-int main()
+int main(int argc, char **argv)
{
printf("PASS\n");
return 0;