summaryrefslogtreecommitdiffstats
path: root/nsprpub/pr/tests/fdcach.c
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-12-23 19:01:09 +0000
committerMoonchild <moonchild@palemoon.org>2020-12-23 19:01:09 +0000
commit149d2ffa779826cb48a381099858e76e4624d471 (patch)
tree1adb922c55da8094039ea14f4b2178314d51f2a1 /nsprpub/pr/tests/fdcach.c
parent25b6703e956a33e0ecd8bdc18f423e5eb5dd09d4 (diff)
downloadUXP-149d2ffa779826cb48a381099858e76e4624d471.tar
UXP-149d2ffa779826cb48a381099858e76e4624d471.tar.gz
UXP-149d2ffa779826cb48a381099858e76e4624d471.tar.lz
UXP-149d2ffa779826cb48a381099858e76e4624d471.tar.xz
UXP-149d2ffa779826cb48a381099858e76e4624d471.zip
Issue #1693 - Update NSPR to 4.29
Diffstat (limited to 'nsprpub/pr/tests/fdcach.c')
-rw-r--r--nsprpub/pr/tests/fdcach.c106
1 files changed, 2 insertions, 104 deletions
diff --git a/nsprpub/pr/tests/fdcach.c b/nsprpub/pr/tests/fdcach.c
index 2fb2e5b81..5fa51b706 100644
--- a/nsprpub/pr/tests/fdcach.c
+++ b/nsprpub/pr/tests/fdcach.c
@@ -6,7 +6,7 @@
/*
* 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.
*/
@@ -18,7 +18,7 @@
/*
* 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
@@ -35,12 +35,6 @@ int main(int argc, char **argv)
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. */
@@ -82,59 +76,6 @@ int main(int argc, char **argv)
}
}
- /* 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);
@@ -178,49 +119,6 @@ int main(int argc, char **argv)
}
}
- /* 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;