From 6364a9c13ef954f0a3e29dae1fff3e9d8bd0a10e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 24 Mar 2021 19:41:21 -0700 Subject: MacOS: adjust socket-basic test for dgram size. * tests/014/socket-basic.tl (%iters%): New variable. 2000 on MacOS, 5000 elsewhere. (client, server): Use %iters% instead of hard-coded 5000. (test): Rename to sock-test, since it clashes with the test macro coming from common.tl, which we neeed to for the os-symbol function. --- tests/014/socket-basic.tl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/014/socket-basic.tl b/tests/014/socket-basic.tl index efeed2d6..bbdab7f9 100644 --- a/tests/014/socket-basic.tl +++ b/tests/014/socket-basic.tl @@ -1,21 +1,24 @@ (load "../sock-common.tl") +(load "../common.tl") (defvar socktype) +(defvar %iters% (if (eql :macos (os-symbol)) 2000 5000)) + (defun client (addr) (with-stream (cli-sock (open-socket af-inet socktype)) (sock-connect cli-sock addr) (put-string "5000" cli-sock) (sock-shutdown cli-sock) - (equal (read cli-sock) (range 1 5000)))) + (equal (read cli-sock) (range 1 %iters%)))) (defun server (svc-sock) (let* ((acc-sock (sock-accept svc-sock)) (query (read acc-sock))) - (print (range 1 5000) acc-sock) + (print (range 1 %iters%) acc-sock) (close-stream acc-sock))) -(defun test () +(defun sock-test () (let* ((svc-sock (open-socket af-inet socktype)) (svc-addr (bindfree svc-sock 1025 65535)) (child-pid (fork))) @@ -27,5 +30,5 @@ (if (and (fboundp 'open-socket) (fboundp 'fork)) (each ((socktype (list sock-dgram sock-stream))) - (unless (test) + (unless (sock-test) (error "test failed")))) -- cgit v1.2.3