summaryrefslogtreecommitdiff
path: root/test-suite
AgeCommit message (Collapse)AuthorFilesLines
2023-02-23Added comments in load-lang.test, which does not work. * ↵wip-load-langMatt Wette1-1/+22
test-suite/tests/load-lang.tests: added comments: The test is not working but execution repl does work.
2023-02-23multiple languages support via file extension or #lang headerMatt Wette2-0/+38
From scripts/compile pushed default assumption of #:from as 'scheme down into system/base/compile where filename and first line can be used to deduce intended "from" language. If first line of a file is of the form #lang ecmascript then the file is assumed consist of source language "ecmascript". * module/scripts/compile.scm (compile): changed default #:from to #f from 'scheme * module/system/base/compile.scm(lang-from-port, %file-extension-map, add-lang-extension, lang-extension-for): added global %file-extension-map with accessor lang-extension-for and updater add-lang-extension. Also, added lang-from-port to parse first line, looking for #lang. * test-suite/tests.scm: added "load-lang" test. * test-suite/Makefile.am(SCM_TESTS): added tests/load-lang.test
2023-01-16Do not expand 'make-vector' primcall with wrong number of arguments.Ludovic Courtès1-2/+11
Fixes <https://bugs.gnu.org/60522>. Reported by Sascha Ziemann <ceving@gmail.com>. * module/language/tree-il/primitives.scm (make-vector): Return #f when passed an incorrect number of arguments. * test-suite/tests/peval.test ("partial evaluation"): Add tests.
2023-01-14Add 'bytevector-slice'.Ludovic Courtès1-1/+66
* module/rnrs/bytevectors/gnu.scm: New file. * am/bootstrap.am (SOURCES): Add it. * libguile/bytevectors.c (scm_bytevector_slice): New function. * libguile/bytevectors.h (scm_bytevector_slice): New declaration. * test-suite/tests/bytevectors.test ("bytevector-slice"): New tests. * doc/ref/api-data.texi (Bytevector Slices): New node.
2023-01-13Make 'system*' and 'piped-process' internally use 'spawn'.Josselin Poiret1-1/+17
Fixes <https://bugs.gnu.org/52835>. * libguile/posix.c (scm_system_star, scm_piped_process): Use do_spawn. (start_child): Remove function. * test-suite/tests/posix.test ("system*")["https://bugs.gnu.org/52835"]: New test. * NEWS: Update. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-01-13Add 'spawn'.Josselin Poiret1-2/+77
* libguile/posix.c: Include spawn.h from Gnulib. (do_spawn, scm_spawn_process): New functions. (kw_environment, hw_input, kw_output, kw_error, kw_search_path): New variables. * doc/ref/posix.texi (Processes): Document it. * test-suite/tests/posix.test ("spawn"): New test prefix. * NEWS: Update. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2023-01-11Test for 'frame-local-ref' errors when printing backtrace.Andrew Whatson1-1/+22
This test reproduces the error from <https://bugs.gnu.org/56493>, and passes with the workaround which was merged in commit c7fa78fc751eb336bcfafbb5ac59c460ee2c5d7a. * test-suite/tests/eval.test ("avoid frame-local-ref out of range"): New test. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-12-01Fix peval bug when expand-primitives introduces lexicalsAndy Wingo1-1/+9
* module/language/tree-il/peval.scm (augment-var-table-with-externally-introduced-lexicals): New helper. * module/language/tree-il/peval.scm (peval): Augment store with any lexicals introduced by expand-primitives. * test-suite/tests/peval.test ("partial evaluation"): Add tests.
2022-12-01Fix order-of-side-effects bug in (eq? x y z) expansionAndy Wingo1-0/+11
* module/language/tree-il/primitives.scm (bind-lexicals): New helper. (expand-eq, expand-chained-comparisons): Ensure all arguments are eagerly evaluated. Previously an intermediate #f result would shortcut the evaluation. * test-suite/tests/compiler.test ("size effects in multi-arg eq / <"): Add test.
2022-11-29Add tests for warning locations.Andrew Whatson1-1/+47
These would have caught <https://bugs.gnu.org/56493>. * test-suite/tests/tree-il.test ("warnings")("location")["unused variable", "unbound variable (spaces)", "unbound variable (tabs)"]: New tests.
2022-10-21Define Scheme bindings to ‘openat’ when available.Maxime Devos1-0/+73
* configure.ac: Detect if ‘openat’ is defined. * libguile/filesys.c (flags_to_mode): Extract from ... (scm_mode): ... here. (scm_open_fdes_at, scm_openat): Define the Scheme bindings. * libguile/filesys.h (scm_open_fdes_at, scm_openat): Make them part of the API. * doc/ref/posix.texi (File System): Document them. * test-suite/tests/filesys.test ("openat"): Test ‘openat’. * libguile/syscalls.h (openat_or_openat64): Decide between ‘openat’ and ‘openat64’. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define a Scheme binding to ‘fstatat’ when available.Maxime Devos1-0/+80
* configure.ac: Detect if ‘fstatat’ is defined. * libguile/filesys.c (scm_statat): Define a Scheme binding to ‘fstatat’. * libguile/filesys.h (scm_statat): Make it part of the C API. * doc/ref/posix.texi (File System): Document it. * libguile/syscalls.h (fstatat_or_fstatat64): Choose between ‘fstatat’ and ‘fstatat64’. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define a Scheme binding to ‘unlinkat’ when it exists.Maxime Devos1-0/+59
‘unlinkat’ is used for both unlinking regular files and removing empty directories. * configure.ac: Detect if ‘unlinkat’ exists. * doc/ref/posix.texi (File System): Document why there is no ‘rmdirat’ procedure, and document the ‘delete-file-at’ procedure. * libguile/filesys.c (scm_rmdir): Adjust the docstring here as well. (scm_delete_file_at): Define a Scheme binding to ‘unlinkat’. * libguile/filesys.h (scm_delete_file_at): Make ‘scm_delete_file_at’ part of the C API. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define a Scheme binding to ‘fchmodat’ when it exists.Maxime Devos1-0/+53
* configure.ac: Detect existence of fchmodat. * libguile/filesys.c (scm_chmodat): New procedure. * libguile/filesys.h (scm_chmodat): Make it part of the API. * test-suite/tests/filesys.test ("chmodat"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define a Scheme binding to ‘renameat’ when it exists.Maxime Devos1-0/+104
* configure.ac: Detect if ‘renameat’ is defined. * libguile/filesys.c (scm_renameat): Define a Scheme binding to the ‘renameat’ system call. * doc/ref/posix.texi (File System): Document it. * libguile/filesys.h (scm_renameat): Make it part of the C API. * test-suite/tests/filesys.test ("rename-file-at"): New tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define bindings to ‘mkdirat’ when the C function exists.Maxime Devos1-0/+38
* configure.ac: Detect if ‘mkdirat’ exists. * libguile/filesys.c (scm_mkdirat): Define the Scheme binding. * doc/ref/posix.texi (File System): Document it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Define ‘symlinkat’ wrapper when supported.Maxime Devos1-0/+27
* configure.ac: Detect whether ‘symlinkat’ exists. * libguile/filesys.c (scm_symlinkat): Define a Scheme binding when it exists. * libguile/filesys.h: Make the binding part of the public C API. * doc/ref/posix.texi (File System): Document the binding. * test-suite/tests/filesys.test ("symlinkat"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Allow file ports in ‘utime’.Maxime Devos1-1/+70
Ports representing symbolic links are currently unsupported. * configure.ac: Detect 'futimens'. * doc/ref/posix.texi (utime): Update documentation. * libguile/posix.c (scm_utime): Support ports. * libguile/posix.h (scm_utime): Rename argument. * test-suite/tests/posix.test ("utime"): Add more tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Allow file ports in ‘readlink’.Maxime Devos1-0/+61
* configure.ac: Detect whether ‘readlinkat’ is defined. * libguile/filesys.c (scm_readlink): Support file ports when ‘readlinkat’ exists. (scm_init_filesys): Provide ‘chdir-ports’ when it exists. * doc/ref/posix.texi (File System): Document it. * test-suite/tests/filesys.test ("readlink"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-21Allow file ports in ‘chdir’ when supported.Maxime Devos1-0/+41
* configure.ac: Check for ‘fchdir’. * libguile/filesys.c (scm_chdir): Support file ports. (scm_init_filesys): Report support of file ports. * doc/ref/posix.texi (Processes): Update accordingly. * doc/ref/guile.texi: Add copyright line for new documentation in this patch and later patches. * test-suite/tests/filesys.test ("chdir"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-10-14Presume ISO C90 headers are always availableMike Gran1-5/+1
This includes <assert.h>, <ctype.h>, <errno.h>, <float.h>, <iso646.h>, <limits.h>, <locale.h>, <math.h>, <setjmp.h>, <signal.h>, <stdarg.h>, <stddef.h>, <stdio.h>, <stdlib.h>, <string.h>, <time.h>, <wchar.h>, and <wctype.h>. * configure.ac: don't check for <limits.h>, <string.h>, <time.h>, <assert.h>. Remove AC_INCLUDES_DEFAULT macro * libguile/bytevectors.c: include <limits.h>, remove HAVE_LIMITS_H * libguile/filesys.c: include <string.h>, remove HAVE_STRING_H * libguile/fports.c: include <string.h>, remove HAVE_STRING_H * libguile/gen-scmconfig.c: remove HAVE_LIMITS_H, HAVE_TIME_H, STDC_HEADERS Remove SCM_HAVE_STDC_HEADERS * libguile/hash.c: include <wchar.h>, remove HAVE_WCHAR_H * libguile/net_db.c: include <string.h>, remove HAVE_STRING_H * libguile/numbers.h: remove SCM_HAVE_STDC_HEADERS * libguile/regex-posix.c: include <wchar.h>, remove HAVE_WCHAR_H (fixup_multibyte_match): always defined (scm_regexp_exec): use fixup_multibyte_match * libguile/scmsigs.c: remove STDC_HEADERS * libguile/socket.c: include <string.h>, remove HAVE_STRING_H * test-suite/standalone/test-unwind.c: include <string.h>, remove HAVE_STRING_H
2022-10-03Test for out of range depth in fluid-ref*Daniel Llorens1-0/+4
Test for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58154, which was fixed in c0004442b7691f59a0e37869ef288eb26382ad9e.
2022-10-02Modifies command line quoting in c-api.testMike Gran1-1/+1
On MinGW, 'system' uses a non-posix shell that does not handle apostrophe as a quoting character. For this test, quoting a command-line with double quotes allows it to be run with both /bin/sh and cmd.exe. * test-suite/tests/c-api.test (egrep): use double quotes when quoting command line
2022-10-02Avoids deprecated egrep in c-api.testMike Gran1-2/+2
The standalone egrep script has been deprecated by GNU grep. 'grep -E' is the suggested replacement. * test-suite/tests/c-api.test (egrep): replace egrep with grep -E
2022-10-01srfi-35: Fix expansion of 'condition' for compound conditions.Ludovic Courtès1-2/+16
* module/srfi/srfi-35.scm (condition): Use 'make-exception' instead of 'make-compound-condition', which is unbound in this module. * test-suite/tests/srfi-35.test ("syntax")["compound condition, hygienic macro expansion"]: New test.
2022-10-01Baseline compiler no longer crashes on (not (list 1 2)).Ludovic Courtès1-1/+7
Fixes <https://bugs.gnu.org/58217>. * module/language/tree-il/compile-bytecode.scm (canonicalize) [finish-conditional](predicate?): Do not assume 'lookup-primitive' returns true. * test-suite/tests/compiler.test ("regression tests") ["(not (list 1 2))"]: New test.
2022-09-20in ftw test, skip EACCESS test on MinGWMike Gran1-3/+9
MinGW ACL-based permissions don't follow POSIX standard, so 'chmod' has unexpected behavior. * test-suite/tests/ftw.test (mingw?): new define ("file system fold: EACCES"): skip test on MinGW
2022-09-20in ftw test, don't presume symlink is definedMike Gran1-34/+40
* test-suite/tests/ftw.test (dangling symlink and lstat) (dangling symlink and stat, symlink to directory): skip if symlink undefined
2022-09-20When fork unavailable, skip standalone tests that require itMichael Gran2-1/+7
MinGW is missing fork. * test-suite/standalone/test-close-on-exec: modified * test-suite/standalone/test-signal-fork: modified
2022-09-19test-suite: Remove obsolete use of 'debug-enable'.Ludovic Courtès1-3/+2
* test-suite/guile-test (enable-debug-mode): Remove 'debug-enable' call.
2022-09-19'pipe' now takes an optional 'flags' parameter.Ludovic Courtès1-0/+35
This is the same strategy as used for the 'accept4' bindings introduced in 6e0965104c579431e5a786b60e1a964a112c73b8. * libguile/posix.c (scm_pipe): Rename to... (scm_pipe2): ... this. Add an optional 'flags' parameter and honor it. (scm_pipe): Rewrite as a call to 'scm_pipe2'. * libguile/posix.h (scm_pipe2): New declaration. * test-suite/tests/posix.test ("pipe"): New tests. * configure.ac: Look for 'pipe2'. * NEWS: Update.
2022-09-07Add support for "e" flag (O_CLOEXEC) to 'open-file'.Ludovic Courtès2-1/+42
* libguile/fports.c (scm_i_mode_to_open_flags): Add 'e' case. (scm_open_file_with_encoding): Document it. * test-suite/standalone/test-close-on-exec: New file. * test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it. * doc/ref/api-io.texi (File Ports): Document it. * NEWS: Update.
2022-08-29In curried definitions, move docstrings to outermost lambdaJean Abou Samra1-2/+50
This makes the docstring attached to the curried function being defined rather than the result of its application until a function that runs the body is obtained, fixing https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50068
2022-08-05'system*' can no longer close file descriptor 2.Ludovic Courtès1-2/+14
Fixes <https://bugs.gnu.org/55596>. Reported by Hugo Nobrega <hugonobrega@ic.ufrj.br> and Jack Hill <jackhill@jackhill.us>. * libguile/posix.c (start_child): Close OUT only if it's greater than 2. * test-suite/tests/posix.test ("system*")["exit code for nonexistent file"] ["https://bugs.gnu.org/55596"]: New tests.
2022-07-04web: Don't hide missing data in the chunked input port.Christopher Baines1-8/+17
This port is of limited use if it cannot be used reliably. Rather than behaving as if the input has finished when it ends unexpectedly, instead raise an exception. * module/web/http.scm (make-chunked-input-port): Raise an exception on premature termination. (&chunked-input-ended-prematurely): New exception type. (chunked-input-ended-prematurely-error?): New procedure. * test-suite/tests/web-http.test (pass-if-named-exception): Rename to pass-if-named-exception. (pass-if-named-exception): New syntax. ("Exception on premature chunk end"): New test for this behaviour. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-07-04web: Handle ending CRLF (\r\n) for chunked input and output ports.Christopher Baines1-2/+2
The chunked transfer encoding specifies the chunked body ends with CRLF. This is in addition to the CRLF at the end of the last chunk, so there should be CRLF twice at the end of the chunked body: https://datatracker.ietf.org/doc/html/rfc2616#section-3.6.1 * module/web/http.scm (make-chunked-input-port): Read two extra bytes at the end of the chunked input. (make-chunked-output-port): Write the missing \r\n when closing the port. * test-suite/tests/web-http.test (chunked encoding): Add missing \r\n to test data. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-07-04web: send capitalized authorization header schemeAleix Conchillo Flaqué1-3/+8
* module/web/http.scm (write-credentials): capitalize authorization header scheme. The standard allows the scheme to be case-insensitive, however most libraries out there expect the scheme to be capitalized, which is what it is actually used in RFC docs (e.g. https://datatracker.ietf.org/doc/html/rfc7617#section-2). Some libraries even reject lowercase scheme making Guile incompatible. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-06-16Allow null bytes in UNIX sockets.Liliana Marie Prikler1-4/+75
The current socket address constructors all assume, that there are no null bytes in the socket path. This assumption does not hold in Linux, which uses an initial null byte to demarcate abstract sockets and ignores all further null bytes [1]. [1] https://www.man7.org/linux/man-pages/man7/unix.7.html * libguile/sockets.c (scm_fill_sockaddr)[HAVE_UNIX_DOMAIN_SOCKETS]: Use scm_to_locale_stringn to construct c_address. Use memcpy instead of strcpy and calculate size directly instead of using SUN_LEN. (_scm_from_sockaddr): Copy the entire path up to the limits imposed by addr_size. * test-suite/tests/00-socket.test: ("make-socket-address"): Add case for abstract unix sockets. ("AF_UNIX/SOCK_STREAM"): Add abstract socket versions of bind, listen, connect and accept. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-06-16Allow empty vendor string in GNU target triplets.Taylor R Campbell1-1/+3
NetBSD and pkgsrc have been using an empty vendor string since the mid-'90s, such as x86_64--netbsd. pkgsrc has been carrying around a workaround just the guile build for a long time. (Before that, NetBSD omitted the vendor altogether, so if x86_64 existed then it might have been `x86_64-netbsd', but that caused more problems.) This change makes Guile accept an empty vendor string so workarounds are no longer necessary. * module/system/base/target.scm (validate-target): Allow empty vendor string in GNU target triplets. * test-suite/tests/cross-compilation.test ("cross-compilation"): Add tests for "x86_64--netbsd". Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-03-16Fix "non-revealed port is closed" ports.testRob Browning1-3/+4
Don't close the test port's file descriptor because the port still has a reference to it, and could still close it at any time when finally garbage collected. This did soemetimes break subsequent tests. Bug: https://debbugs.gnu.org/43521
2022-03-15tests: web-server: Wait until the server is listening.Ludovic Courtès1-1/+24
Fixes synchronization issues observed on slow or loaded machines, where client connection attempts would fail with ECONNREFUSED: https://issues.guix.gnu.org/54348 * test-suite/tests/web-server.test ("server is listening"): New test.
2022-03-07psyntax: Honor source properties for things other than syntax objects.Ludovic Courtès1-2/+24
Commit 54bbe0b2846c5b1aa366c91d679ba724869c8cda inadvertently led psyntax to dismiss source location info for data returned by read hash extensions, because read hash extensions return plain data with associated source properties, even when called from 'read-syntax'. This change reverts part of this commit to restore that behavior. Fixes <https://issues.guix.gnu.org/54003>. * module/ice-9/psyntax.scm (datum-sourcev): New procedure. (source-annotation): Fall back to 'datum-sourcev'. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/compiler.test ("psyntax")["syntax-source with read-hash-extend"]: New test.
2022-03-07tests: Add read-syntax + syntax-source test.Ludovic Courtès1-2/+14
* test-suite/tests/reader.test ("read-syntax")["syntax-source"]: New test.
2022-01-13Have log and log10(real nan) return real nan regardless of signDaniel Llorens1-1/+10
* libguile/numbers.c (log_of_shifted_double, scm_log10): Avoid complex extension when the argument is a real nan. * test-suite/tests/numbers.test: Tests for nans of either sign.
2022-01-04New function bitvector-copy (scm_bitvector_copy)Daniel Llorens1-2/+21
* libguile/bitvectors.h: * libguile/bitvectors.c: As stated. * test-suite/tests/bitvectors.test: Tests. * doc/ref/api-data.texi: Update "Bit vectors" section. * NEWS: Update.
2021-12-06New function srfi-4-vector-type-size in (srfi srfi-4 gnu)Daniel Llorens1-0/+17
This patch removes the undocumented function make-srfi-4-vector from (guile). That function is still exported from (srfi srfi-4 gnu). * libguile/srfi-4.h (scm_init_srfi_4): Split into scm_bootstrap_srfi_4() and scm_init_srfi_4(), after the pattern of scm_init_bytevectors() and scm_bootstrap_bytevectors(). * libguile/init.c: Replace scm_init_srfi_4() call by scm_bootstrap_srfi_4(). * module/srfi/srfi-4.scm: Load newly defined srfi-4 extension. This provides undocumented make-srfi-4-vector. * module/srfi/srfi-4/gnu.scm: Export srfi-4-vector-type-size. * doc/ref/srfi-modules.texi: Document srfi-4-vector-type-size.
2021-11-15Support C99 complex types in (system foreign)Daniel Llorens1-1/+8
* libguile/foreign.h (SCM_FOREIGN_TYPE_COMPLEX_FLOAT, SCM_FOREIGN_TYPE_COMPLEX_DOUBLE): New enums. * module/system/foreign.scm (complex-float, complex-double): Export new types. (make-c-struct, parse-c-struct): Support the new types. * libguile/foreign.c (complex-float, complex-double): Define new types. (alignof, sizeof, pack, unpack): Support the new types. * test-suite/tests/foreign.test: Test.
2021-11-05Limit the range of ash, round-ash count argument to INT32Daniel Llorens1-1/+4
This avoids gmp aborting e.g. with (ash 1 (expt 2 37)). The new limit is such that (ash 1 (expt 30)) is accepted but (ash 1 (expt 31)) throws. Fixes https://bugs.gnu.org/48150 * libguile/numbers.c (ash, round-ash): As stated. * test-suite/tests/numbers.test: Test a case known to make gmp abort before.
2021-10-21Provide xxvector-copy and xxvector-copy! for srfi-4 vectorsDaniel Llorens1-0/+24
These use the argument conventions of vector-copy!, string-copy!, etc. and not that of bytevector-copy! (which is from r6rs). * module/srfi/srfi-4/gnu.scm: As stated. * test-suite/tests/srfi-4.test: Tests. * doc/ref/srfi-modules.texi: Documentation. * libguile/bytevectors.c (bytevector-copy!): Add overlap note to docstring. * libguile/vectors.c (vector-copy!): Reuse text for the overlap note.
2021-10-19(ice-9 format): Fix scaling floats with leading zerosTimothy Sample1-1/+7