summaryrefslogtreecommitdiffstats
path: root/tests/014
Commit message (Collapse)AuthorAgeFilesLines
* openbsd: more tests fixes.Kaz Kylheku2024-01-051-1/+1
| | | | | | | | | | | | | * tests/014/socket-basic.tl: Test for :openbsd also were we test for :bsd. * tests/014/glob-carray.tl: Likewise. * tests/017/glob-zarray.tl: Likewise. * tests/017/mmap.tl: Likewise. * tests/018/chmod.tl: Likewise.
* New method: str-addr.Kaz Kylheku2022-10-031-0/+68
| | | | | | | | | | | | | | | | | | | | | * socket.c (sock_set_entries): Intern str-addr symbol. There is no autoload on this because the struct types of which this is a method don't exist if the socket module has not been loaded. * stdlib/socket.tl ((sockaddr-in str-addr), (sockaddr-in6 str-addr), (sockaddr-un str-addr)): New methods. * tests/014/str-addr.tl: New file. This provides coverage not just for the str-addr method, but the hitherto untested address to text functions. This is why the bug was found, that was addressed in the previous commit. The test case which produces "8000::1" was actually producing "800:1". * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* New sockaddr-str function.Kaz Kylheku2022-10-021-0/+49
| | | | | | | | | | | | | | | | This function "intelligently" constructs an address object of the right type from a string. * socket.c (sock_set_entries): Autoload socket.tl on sockaddr-str function being accessed. * stdlib/socket.tl (sockaddr-str): New function. * tests/014/sockaddr-str.tl: New file. * txr.1: Documented. * stdlib.doc-syms.tl: Updated.
* unix: fix sock-opt test case.Kaz Kylheku2021-10-051-2/+2
| | | | | | | | | | | | | | | On systems with true Unix heritage, like Solaris, MacOS/Darwin, and undoubtedly various BSDs, getsockopt is returning a bitmask value for some options , rather than 1. For instance if we enable SO_REUSEADDR, and then read back the value of the option, we get 4 and not 1. This is because the value of the SO_REUSEADDR symbol itself is 4; it is a mask. The kernel code is evidently just masking out the desired option out of the option mask, and returning the mask value without reducing it to 0 or 1. * tests/014/socket-misc.tl: Test the result of sock-opt for nonzero using nzerop rather than testing specifically for 1.
* ffi, sockets: add sock-opt and sock-set-opt.Paul A. Patience2021-09-121-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new sock-opt and sock-set-opt functions are wrappers around getsockopt and setsockopt, respectively. All POSIX socket options are registered. Platform-specific options may be added in the future. * ffi.c (sock_opt, sock_set_opt): New functions. (ffi_init): Register sock-opt, sock-set-opt, sol-socket, ipproto-ip, ipproto-ipv6, ipproto-tcp, ipproto-udp, so-acceptconn, so-broadcast, so-debug, so-dontroute, so-error, so-keepalive, so-linger, so-oobinline, so-rcvbuf, so-rcvlowat, so-rcvtimeo, so-reuseaddr, so-sndbuf, so-sndlowat, so-sndtimeo, so-type, ipv6-join-group, ipv6-leave-group, ipv6-multicast-hops, ipv6-multicast-if, ipv6-multicast-loop, ipv6-unicast-hops, ipv6-v6only, tcp-nodelay. * lisplib.c (sock_set_entries): Add sock-opt and sock-set-opt. * stdlib/socket.tl (sock-opt): Define as syntactic place. * tests/014/socket-misc.tl: New cases, for sock-opt. (set-and-get): New macro. * txr.1: Documented. Also, mention that sock-bind enables so-reuseaddr. * stdlib/doc-syms.tl: Updated.
* sockets: add test for recent sock-peer place issue.Kaz Kylheku2021-09-111-1/+5
| | | | | * tests/014/socket-misc.tl: Test that we can perform a place update operation on a (sock-peer s) place.
* sockets: bug in clearing SOCK_* type flags.Kaz Kylheku2021-09-111-0/+4
| | | | | | | | | | | | | | | | | | | | Paul A. Patience reports a regression in 3d5d525eb525cfad8f643917c31e3d9fedce2874, whereby the code marked with #if SOCK_NONBLOCK || SOCK_CLOEXEC is being excluded by the preprocoessor, and so those flags are not being cleared from the socket type that we retain. This is because these preprocessor symbols are not necessarily integer constants. They may expand to C enum identifiers, in which case, in preprocessor expressions they appear to take on the value zero. * socket.c (open_socket, socketpair_wrap): Use the if statement to test for SOCK_NONBLOCK or SOCK_CLOEXEC being nonzero, rather than a preprocessor #if. This should still be optimized away as unreachable code if they are zero. * tests/014/socket-misc.tl: New file.
* tests: support BSD flavors loosely, not just OpenBSD.Kaz Kylheku2021-08-131-1/+1
| | | | | | | | | | | | * tests/common.tl (os-symbol): Look for the substring BSD in the system name, and map to symbol :bsd. Do not produce the :openbsd symbol. * tests/014/socket-basic.tl: Refer to :bsd, not :openbsd. * tests/017/glob-carray.tl: Likewise. * tests/018/chmod.tl: Likewise.
* genman, lib, tests: use defvarl where possible.Paul A. Patience2021-07-052-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * genman.txr (dupes, tagnum): Replace defvar with defvarl. * stdlib/doc-lookup.tl (os-symbol): Same. * tests/011/macros-3.tl (x): Same. * tests/011/mandel.txr (x-centre, y-centre, width, i-max, j-max, n) (r-max, pixel-size, x-offset, y-offset): Same. (file, colour-max): Delete (unused) variables. * tests/012/circ.tl (x): Replace defvar with defvarl. * tests/012/stack.tl (stack-limited): Same. * tests/012/struct.tl (s): Same. * tests/013/maze.tl (vi, pa, sc): Delete variables. Use function arguments instead. (usage): Fix typo. * tests/014/dgram-stream.tl (family): Rename to... (*family*): ...this. * tests/014/socket-basic.tl (socktype): Rename to... (*socktype*): ...this. (%iters%): Replace defvar with defvarl.
* openbsd: fix tests.Kaz Kylheku2021-04-201-1/+1
| | | | | | | | | | | | | | | | | | | * tests/014/socket-basic.tl (%iters%): Also reduce to 2000 on OpenBSD, to avoid the default limit on UDP datagram size. * tests/017/glob-carray.tl: Use the BSD-style struct glob-t on OpenBSD also. * tests/017/glob-zarray.tl: Likewise. * tests/018/chmod.tl (os): New global variable. (test-sticky): s-isvtx not allowed for non-root user on OpenBSD, so we falsify this variable. * tests/common.tl (os-symbol): Add OpenBSD case, producing :openbsd keyword symbol. (libc): Let's just use (dlopen nil) for any platform that isn't Cygwin or Cygnal.
* tests: implicitly generate empty .expected files.Kaz Kylheku2021-04-124-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makefile (%.expected): New implicit rule. Whenever a test requires a .expected file, if it is missing, we create an empty one. This file will be treated as an intermediate by GNU Make, which means that it will be deleted when make terminates. * tests/012/compile.tl: Some of the .tl files no longer have an .expected file, so we have to test for that in the catenating logic. * tests/008/call-2.expected, * tests/008/no-stdin-hang.expected, * tests/011/macros-3.expected, * tests/011/patmatch.expected, * tests/012/aseq.expected, * tests/012/ashwin.expected, * tests/012/compile.tl, * tests/012/cont.expected, * tests/012/defset.expected, * tests/012/ifa.expected, * tests/012/oop-seq.expected, * tests/012/parse.expected, * tests/012/quasi.expected, * tests/012/quine.expected, * tests/012/seq.expected, * tests/012/struct.expected, * tests/012/stslot.expected, * tests/014/dgram-stream.expected, * tests/014/in6addr-str.expected, * tests/014/inaddr-str.expected, * tests/014/socket-basic.expected, * tests/015/awk-fconv.expected, * tests/015/split.expected, * tests/015/trim.expected, * tests/016/arith.expected, * tests/016/ud-arith.expected, * tests/017/ffi-misc.expected, * tests/018/chmod.expected: Empty file deleted.
* MacOS: adjust socket-basic test for dgram size.Kaz Kylheku2021-03-241-4/+7
| | | | | | | | | * 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.
* New inaddr-str and in6addr-str functions.Kaz Kylheku2020-07-244-0/+198
| | | | | | | | | | | | | | | | | * lisplib.c (sock_set_entries): Register autoload entries for inaddr-str and in6addr-str. Register prefix symbol to be interned. * share/txr/stdlib/socket.tl (sockaddr-in, sockaddr-in6): Both structs get a new member, prefix, defaulting to the respective number of bits in the address. (inaddr-str, in6addr-str): New functions. * tests/014/iaddr-str, tests/014/inaddr-str.expected, tests/014/in6addr-str.tl, tests/014/in6addr-str.expected: New files * txr.1: Documented.
* tests: use internal OS identification method.Kaz Kylheku2017-05-131-1/+1
| | | | | | | | | | * tests/common.tl (osname): Function based on calling shell command removed. (os-symbol): New symbol-returning function based on uname system call. * tests/014/dgram-stream.tl (dgram-test): Use os-symbol function rather than osname.
* Run IPv6 tests only on some operating systems.Kaz Kylheku2016-03-101-4/+7
| | | | | | | | | | * tests/014/dgram-stream.tl (test): Renamed to dgram-test since now this includes common.tl which has a macro called test. Only include af-inet6 in the family list if the OS is GNU/Linux, Darwin or Cygwin. * tests/common.tl (osname): New function.
* Dgram test: multiple transfers on one stream, IPv6.Kaz Kylheku2016-03-072-0/+39
| | | | | | * tests/014/dgram-stream.tl: New file. * tests/014/dgram-stream.expected: New file.
* Basic regression test case for sockets.Kaz Kylheku2016-03-072-0/+31
* Makefile: suppress --gc-debug for tst/tests/014 directory. * tests/014/socket-basic.tl: New file. * tests/014/socket-basic.expected: New file. * tests/sock-common.tl: New file.