Bug 1579448 - Multiple changes to NSPR tests, find the mimimum set of tests that currently work on all platforms, prepare to reenable CI in 2019. r=jbeich
authorKai Engert <kaie@kuix.de>
Fri, 08 Nov 2019 09:10:59 +0100
changeset 4849 d03855113364d4a9f182a9f820b1787fd1100364
parent 4848 7e90655ec65dc776d5eef873adc3a2ee0f10f1e3
child 4850 e31429fc131228989331dad7c7b583fce1e9ad0c
push id347
push userkaie@kuix.de
push dateFri, 08 Nov 2019 08:11:18 +0000
reviewersjbeich
bugs1579448
Bug 1579448 - Multiple changes to NSPR tests, find the mimimum set of tests that currently work on all platforms, prepare to reenable CI in 2019. r=jbeich
pr/tests/Makefile.in
pr/tests/acceptread.c
pr/tests/acceptreademu.c
pr/tests/append.c
pr/tests/cltsrv.c
pr/tests/fdcach.c
pr/tests/foreign.c
pr/tests/fsync.c
pr/tests/gethost.c
pr/tests/layer.c
pr/tests/lazyinit.c
pr/tests/multiwait.c
pr/tests/nameshm1.c
pr/tests/nblayer.c
pr/tests/ntioto.c
pr/tests/op_filnf.c
pr/tests/provider.c
pr/tests/runtests.pl
pr/tests/runtests.sh
pr/tests/sel_spd.c
pr/tests/sema.c
pr/tests/semaerr.c
pr/tests/semaerr1.c
pr/tests/semaping.c
pr/tests/semapong.c
pr/tests/socket.c
pr/tests/testfile.c
pr/tests/thruput.c
pr/tests/tmoacc.c
pr/tests/tmocon.c
pr/tests/writev.c
--- a/pr/tests/Makefile.in
+++ b/pr/tests/Makefile.in
@@ -437,22 +437,9 @@ endif
 
 ifeq ($(OS_TARGET),Linux)
 ECHO = /bin/echo
 endif
 
 ALWAYS:
 
 runtests:: $(PROGS) ALWAYS
-	@$(ECHO) "\nNSPR Test Results - $(OBJDIR)\n"
-	@$(ECHO) "BEGIN\t\t\t`date`"
-	@$(ECHO) "NSPR_TEST_LOGFILE\t$(LOGFILE)\n"
-	@$(ECHO) "Test\t\t\tResult\n"
-	@cd $(OBJDIR); for i in $(PROGRAMS); do					\
-	$(ECHO) "$$i\c";										\
-	./$$i >> $(LOGFILE) 2>&1 ;								\
-	if  [ 0 = $$? ] ; then									\
-		$(ECHO) "\t\t\tPassed";								\
-	else													\
-		$(ECHO) "\t\t\tFAILED";								\
-	fi;														\
-	done
-	@$(ECHO) "\nEND\t\t`date`\n"
+	$(topsrcdir)/pr/tests/runtests.sh $(DIST)
--- a/pr/tests/acceptread.c
+++ b/pr/tests/acceptread.c
@@ -9,17 +9,28 @@
 #include <prnetdb.h>
 #include <prinrval.h>
 #include <prthread.h>
 
 #include <plerror.h>
 
 #include <stdlib.h>
 
-#define DEFAULT_PORT 12273
+#ifdef DEBUG
+#define PORT_INC_DO +100
+#else
+#define PORT_INC_DO
+#endif
+#ifdef IS_64
+#define PORT_INC_3264 +200
+#else
+#define PORT_INC_3264
+#endif
+
+#define DEFAULT_PORT 12273 PORT_INC_DO PORT_INC_3264
 #define GET "GET / HTTP/1.0\n\n"
 static PRFileDesc *std_out, *err_out;
 static PRIntervalTime write_dally, accept_timeout;
 
 static PRStatus PrintAddress(const PRNetAddr* address)
 {
     char buffer[100];
     PRStatus rv = PR_NetAddrToString(address, buffer, sizeof(buffer));
--- a/pr/tests/acceptreademu.c
+++ b/pr/tests/acceptreademu.c
@@ -15,17 +15,28 @@
 #include <prinrval.h>
 #include <prthread.h>
 #include <pprio.h>
 
 #include <plerror.h>
 
 #include <stdlib.h>
 
-#define DEFAULT_PORT 12273
+#ifdef DEBUG
+#define PORT_INC_DO +100
+#else
+#define PORT_INC_DO
+#endif
+#ifdef IS_64
+#define PORT_INC_3264 +200
+#else
+#define PORT_INC_3264
+#endif
+
+#define DEFAULT_PORT 12273 PORT_INC_DO PORT_INC_3264
 #define GET "GET / HTTP/1.0\n\n"
 static PRFileDesc *std_out, *err_out;
 static PRIntervalTime write_dally, accept_timeout;
 static PRDescIdentity emu_layer_ident;
 static PRIOMethods emu_layer_methods;
 
 /* the acceptread method in emu_layer_methods */
 static PRInt32 PR_CALLBACK emu_AcceptRead(PRFileDesc *sd, PRFileDesc **nd,
--- a/pr/tests/append.c
+++ b/pr/tests/append.c
@@ -57,17 +57,17 @@ int main(int argc, char **argv)
                     break;
                 default:
                     break;
             }
         }
         PL_DestroyOptState(opt);
     } /* end block "Get command line options" */
     /* ---------------------------------------------------------------------- */
-    fd = PR_Open( "/tmp/nsprAppend", (PR_APPEND | PR_CREATE_FILE | PR_TRUNCATE | PR_WRONLY), 0666 );
+    fd = PR_Open( "./tmp-nsprAppend", (PR_APPEND | PR_CREATE_FILE | PR_TRUNCATE | PR_WRONLY), 0666 );
     if ( NULL == fd )  {
         if (debug) {
             printf("PR_Open() failed for writing: %d\n", PR_GetError());
         }
         failedAlready = PR_TRUE;
         goto Finished;
     }
 
@@ -93,17 +93,17 @@ int main(int argc, char **argv)
     if ( PR_FAILURE == rc ) {
         if (debug) {
             printf("PR_Close() failed after writing: %d\n", PR_GetError());
         }
         failedAlready = PR_TRUE;
         goto Finished;
     }
     /* ---------------------------------------------------------------------- */
-    fd = PR_Open( "/tmp/nsprAppend", PR_RDONLY, 0 );
+    fd = PR_Open( "./tmp-nsprAppend", PR_RDONLY, 0 );
     if ( NULL == fd )  {
         if (debug) {
             printf("PR_Open() failed for reading: %d\n", PR_GetError());
         }
         failedAlready = PR_TRUE;
         goto Finished;
     }
 
--- a/pr/tests/cltsrv.c
+++ b/pr/tests/cltsrv.c
@@ -59,17 +59,30 @@
 */
 
 #define RECV_FLAGS 0
 #define SEND_FLAGS 0
 #define DEFAULT_LOW 0
 #define DEFAULT_HIGH 0
 #define BUFFER_SIZE 1024
 #define DEFAULT_BACKLOG 5
-#define DEFAULT_PORT 12849
+
+#ifdef DEBUG
+#define PORT_INC_DO +100
+#else
+#define PORT_INC_DO
+#endif
+#ifdef IS_64
+#define PORT_INC_3264 +200
+#else
+#define PORT_INC_3264
+#endif
+
+#define DEFAULT_PORT 12849 PORT_INC_DO PORT_INC_3264
+
 #define DEFAULT_CLIENTS 1
 #define ALLOWED_IN_ACCEPT 1
 #define DEFAULT_CLIPPING 1000
 #define DEFAULT_WORKERS_MIN 1
 #define DEFAULT_WORKERS_MAX 1
 #define DEFAULT_SERVER "localhost"
 #define DEFAULT_EXECUTION_TIME 10
 #define DEFAULT_CLIENT_TIMEOUT 4000
@@ -787,21 +800,26 @@ static void PR_CALLBACK Server(void *arg
 
     sockOpt.option = PR_SockOpt_Reuseaddr;
     sockOpt.value.reuse_addr = PR_TRUE;
     rv = PR_SetSocketOption(server->listener, &sockOpt);
     TEST_ASSERT(PR_SUCCESS == rv);
 
     memset(&serverAddress, 0, sizeof(serverAddress));
     if (PR_AF_INET6 != domain) {
+        TEST_LOG(cltsrv_log_file, TEST_LOG_ALWAYS,
+                 ("server binding to ip port %s\n", DEFAULT_PORT));
         rv = PR_InitializeNetAddr(PR_IpAddrAny, DEFAULT_PORT, &serverAddress);
     }
-    else
+    else {
+        TEST_LOG(cltsrv_log_file, TEST_LOG_ALWAYS,
+                 ("server binding to ipv6 port %s\n", DEFAULT_PORT));
         rv = PR_SetNetAddr(PR_IpAddrAny, PR_AF_INET6, DEFAULT_PORT,
                            &serverAddress);
+    }
     rv = PR_Bind(server->listener, &serverAddress);
     TEST_ASSERT(PR_SUCCESS == rv);
 
     rv = PR_Listen(server->listener, server->backlog);
     TEST_ASSERT(PR_SUCCESS == rv);
 
     server->started = PR_IntervalNow();
     TimeOfDayMessage("Server started at", me);
@@ -1126,26 +1144,34 @@ int main(int argc, char** argv)
         }
 
         for (index = 0; index < clients; ++index)
         {
             client[index].state = cs_init;
             client[index].ml = PR_NewLock();
             if (serverIsLocal)
             {
-                if (PR_AF_INET6 != domain)
+                if (PR_AF_INET6 != domain) {
+                    TEST_LOG(cltsrv_log_file, TEST_LOG_ALWAYS,
+                             ("loopback client ip port %s\n", DEFAULT_PORT));
                     (void)PR_InitializeNetAddr(
                         PR_IpAddrLoopback, DEFAULT_PORT,
                         &client[index].serverAddress);
-                else
+                }
+                else {
+                    TEST_LOG(cltsrv_log_file, TEST_LOG_ALWAYS,
+                             ("loopback client ipv6 port %s\n", DEFAULT_PORT));
                     rv = PR_SetNetAddr(PR_IpAddrLoopback, PR_AF_INET6,
                                        DEFAULT_PORT, &client[index].serverAddress);
+                }
             }
             else
             {
+                TEST_LOG(cltsrv_log_file, TEST_LOG_ALWAYS,
+                         ("client enumerate port %s\n", DEFAULT_PORT));
                 (void)PR_EnumerateHostEnt(
                     0, &host, DEFAULT_PORT, &client[index].serverAddress);
             }
             client[index].stateChange = PR_NewCondVar(client[index].ml);
             TEST_LOG(
                 cltsrv_log_file, TEST_LOG_INFO,
                 ("main(0x%p): creating client threads\n", PR_GetCurrentThread()));
             client[index].thread = PR_CreateThread(
--- a/pr/tests/fdcach.c
+++ b/pr/tests/fdcach.c
@@ -1,51 +1,45 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * File: fdcach.c
  * Description:
- *   This test verifies that the fd cache and stack are working
+ *   This test verifies that the fd cache is working
  *   correctly.
  */
 
 #include "nspr.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 
 /*
  * Define ORDER_PRESERVED if the implementation of PR_SetFDCacheSize
  * preserves the ordering of the fd's when moving them between the
- * cache and the stack.
+ * cache.
  */
 #define ORDER_PRESERVED 1
 
 /*
  * NUM_FDS must be <= FD_CACHE_SIZE.
  */
 #define FD_CACHE_SIZE 1024
 #define NUM_FDS 20
 
 int main(int argc, char **argv)
 {
     int i;
     PRFileDesc *fds[NUM_FDS];
     PRFileDesc *savefds[NUM_FDS];
     int numfds = sizeof(fds)/sizeof(fds[0]);
 
-    /*
-     * Switch between cache and stack when they are empty.
-     * Then start with the fd cache.
-     */
-    PR_SetFDCacheSize(0, FD_CACHE_SIZE);
-    PR_SetFDCacheSize(0, 0);
     PR_SetFDCacheSize(0, FD_CACHE_SIZE);
 
     /* Add some fd's to the fd cache. */
     for (i = 0; i < numfds; i++) {
         savefds[i] = PR_NewTCPSocket();
         if (NULL == savefds[i]) {
             fprintf(stderr, "PR_NewTCPSocket failed\n");
             exit(1);
@@ -77,69 +71,16 @@ int main(int argc, char **argv)
     /* Put the fd's back to the fd cache. */
     for (i = 0; i < numfds; i++) {
         if (PR_Close(savefds[i]) == PR_FAILURE) {
             fprintf(stderr, "PR_Close failed\n");
             exit(1);
         }
     }
 
-    /* Switch to the fd stack. */
-    PR_SetFDCacheSize(0, 0);
-
-    /*
-     * Create some fd's.  These fd's should come from
-     * the fd stack.
-     */
-    for (i = 0; i < numfds; i++) {
-        fds[i] = PR_NewTCPSocket();
-        if (NULL == fds[i]) {
-            fprintf(stderr, "PR_NewTCPSocket failed\n");
-            exit(1);
-        }
-#ifdef ORDER_PRESERVED
-        if (fds[i] != savefds[numfds-1-i]) {
-            fprintf(stderr, "fd stack malfunctioned\n");
-            exit(1);
-        }
-#else
-        savefds[numfds-1-i] = fds[i];
-#endif
-    }
-    /* Put the fd's back to the fd stack. */
-    for (i = 0; i < numfds; i++) {
-        if (PR_Close(savefds[i]) == PR_FAILURE) {
-            fprintf(stderr, "PR_Close failed\n");
-            exit(1);
-        }
-    }
-
-    /*
-     * Now create some fd's and verify the LIFO ordering of
-     * the fd stack.
-     */
-    for (i = 0; i < numfds; i++) {
-        fds[i] = PR_NewTCPSocket();
-        if (NULL == fds[i]) {
-            fprintf(stderr, "PR_NewTCPSocket failed\n");
-            exit(1);
-        }
-        if (fds[i] != savefds[numfds-1-i]) {
-            fprintf(stderr, "fd stack malfunctioned\n");
-            exit(1);
-        }
-    }
-    /* Put the fd's back to the fd stack. */
-    for (i = 0; i < numfds; i++) {
-        if (PR_Close(savefds[i]) == PR_FAILURE) {
-            fprintf(stderr, "PR_Close failed\n");
-            exit(1);
-        }
-    }
-
     /* Switch to the fd cache. */
     PR_SetFDCacheSize(0, FD_CACHE_SIZE);
 
     for (i = 0; i < numfds; i++) {
         fds[i] = PR_NewTCPSocket();
         if (NULL == fds[i]) {
             fprintf(stderr, "PR_NewTCPSocket failed\n");
             exit(1);
@@ -173,55 +114,12 @@ int main(int argc, char **argv)
     }
     for (i = 0; i < numfds; i++) {
         if (PR_Close(savefds[i]) == PR_FAILURE) {
             fprintf(stderr, "PR_Close failed\n");
             exit(1);
         }
     }
 
-    /* Switch to the fd stack. */
-    PR_SetFDCacheSize(0, 0);
-
-    for (i = 0; i < numfds; i++) {
-        fds[i] = PR_NewTCPSocket();
-        if (NULL == fds[i]) {
-            fprintf(stderr, "PR_NewTCPSocket failed\n");
-            exit(1);
-        }
-#ifdef ORDER_PRESERVED
-        if (fds[i] != savefds[numfds-1-i]) {
-            fprintf(stderr, "fd stack malfunctioned\n");
-            exit(1);
-        }
-#else
-        savefds[numfds-1-i];
-#endif
-    }
-    for (i = 0; i < numfds; i++) {
-        if (PR_Close(savefds[i]) == PR_FAILURE) {
-            fprintf(stderr, "PR_Close failed\n");
-            exit(1);
-        }
-    }
-
-    for (i = 0; i < numfds; i++) {
-        fds[i] = PR_NewTCPSocket();
-        if (NULL == fds[i]) {
-            fprintf(stderr, "PR_NewTCPSocket failed\n");
-            exit(1);
-        }
-        if (fds[i] != savefds[numfds-1-i]) {
-            fprintf(stderr, "fd stack malfunctioned\n");
-            exit(1);
-        }
-    }
-    for (i = 0; i < numfds; i++) {
-        if (PR_Close(savefds[i]) == PR_FAILURE) {
-            fprintf(stderr, "PR_Close failed\n");
-            exit(1);
-        }
-    }
-
     PR_Cleanup();
     printf("PASS\n");
     return 0;
 }
--- a/pr/tests/foreign.c
+++ b/pr/tests/foreign.c
@@ -218,17 +218,18 @@ static void OneShot(void *arg)
             case 5:
                 fd = PR_NewTCPSocket();
                 DPRINTF((output,"Thread[0x%x] called PR_NewTCPSocket\n",
                          PR_GetCurrentThread()));
                 PR_Close(fd);
                 break;
 
             case 6:
-#define TEMP_DIR "/tmp/"
+#define TEMP_DIR "./tmp"
+                PR_MkDir(TEMP_DIR, 0700);
                 dir = PR_OpenDir(TEMP_DIR);
                 DPRINTF((output,"Thread[0x%x] called PR_OpenDir\n",
                          PR_GetCurrentThread()));
                 PR_CloseDir(dir);
                 break;
 
             case 7:
                 (void)PR_NewThreadPrivateIndex(&pdkey, NULL);
--- a/pr/tests/fsync.c
+++ b/pr/tests/fsync.c
@@ -14,17 +14,17 @@
 static PRFileDesc *err = NULL;
 
 static void Help(void)
 {
     PR_fprintf(err, "Usage: [-S] [-K <n>] [-h] <filename>\n");
     PR_fprintf(err, "\t-c   Nuber of iterations     (default: 10)\n");
     PR_fprintf(err, "\t-S   Sync the file           (default: FALSE)\n");
     PR_fprintf(err, "\t-K   Size of file (K bytes)  (default: 10)\n");
-    PR_fprintf(err, "\t     Name of file to write   (default: /usr/tmp/sync.dat)\n");
+    PR_fprintf(err, "\t     Name of file to write   (default: ./tmp-sync.dat)\n");
     PR_fprintf(err, "\t-h   This message and nothing else\n");
 }  /* Help */
 
 int main(int argc, char **argv)
 {
     PRStatus rv;
     PLOptStatus os;
     PRUint8 *buffer;
--- a/pr/tests/gethost.c
+++ b/pr/tests/gethost.c
@@ -13,17 +13,17 @@
 
 #include "prio.h"
 #include "prnetdb.h"
 #include "plgetopt.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 
-#define DEFAULT_HOST_NAME "mcom.com"
+#define DEFAULT_HOST_NAME "mozilla.org"
 
 static void Help(void)
 {
     fprintf(stderr, "Usage: gethost [-h] [hostname]\n");
     fprintf(stderr, "\t-h          help\n");
     fprintf(stderr, "\thostname    Name of host    (default: %s)\n",
             DEFAULT_HOST_NAME);
 }  /* Help */
--- a/pr/tests/layer.c
+++ b/pr/tests/layer.c
@@ -35,17 +35,29 @@ static PRNetAddr server_address;
 
 static PRIOMethods myMethods;
 
 typedef enum Verbosity {silent, quiet, chatty, noisy} Verbosity;
 
 static PRIntn minor_iterations = 5;
 static PRIntn major_iterations = 1;
 static Verbosity verbosity = quiet;
-static PRUint16 default_port = 12273;
+
+#ifdef DEBUG
+#define PORT_INC_DO +100
+#else
+#define PORT_INC_DO
+#endif
+#ifdef IS_64
+#define PORT_INC_3264 +200
+#else
+#define PORT_INC_3264
+#endif
+
+static PRUint16 default_port = 12273 PORT_INC_DO PORT_INC_3264;
 
 static PRFileDesc *PushLayer(PRFileDesc *stack)
 {
     PRFileDesc *layer = PR_CreateIOLayerStub(identity, &myMethods);
     PRStatus rv = PR_PushIOLayer(stack, PR_GetLayersIdentity(stack), layer);
     if (verbosity > quiet) {
         PR_fprintf(logFile, "Pushed layer(0x%x) onto stack(0x%x)\n", layer, stack);
     }
--- a/pr/tests/lazyinit.c
+++ b/pr/tests/lazyinit.c
@@ -65,26 +65,26 @@ int main(int argc, char **argv)
         case 1: interval = PR_SecondsToInterval(1);
             break;
 
         case 2: thread = PR_CreateThread(
                                  PR_USER_THREAD, lazyEntry, NULL, PR_PRIORITY_NORMAL,
                                  PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0);
             break;
 
-        case 3: file = PR_Open("/usr/tmp/", PR_RDONLY, 0);
+        case 3: file = PR_Open("./tmp-", PR_RDONLY, 0);
             break;
 
         case 4: udp = PR_NewUDPSocket();
             break;
 
         case 5: tcp = PR_NewTCPSocket();
             break;
 
-        case 6: dir = PR_OpenDir("/usr/tmp/");
+        case 6: dir = PR_OpenDir("./tmp-");
             break;
 
         case 7: (void)PR_NewThreadPrivateIndex(&pdkey, NULL);
             break;
 
         case 8: path = PR_GetEnv("PATH");
             break;
 
--- a/pr/tests/multiwait.c
+++ b/pr/tests/multiwait.c
@@ -27,19 +27,30 @@ typedef struct Shared
     const char *title;
     PRLock *list_lock;
     PRWaitGroup *group;
     PRIntervalTime timeout;
 } Shared;
 
 typedef enum Verbosity {silent, quiet, chatty, noisy} Verbosity;
 
+#ifdef DEBUG
+#define PORT_INC_DO +100
+#else
+#define PORT_INC_DO
+#endif
+#ifdef IS_64
+#define PORT_INC_3264 +200
+#else
+#define PORT_INC_3264
+#endif
+
 static PRFileDesc *debug = NULL;
 static PRInt32 desc_allocated = 0;
-static PRUint16 default_port = 12273;
+static PRUint16 default_port = 12273 PORT_INC_DO PORT_INC_3264;
 static enum Verbosity verbosity = quiet;
 static PRInt32 ops_required = 1000, ops_done = 0;
 static PRThreadScope thread_scope = PR_LOCAL_THREAD;
 static PRIntn client_threads = 20, worker_threads = 2, wait_objects = 50;
 
 #if defined(DEBUG)
 #define MW_ASSERT(_expr) \
     ((_expr)?((void)0):_MW_Assert(# _expr,__FILE__,__LINE__))
--- a/pr/tests/nameshm1.c
+++ b/pr/tests/nameshm1.c
@@ -67,19 +67,30 @@
 */
 
 #include <plgetopt.h>
 #include <nspr.h>
 #include <stdlib.h>
 #include <string.h>
 #include <private/primpl.h>
 
-#define SEM_NAME1 "/tmp/nameshmSEM1"
-#define SEM_NAME2 "/tmp/nameshmSEM2"
-#define OPT_NAME "/tmp/xxxNSPRshm"
+#ifdef DEBUG
+#define SEM_D "D"
+#else
+#define SEM_D
+#endif
+#ifdef IS_64
+#define SEM_64 "64"
+#else
+#define SEM_64
+#endif
+
+#define SEM_NAME1 "/tmp/nameshmSEM1" SEM_D SEM_64
+#define SEM_NAME2 "/tmp/nameshmSEM2" SEM_D SEM_64
+#define OPT_NAME "/tmp/xxxNSPRshm" SEM_D SEM_64
 #define EXE_NAME "nameshm1"
 #define SEM_MODE  0666
 #define SHM_MODE  0666
 
 #define NameSize (1024)
 
 PRIntn  debug = 0;
 PRIntn  failed_already = 0;
--- a/pr/tests/nblayer.c
+++ b/pr/tests/nblayer.c
@@ -48,17 +48,29 @@ struct PRFilePrivate
     PRInt32 xmtreq, xmtinprogress;
 };
 
 typedef enum Verbosity {silent, quiet, chatty, noisy} Verbosity;
 
 static PRIntn minor_iterations = 5;
 static PRIntn major_iterations = 1;
 static Verbosity verbosity = quiet;
-static PRUint16 default_port = 12273;
+
+#ifdef DEBUG
+#define PORT_INC_DO +100
+#else
+#define PORT_INC_DO
+#endif
+#ifdef IS_64
+#define PORT_INC_3264 +200
+#else
+#define PORT_INC_3264
+#endif
+
+static PRUint16 default_port = 12273 PORT_INC_DO PORT_INC_3264;
 
 static PRFileDesc *PushLayer(PRFileDesc *stack)
 {
     PRStatus rv;
     PRFileDesc *layer = PR_CreateIOLayerStub(identity, &myMethods);
     layer->secret = PR_NEWZAP(PRFilePrivate);
     rv = PR_PushIOLayer(stack, PR_GetLayersIdentity(stack), layer);
     PR_ASSERT(PR_SUCCESS == rv);
--- a/pr/tests/ntioto.c
+++ b/pr/tests/ntioto.c
@@ -52,17 +52,29 @@ PRLogModuleInfo *lm;
 PRLogModuleLevel msgLevel = PR_LOG_NONE;
 PRIntn  debug = 0;
 PRIntn  verbose = 0;
 PRUint32  failed_already = 0;
 /* end Test harness infrastructure */
 
 /* JITTER_DEFAULT: the number of times AcceptThread() and JitterThread() ping-pong */
 #define JITTER_DEFAULT  100000
-#define BASE_PORT 9867
+
+#ifdef DEBUG
+#define PORT_INC_DO +100
+#else
+#define PORT_INC_DO
+#endif
+#ifdef IS_64
+#define PORT_INC_3264 +200
+#else
+#define PORT_INC_3264
+#endif
+
+#define BASE_PORT 9867 PORT_INC_DO PORT_INC_3264
 
 PRIntervalTime timeout;
 PRNetAddr   listenAddr;
 PRFileDesc  *listenSock;
 PRLock      *ml;
 PRCondVar   *cv;
 volatile enum  {
     RunJitter,
--- a/pr/tests/op_filnf.c
+++ b/pr/tests/op_filnf.c
@@ -26,17 +26,17 @@
 #include "plgetopt.h"
 
 static PRFileDesc *t1;
 PRIntn error_code;
 
 int main(int argc, char **argv)
 {
     PR_STDIO_INIT();
-    t1 = PR_Open("/usr/tmp/ttools/err03.tmp", PR_TRUNCATE | PR_RDWR, 0666);
+    t1 = PR_Open("./tmp-ttools/err03.tmp", PR_TRUNCATE | PR_RDWR, 0666);
     if (t1 == NULL) {
         if (PR_GetError() == PR_FILE_NOT_FOUND_ERROR) {
             printf ("error code is %d \n", PR_GetError());
             printf ("PASS\n");
             return 0;
         }
         else {
             printf ("error code is %d \n", PR_GetError());
--- a/pr/tests/provider.c
+++ b/pr/tests/provider.c
@@ -53,21 +53,32 @@
 #if defined(XP_UNIX)
 #include <math.h>
 #endif
 
 /*
 ** This is the beginning of the test
 */
 
+#ifdef DEBUG
+#define PORT_INC_DO +100
+#else
+#define PORT_INC_DO
+#endif
+#ifdef IS_64
+#define PORT_INC_3264 +200
+#else
+#define PORT_INC_3264
+#endif
+
 #define RECV_FLAGS 0
 #define SEND_FLAGS 0
 #define BUFFER_SIZE 1024
 #define DEFAULT_BACKLOG 5
-#define DEFAULT_PORT 13000
+#define DEFAULT_PORT 13000 PORT_INC_DO PORT_INC_3264
 #define DEFAULT_CLIENTS 1
 #define ALLOWED_IN_ACCEPT 1
 #define DEFAULT_CLIPPING 1000
 #define DEFAULT_WORKERS_MIN 1
 #define DEFAULT_WORKERS_MAX 1
 #define DEFAULT_SERVER "localhost"
 #define DEFAULT_EXECUTION_TIME 10
 #define DEFAULT_CLIENT_TIMEOUT 4000
--- a/pr/tests/runtests.pl
+++ b/pr/tests/runtests.pl
@@ -284,17 +284,16 @@ sub win_test_prog {
 "lazyinit",
 "libfilename",
 "lltest",
 "lock",
 "lockfile",
 "logfile",
 "logger",
 "many_cv",
-"multiwait",
 "nameshm1",
 "nblayer",
 "nonblock",
 "ntioto",
 "ntoh",
 "op_2long",
 "op_excl",
 "op_filnf",
--- a/pr/tests/runtests.sh
+++ b/pr/tests/runtests.sh
@@ -1,14 +1,28 @@
 #!/bin/sh
 # 
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+if test -z $1
+then
+  echo "usage: $0 <path-to-dist>"
+  exit 1
+fi
+
+cd $1/lib
+ABS_LIB=$PWD
+cd -
+
+export DYLD_LIBRARY_PATH=${ABS_LIB}:${DYLD_LIBRARY_PATH}
+export LD_LIBRARY_PATH=${ABS_LIB}:${LD_LIBRARY_PATH}
+export PATH=${ABS_LIB}:${PATH}
+
 #
 # runtests.sh
 #	Bourne shell script for nspr tests
 #
 
 SYSTEM_INFO=`uname -a`
 OS_ARCH=`uname -s`
 
@@ -52,22 +66,44 @@ fi
 #op_noacc	- limited use
 #yield		- limited use for PR_Yield
 
 #
 # Tests not run (but should)
 #
 
 #forktest (failed on IRIX)
+#multiwait - fails on Linux 64bit since NSPR v 4.4 from 2004.
 #nbconn - fails on some platforms 
 #poll_er - fails on some platforms? limited use?
 #prpoll -  the bad-FD test needs to be moved to a different test
 #sleep	-  specific to OS/2
+#
+# all of the following were disabled in 2019 when reenabling CI tests,
+# because they failed on at least one of the platforms:
+#
+# cltsrv
+# cvar
+# gethost
+# getproto
+# layer
+# logfile
+# nameshm1
+# nblayer
+# nonblock
+# op_2long
+# parent
+# provider
+# ranfile
+# socket
+# sockopt
+# vercheck
 
-LOGFILE=${NSPR_TEST_LOGFILE:-$NULL_DEVICE}
+#LOGFILE=${NSPR_TEST_LOGFILE:-$NULL_DEVICE}
+LOGFILE=nspr-test.log
 
 #
 # Tests run on all platforms
 #
 
 TESTS="
 abstract
 accept
@@ -75,81 +111,67 @@ acceptread
 acceptreademu
 affinity
 alarm
 anonfm
 atomic
 attach
 bigfile
 cleanup
-cltsrv
 concur
-cvar
 cvar2
 dlltest
 dtoa
 errcodes
 exit
 fdcach
 fileio
 foreign
 formattm
 fsync
-gethost
-getproto
 i2l
 initclk
 inrval
 instrumt
 intrio
 intrupt
 io_timeout
 ioconthr
 join
 joinkk
 joinku
 joinuk
 joinuu
-layer
 lazyinit
 libfilename
 lltest
 lock
 lockfile
-logfile
 logger
 many_cv
-multiwait
-nameshm1
-nblayer
-nonblock
 ntioto
 ntoh
-op_2long
 op_excl
 op_filnf
 op_filok
 op_nofil
-parent
 parsetm
 peek
 perf
 pipeping
 pipeping2
 pipeself
 poll_nm
 poll_to
 pollable
 prftest
 prfz
 primblok
-provider
 prpollml
 pushtop
-ranfile
 randseed
 reinit
 rwlocktest
 sel_spd
 selct_er
 selct_nm
 selct_to
 selintr
@@ -159,34 +181,31 @@ semaping
 sendzlf
 server_test
 servr_kk
 servr_uk
 servr_ku
 servr_uu
 short_thread
 sigpipe
-socket
-sockopt
 sockping
 sprintf
 stack
 stdio
 str2addr
 strod
 switch
 system
 testbit
 testfile
 threads
 timemac
 timetest
 tpd
 udpsrv
-vercheck
 version
 writev
 xnotify
 zerolen"
 
 rval=0
 
 
@@ -206,31 +225,31 @@ OS_PLATFORM=`uname`
 OBJDIR=`basename $PWD`
 printf "\nNSPR Test Results - $OBJDIR\n\n"
 printf "BEGIN\t\t\t`date`\n"
 printf "NSPR_TEST_LOGFILE\t${LOGFILE}\n\n"
 printf "Test\t\t\tResult\n\n"
 if [ $OS_PLATFORM = "Windows_95" ] || [ $OS_PLATFORM = "Windows_98" ] || [ $OS_PLATFORM = "Windows_NT" ] || [ $OS_PLATFORM = "OS/2" ] ; then
 	for prog in $TESTS
 	do
-		printf "$prog"
+		printf "$prog (`date +%T`)"
 		printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1
 		./$prog >> ${LOGFILE} 2>&1
 		if [ 0 = $? ] ; then
 			printf "\t\t\tPassed\n";
 		else
 			printf "\t\t\tFAILED\n";
 			rval=1
 		fi;
 		printf "\nEND TEST: $prog\n\n" >> ${LOGFILE} 2>&1
 	done
 else
 	for prog in $TESTS
 	do
-		printf "$prog"
+		printf "$prog (`date +%T`)"
 		printf "\nBEGIN TEST: $prog\n\n" >> ${LOGFILE} 2>&1
 		export test_rval
 		./$prog >> ${LOGFILE} 2>&1 &
 		test_pid=$!
 		sleep_pid=0
 		if test -n "$TEST_TIMEOUT" && test "$TEST_TIMEOUT" -gt 0
 		then
 		(sleep  $TEST_TIMEOUT; kill $test_pid >/dev/null 2>&1 ) &
@@ -244,27 +263,15 @@ else
 		else
 			printf "\t\t\tFAILED\n";
 			rval=1
 		fi;
 		printf "\nEND TEST: $prog\n\n" >> ${LOGFILE} 2>&1
 	done
 fi;
 
+if [ $rval -ne 0 ]; then
+  cat ${LOGFILE}
+fi
+
 printf "END\t\t\t`date`\n"
 exit $rval
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- a/pr/tests/sel_spd.c
+++ b/pr/tests/sel_spd.c
@@ -11,17 +11,28 @@
 #include "nspr.h"
 #include "prpriv.h"
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
 
-#define PORT_BASE 19000
+#ifdef DEBUG
+#define PORT_INC_DO +100
+#else
+#define PORT_INC_DO
+#endif
+#ifdef IS_64
+#define PORT_INC_3264 +200
+#else
+#define PORT_INC_3264
+#endif
+
+#define PORT_BASE 19000 PORT_INC_DO PORT_INC_3264
 
 typedef struct timer_slot_t {
     unsigned long d_connect;
     unsigned long d_cl_data;
     unsigned long d_sv_data;
     unsigned long d_close;
     unsigned long d_total;
     unsigned long requests;
--- a/pr/tests/sema.c
+++ b/pr/tests/sema.c
@@ -3,18 +3,29 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nspr.h"
 #include "plgetopt.h"
 
 #include <stdio.h>
 
-#define SEM_NAME1 "/tmp/foo.sem"
-#define SEM_NAME2 "/tmp/bar.sem"
+#ifdef DEBUG
+#define SEM_D "D"
+#else
+#define SEM_D
+#endif
+#ifdef IS_64
+#define SEM_64 "64"
+#else
+#define SEM_64
+#endif
+
+#define SEM_NAME1 "/tmp/foo.sem" SEM_D SEM_64
+#define SEM_NAME2 "/tmp/bar.sem" SEM_D SEM_64
 #define SEM_MODE  0666
 #define ITERATIONS 1000
 
 static PRBool debug_mode = PR_FALSE;
 static PRIntn iterations = ITERATIONS;
 static PRIntn counter;
 static PRSem *sem1, *sem2;
 
--- a/pr/tests/semaerr.c
+++ b/pr/tests/semaerr.c
@@ -3,18 +3,29 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nspr.h"
 #include "plgetopt.h"
 
 #include <stdio.h>
 
-#define NO_SUCH_SEM_NAME "/tmp/nosuchsem.sem"
-#define SEM_NAME1 "/tmp/foo.sem"
+#ifdef DEBUG
+#define SEM_D "D"
+#else
+#define SEM_D
+#endif
+#ifdef IS_64
+#define SEM_64 "64"
+#else
+#define SEM_64
+#endif
+
+#define NO_SUCH_SEM_NAME "/tmp/nosuchsem.sem" SEM_D SEM_64
+#define SEM_NAME1 "/tmp/foo.sem" SEM_D SEM_64
 #define EXE_NAME "semaerr1"
 #define SEM_MODE  0666
 
 static PRBool debug_mode = PR_FALSE;
 
 static void Help(void)
 {
     fprintf(stderr, "semaerr test program usage:\n");
--- a/pr/tests/semaerr1.c
+++ b/pr/tests/semaerr1.c
@@ -3,18 +3,29 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nspr.h"
 #include "plgetopt.h"
 
 #include <stdio.h>
 
-#define SEM_NAME1 "/tmp/foo.sem"
-#define SEM_NAME2 "/tmp/bar.sem"
+#ifdef DEBUG
+#define SEM_D "D"
+#else
+#define SEM_D
+#endif
+#ifdef IS_64
+#define SEM_64 "64"
+#else
+#define SEM_64
+#endif
+
+#define SEM_NAME1 "/tmp/foo.sem" SEM_D SEM_64
+#define SEM_NAME2 "/tmp/bar.sem" SEM_D SEM_64
 #define SEM_MODE  0666
 
 static PRBool debug_mode = PR_FALSE;
 
 static void Help(void)
 {
     fprintf(stderr, "semaerr1 test program usage:\n");
     fprintf(stderr, "\t-d           debug mode         (FALSE)\n");
--- a/pr/tests/semaping.c
+++ b/pr/tests/semaping.c
@@ -3,19 +3,30 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nspr.h"
 #include "plgetopt.h"
 
 #include <stdio.h>
 
-#define SHM_NAME "/tmp/counter"
-#define SEM_NAME1 "/tmp/foo.sem"
-#define SEM_NAME2 "/tmp/bar.sem"
+#ifdef DEBUG
+#define SEM_D "D"
+#else
+#define SEM_D
+#endif
+#ifdef IS_64
+#define SEM_64 "64"
+#else
+#define SEM_64
+#endif
+
+#define SHM_NAME "/tmp/counter" SEM_D SEM_64
+#define SEM_NAME1 "/tmp/foo.sem" SEM_D SEM_64
+#define SEM_NAME2 "/tmp/bar.sem" SEM_D SEM_64
 #define EXE_NAME "semapong"
 #define SEM_MODE  0666
 #define SHM_MODE  0666
 #define ITERATIONS 1000
 
 static PRBool debug_mode = PR_FALSE;
 static PRIntn iterations = ITERATIONS;
 static PRSem *sem1, *sem2;
--- a/pr/tests/semapong.c
+++ b/pr/tests/semapong.c
@@ -3,19 +3,30 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nspr.h"
 #include "plgetopt.h"
 
 #include <stdio.h>
 
-#define SHM_NAME "/tmp/counter"
-#define SEM_NAME1 "/tmp/foo.sem"
-#define SEM_NAME2 "/tmp/bar.sem"
+#ifdef DEBUG
+#define SEM_D "D"
+#else
+#define SEM_D
+#endif
+#ifdef IS_64
+#define SEM_64 "64"
+#else
+#define SEM_64
+#endif
+
+#define SHM_NAME "/tmp/counter" SEM_D SEM_64
+#define SEM_NAME1 "/tmp/foo.sem" SEM_D SEM_64
+#define SEM_NAME2 "/tmp/bar.sem" SEM_D SEM_64
 #define ITERATIONS 1000
 
 static PRBool debug_mode = PR_FALSE;
 static PRIntn iterations = ITERATIONS;
 static PRSem *sem1, *sem2;
 
 static void Help(void)
 {
--- a/pr/tests/socket.c
+++ b/pr/tests/socket.c
@@ -40,19 +40,19 @@ static int test_cancelio = 0;
 
 #define DPRINTF(arg) if (_debug_on) printf arg
 
 #ifdef XP_PC
 char *TEST_DIR = "prdir";
 char *SMALL_FILE_NAME = "prsmallf";
 char *LARGE_FILE_NAME = "prlargef";
 #else
-char *TEST_DIR = "/tmp/prsocket_test_dir";
-char *SMALL_FILE_NAME = "/tmp/prsocket_test_dir/small_file";
-char *LARGE_FILE_NAME = "/tmp/prsocket_test_dir/large_file";
+char *TEST_DIR = "./tmp-prsocket_test_dir";
+char *SMALL_FILE_NAME = "./tmp-prsocket_test_dir/small_file";
+char *LARGE_FILE_NAME = "./tmp-prsocket_test_dir/large_file";
 #endif
 #define SMALL_FILE_SIZE             (3 * 1024)        /* 3 KB        */
 #define SMALL_FILE_OFFSET_1         (512)
 #define SMALL_FILE_LEN_1            (1 * 1024)        /* 1 KB        */
 #define SMALL_FILE_OFFSET_2         (75)
 #define SMALL_FILE_LEN_2            (758)
 #define SMALL_FILE_OFFSET_3         (1024)
 #define SMALL_FILE_LEN_3            (SMALL_FILE_SIZE - SMALL_FILE_OFFSET_3)
--- a/pr/tests/testfile.c
+++ b/pr/tests/testfile.c
@@ -66,17 +66,17 @@ typedef struct File_Rdwr_Param {
 #ifdef XP_OS2
 char *TEST_DIR = "prdir";
 #else
 char *TEST_DIR = "C:\\temp\\prdir";
 #endif
 char *FILE_NAME = "pr_testfile";
 char *HIDDEN_FILE_NAME = "hidden_pr_testfile";
 #else
-char *TEST_DIR = "/tmp/testfile_dir";
+char *TEST_DIR = "./tmp-testfile_dir";
 char *FILE_NAME = "pr_testfile";
 char *HIDDEN_FILE_NAME = ".hidden_pr_testfile";
 #endif
 buffer *in_buf, *out_buf;
 char pathname[256], renamename[256];
 #ifdef WINCE
 WCHAR wPathname[256];
 #endif
--- a/pr/tests/thruput.c
+++ b/pr/tests/thruput.c
@@ -22,17 +22,30 @@
 #include "prnetdb.h"
 #include "prprf.h"
 #include "prthread.h"
 #include "pprio.h"
 #include "plerror.h"
 #include "plgetopt.h"
 
 #define ADDR_BUFFER 100
-#define PORT_NUMBER 51877
+
+#ifdef DEBUG
+#define PORT_INC_DO +100
+#else
+#define PORT_INC_DO
+#endif
+#ifdef IS_64
+#define PORT_INC_3264 +200
+#else
+#define PORT_INC_3264
+#endif
+
+#define PORT_NUMBER 51877 PORT_INC_DO PORT_INC_3264
+
 #define SAMPLING_INTERVAL 10
 #define BUFFER_SIZE (32 * 1024)
 
 static PRInt32 domain = PR_AF_INET;
 static PRInt32 protocol = 6;  /* TCP */
 static PRFileDesc *err = NULL;
 static PRIntn concurrency = 1;
 static PRInt32 xport_buffer = -1;
--- a/pr/tests/tmoacc.c
+++ b/pr/tests/tmoacc.c
@@ -6,17 +6,28 @@
 #include "nspr.h"
 
 #include <stdlib.h>
 #include <string.h>
 
 #include "plerror.h"
 #include "plgetopt.h"
 
-#define BASE_PORT 9867
+#ifdef DEBUG
+#define PORT_INC_DO +100
+#else
+#define PORT_INC_DO
+#endif
+#ifdef IS_64
+#define PORT_INC_3264 +200
+#else
+#define PORT_INC_3264
+#endif
+
+#define BASE_PORT 9867 PORT_INC_DO PORT_INC_3264
 #define DEFAULT_THREADS 1
 #define DEFAULT_BACKLOG 10
 #define DEFAULT_TIMEOUT 10
 #define RANDOM_RANGE 100  /* should be significantly smaller than RAND_MAX */
 
 typedef enum {running, stopped} Status;
 
 typedef struct Shared
--- a/pr/tests/tmocon.c
+++ b/pr/tests/tmocon.c
@@ -45,17 +45,28 @@
 char *getcwd(char *buf, size_t size)
 {
     wchar_t wpath[MAX_PATH];
     _wgetcwd(wpath, MAX_PATH);
     WideCharToMultiByte(CP_ACP, 0, wpath, -1, buf, size, 0, 0);
 }
 #endif
 
-#define BASE_PORT 9867
+#ifdef DEBUG
+#define PORT_INC_DO +100
+#else
+#define PORT_INC_DO
+#endif
+#ifdef IS_64
+#define PORT_INC_3264 +200
+#else
+#define PORT_INC_3264
+#endif
+
+#define BASE_PORT 9867 PORT_INC_DO PORT_INC_3264
 
 #define DEFAULT_DALLY 1
 #define DEFAULT_THREADS 1
 #define DEFAULT_TIMEOUT 10
 #define DEFAULT_MESSAGES 100
 #define DEFAULT_MESSAGESIZE 100
 
 static PRFileDesc *debug_out = NULL;
--- a/pr/tests/writev.c
+++ b/pr/tests/writev.c
@@ -10,17 +10,28 @@
 #include <stdlib.h>
 #include <string.h>
 
 
 #ifndef IOV_MAX
 #define IOV_MAX 16
 #endif
 
-#define BASE_PORT 9867
+#ifdef DEBUG
+#define PORT_INC_DO +100
+#else
+#define PORT_INC_DO
+#endif
+#ifdef IS_64
+#define PORT_INC_3264 +200
+#else
+#define PORT_INC_3264
+#endif
+
+#define BASE_PORT 9867 PORT_INC_DO PORT_INC_3264
 
 int PR_CALLBACK Writev(int argc, char **argv)
 {
 
     PRStatus rv;
     PRNetAddr serverAddr;
     PRFileDesc *clientSock, *debug = NULL;