1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00
Commit graph

2197 commits

Author SHA1 Message Date
Michael Gran
7b41294049 Improve DLL search strategy for load-foreign-library
The new non-libltdl foreign library loading algorithm from 3.0.6
fails to cover common cases regarding how libtool names and installs
DLL files.  Notably, it fails to recognize when libtool has added the
major version number into the filename itself, such as libfoo-1.dll
Also, it does not search in binary directories and the PATH for DLL
files, where libtool is likely to install DLLs.

This adds the option to search for dlls with major version numbers
in the filename, and modifies the search strategy for DLL-using
OSs to check bindir and PATH.

For MSYS, libraries are installed with the 'msys-' prefix. So this
modifies load-foreign-library to handle that prefix as well.
It changes the #:rename-on-cygwin? option to #:host-type-rename? to
better reflect that is works on both Cygwin and MSYS.

Partially based on a patch by Hannes Müller.

* NEWS: updated
* doc/ref/api-foreign.texi: document updates to load-foreign-library
  and system-dll-path
* module/system/foreign-library.scm (is-integer-string?): new utility function
  (dll-name-match?): new utility function
  (find-best-dll-from-matches): new utility function
  (dll-exists-with-version): new function that implements new dll search logic
  (file-exists-with-extension): add flag argument to allow new dll search
  (file-exists-in-path-with-extension): add flag argument to all new dll search
  (system-dll-path): new parameter
  (lib->msys): new helper function
  (load-foreign-library): add new optarg flag #:allow-dll-version-suffix?
    Pass new flag to library search functions.
    Implement new search strategy for #:search-system-paths? on DLL systems'
    replace #:rename-on-cygwin? with #:host-type-rename?
        Use that option to rename both MSYS and Cygwin libraries.
  (guile-system-extensions-path): prefer bindir to libdir on DLL systems
* test-suite/tests/foreign.test ("dll-name-match?"): new test category
  ("find-best-dll-from-matches"): new test category
  ("lib->msys"): new unit tests
2025-03-22 07:05:31 -07:00
Michael Gran
c9a19a03f8 Cygwin/MSYS: 00-socket.test: abstract sockets are unsupported
Binding to AF_UNIX abstract sockets is not supported on Cygwin and
presumably MSYS as well.

* test-suite/tests/00-socket.text ("AF_UNIX abstract"): throw unsupported
  on Cygwin and MSYS
2025-03-22 06:42:21 -07:00
Michael Gran
73a8ca88fb ports.test: catch pipe errors
Refactors a couple of the ports tests to catch errors in the test runner,
so that the test suite will print ERROR on failure.

* test-suite/tests/ports.test (pipe:write, pipe:read): modified
2025-03-22 06:27:51 -07:00
Michael Gran
b572f187af version.test: incorrect test logic
Since string-contains returns an integer on success, this test
was reporting unresolved instead of pass on success.

* test-suite/tests/version.test ("version reporting works"): fix
  boolean check logic
2025-03-22 05:57:27 -07:00
Rob Browning
4527371d1b filesys.test: skip copy-file EACCES test when root
Accidentally omitted from b3b7477128.

* test-suite/tests/filesys.test: skip copy-file EACCES test when root.
2025-03-20 13:21:56 -05:00
Rob Browning
b3b7477128 Add missing, read-only, and typical copy-file tests
* test-suite/guile-test: add call-with-temp-dir and exception-errno.
* test-suite/tests/filesys.test: add further copy-file tests.
2025-03-19 21:25:40 -05:00
Rob Browning
5012581745 r6rs-ports.test: don't race with gc close in custom port tests
The tests share a "log" for custom port events and didn't always
explicitly close the test ports, so the close might come later, during
another test.  Change the tests to always close their ports immediately,
and clear the log after checking for expected "inter-test" events.

test-suite/tests/r6rs-ports.test: don't race with gc close in custom
port tests.
2025-03-02 14:44:53 -06:00
Dale P. Smith
29c27afe96 Allow trailing "." in urls
Fixes https://debbugs.gnu.org/53201

* module/web/uri.scm (valid-host?): Allow trailing "." in URLs
* test-suite/tests/web-uri.test: Add tests for trailing "."
2025-03-02 21:18:19 +01:00
Tomas Volf
c1353972ee srfi-19: Fix ~V converter in date->string.
The ~V is supposed to print ISO week number, not a week number.  This
commit fixes that.

* module/srfi/srfi-19.scm (date-week-number-iso): New procedure taken
  from the reference implementation.
  (directives)<#\V>: Use it.
* test-suite/tests/srfi-19.test ("date->string ~V"): Add tests taken
  from the reference test suite.
* doc/ref/srfi-modules.texi (SRFI-19 Date to string): Mention ISO-8601
  in description for ~V.

Fixes <https://bugs.gnu.org/74841>.
Edited by lloda <lloda@sarc.name>.
2025-02-28 10:28:06 +01:00
Daniel Llorens
bf3c632b82 Fix bug in srfi-111 box printer
* module/srfi/srfi-111.scm: Add missing port.
* test-suite/tests/srfi-111.test: Test.
2025-01-16 15:47:03 +01:00
Ekaitz Zarraga
6750f6cc80
PEG: string-peg: Add HTML5 grammar test.
* test-suite/tests/peg.test (comment-grammar): Z can be anything.
("simple comment with forbidden char"): Remove.
(html-grammar, html-example): New variables.
("parsing with complex grammars"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-22 22:17:39 +01:00
Adam Faiz
c2829e4a86 New line or field iteration procedures in (ice-9 rdelim)
* NEWS: Update
* module/ice-9/rdelim (for-rdelim-from-port, for-delimited-from-port,
  for-line-in-file): New procedures.
* doc/ref/api-io.texi: Documentation of `for-rdelim-for-port`-related
  procedures.
* test-suite/tests/rdelim.test: Tests for `for-rdelim-for-port`-related
  procedures.

Signed-off-by: Mikael Djurfeldt <mikael@djurfeldt.com>
2024-12-19 22:36:38 +01:00
Mikael Djurfeldt
a9c079b13b goops.test: Add tests for define-method* 2024-12-11 22:43:17 +01:00
Ekaitz Zarraga
25504ba216
PEG: Add support for not-in-range and [^...]
Modern PEG supports inversed class like `[^a-z]` that would get any
character not in the `a-z` range. This commit adds support for that and
also for a new `not-in-range` PEG pattern for scheme.

* module/ice-9/peg/codegen.scm (cg-not-in-range): New function.
* module/ice-9/peg/string-peg.scm: Add support for `[^...]`
* test-suite/tests/peg.test: Test it.
* doc/ref/api-peg.texi: Document accordingly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-09 18:15:01 +01:00
Ekaitz Zarraga
ff11753df1
PEG: Add full support for PEG + some extensions
This commit adds support for PEG as described in:

    <https://bford.info/pub/lang/peg.pdf>

It adds support for the missing features (comments, underscores in
identifiers and escaping) while keeping the extensions (dashes in
identifiers, < and <--).

The naming system tries to be as close as possible to the one proposed
in the paper.

* module/ice-9/peg/string-peg.scm: Rewrite PEG parser.
* test-suite/tests/peg.test: Fix import

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-12-09 18:13:08 +01:00
Mikael Djurfeldt
20405089de test-suite: Canonicalize path in test directory
* test-suite/tests/filesys.test: Canonicalize path in the chdir tests to
avoid false differences due to following links.
2024-11-27 14:59:04 +01:00
Tomas Volf
ff256c356b
Do not depend on tmpnam in posix.test.
`tmpnam' is a deprecated procedure that can be excluded during a
configure (`--disable-tmpnam').  There currently was a single test
relying on it, and therefore failing is such configuration.  This commit
switches to mkstemp instead.

* test-suite/tests/posix.test ("system*"): Use mkstemp instead of
tmpnam.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 21:22:23 +02:00
Tomas Volf
58a722d883
tests: Fix spawn if file not found with Gnulib.
On Darwin posix_spawnp is not considered secured and therefore we
fallback to Gnulib's version.  That one however does not return ENOENT
when the file does not exist, but PID of the child process.  This seems
to be allowed by the standard.

* test-suite/tests/posix.test (skip-on-darwin): New procedure.
("spawn")["file not file"]: Skip on Darwin.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 21:22:23 +02:00
Tomas Volf
1746dbbe4d
tests: Fix spawn with #:environment on MacOS.
MacOS adds __CF_USER_TEXT_ENCODING to every program, in similar way GNU
Hurd prepends LD_ORIGIN_PATH (based on the comment).  So extend the
logic to do similar stripping on MacOS.

* test-suite/tests/posix.test ("spawn")
["env with #:environment and #:output"]: Strip trailing
__CF_USER_TEXT_ENCODING environment variable when on Darwin.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 21:22:23 +02:00
Tomas Volf
8579b73aba
tests: Skip mkdtemp test for invalid template on Darwin.
Darwin accepts any template, as demonstrated here:

    #include <stdio.h>
    #include <unistd.h>

    int
    main(void)
    {
    	char template[] = {'T', '-', 'A', 'A', 'A', 'A', 'A', 'A', '\0'};
    	char *res = mkdtemp(template);
    	puts(res ? res : "(null)");
    	perror("mkdtemp");
    }

Outputs:

    T-AAAAAA
    mkdtemp: Undefined error: 0

This does not match prescribed POSIX behavior, but it is what it is.

* test-suite/tests/filesys.test (skip-on-darwin): New procedure.
("mkdtemp")["invalid template"]: Skip on Darwin.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 21:22:23 +02:00
Tomas Volf
21e3e1c420
tests: Skip hole-related port tests on Darwin.
Hole are itself a file-system specific feature and they are not
mandated.  While APFS does support sparse files, they do not behave like
on Linux.  I did not discover exact rules, but the file needs to be
large (100s of kB at least) and the holes are not aligned as the test
code expects.  So just disable them.

* test-suite/tests/ports.test (skip-on-darwin): New procedure.
("size of sparse file", "SEEK_DATA while on data")
("SEEK_DATA while in hole", "SEEK_HOLE while in hole"): Skip on Darwin.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 21:22:22 +02:00
Tomas Volf
478f139d77
tests: Skip tests of abstract Unix sockets on Darwin.
Darwin does not support abstract Unix sockets, so mark the tests as
skipped.

* test-suite/tests/00-socket.test (skip-on-darwin): New procedure.
("bind abstract", "listen abstract", "connect abstract")
("accept abstract"): Skip on Darwin.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 21:22:22 +02:00
Tomas Volf
a8ce7f1f92
tests: Check TCP_NODELAY for non-zero instead of 1.
POSIX does not explicitly say that stored value using setsockopt will be
returned by getsockopt.  At least for TCP_NODELAY on Darwin they do
differ.  Darwin returns internal define TF_NODELAY (4) instead of 1 the
test expected.  Since for boolean flags "non-zero is true", rewrite the
test to check just that.

* test-suite/tests/00-socket.test ("setsockopt AF_INET")
["IPPROTO_TCP TCP_NODELAY"]: Check for non-zero value from getsockopt.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 21:22:22 +02:00
Tomas Volf
ad90f45a8c
Replace SRFI-64 with a new implementation.
The bundled (reference) implementation was of somewhat mixed quality and
it failed to follow standard in multiple places.  This commit replaces
it with a new one, written from scratch to follow the standard as close
as possible.

* module/srfi/srfi-64/testing.scm: Delete file.
* module/srfi/srfi-64.scm: Replace with new implementation.
* am/bootstrap.am (srfi/srfi-64.go): Remove extra dependencies.
(NOCOMP_SOURCES): Remove srfi/srfi-64/testing.scm.
* test-suite/tests/srfi-64-test.scm
("8.6.1. Simple (form 1) test-apply")
("8.6.2. Simple (form 2) test-apply"): Adjust tests to follow the
specification.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-10-20 19:11:42 +02:00
Rob Browning
c03115c39d basename: check suffix against basename, not full argument
* libguile/filesys: check suffix against basename, not full argument.

Closes: 69437
2024-08-03 14:39:26 -05:00
Rob Browning
945c97b14d srfi-1 lset-difference!: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_lset-difference_x): delete.
* libguile/srfi-1.h (scm_srfi1_lset-difference_x): delete.
* module/srfi/srfi-1.scm: add lset-difference!.
* test-suite/tests/srfi-1.test: extend lset-difference! tests to cover
lset-difference.
2024-07-30 19:28:37 -05:00
Rob Browning
372a52e6aa srfi-1 length+: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_length_plus): delete.
* libguile/srfi-1.h (scm_srfi1_length_plus): delete.
* module/srfi/srfi-1.scm: add length+.
2024-07-30 19:28:37 -05:00
Rob Browning
c62d2962d4 srfi-1 concatenate concatenate!: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_concatenate, scm_srfi1_concatenate_x): delete.
* libguile/srfi-1.h (scm_srfi1_concatenate, scm_srfi1_concatenate_x): delete.
* module/srfi/srfi-1.scm: add concatenate and concatenate!.
2024-07-30 18:54:45 -05:00
Rob Browning
aa44035ee8 srfi-1 list-copy: move from C to Scheme
* libguile/srfi-1.c (scm_srfi1_list_copy): delete.
* libguile/srfi-1.h (scm_srfi1_list_copy): delete.
* module/srfi/srfi-1.scm: add list-copy.
* test-suite/tests/srfi-1.test: ensure copied spine is independent.
2024-07-30 18:54:45 -05:00
Andy Wingo
b93dc62e03 Fix parallel test bug in r6rs-ports.test
* test-suite/tests/r6rs-ports.test (test-file): Use different file from
ports.test, to avoid problems during parallel tests.
2024-06-23 21:43:05 +02:00
Arne Babenhauserheide
dce65edbaf
Add language/wisp, Wisp tests, and SRFI-119 documentation
* doc/ref/srfi-modules.texi (srfi-119): add node
* module/language/wisp.scm: New file.
* module/language/wisp/spec.scm: New file.
* test-suite/tests/srfi-119.test: New file.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-06-01 11:50:16 +02:00
Juliana Sims
a222503a89
Second argument of ‘unread-string’ is optional.
Fixes <https://bugs.gnu.org/67063>.

* doc/ref/api-io.texi (Venerable Port Interfaces): Bring unread-string
procedure documentation in line with other procedures in the section.
* libguile/ports.c (scm_unread_string): Make port argument optional.
* test-suite/tests/ports.test: Test unread-char and unread-string
without ports.
* NEWS: Update.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-05-06 11:51:53 +02:00
Morgan Smith
f27e8b855f
Fix typos throughout codebase.
* NEWS:
* doc/ref/api-control.texi:
* doc/ref/api-data.texi:
* doc/ref/api-debug.texi:
* doc/ref/api-deprecated.texi:
* doc/ref/api-evaluation.texi:
* doc/ref/api-foreign.texi:
* doc/ref/api-i18n.texi:
* doc/ref/api-io.texi:
* doc/ref/api-languages.texi:
* doc/ref/api-macros.texi:
* doc/ref/api-memory.texi:
* doc/ref/api-modules.texi:
* doc/ref/api-options.texi:
* doc/ref/api-peg.texi:
* doc/ref/api-procedures.texi:
* doc/ref/api-scheduling.texi:
* doc/ref/api-undocumented.texi:
* doc/ref/api-utility.texi:
* doc/ref/expect.texi:
* doc/ref/goops.texi:
* doc/ref/misc-modules.texi:
* doc/ref/posix.texi:
* doc/ref/repl-modules.texi:
* doc/ref/scheme-ideas.texi:
* doc/ref/scheme-scripts.texi:
* doc/ref/srfi-modules.texi:
* gc-benchmarks/larceny/dynamic.sch:
* gc-benchmarks/larceny/twobit-input-long.sch:
* gc-benchmarks/larceny/twobit.sch:
* libguile/gc.h:
* libguile/ioext.c:
* libguile/list.c:
* libguile/options.c:
* libguile/posix.c:
* libguile/threads.c:
* module/ice-9/boot-9.scm:
* module/ice-9/optargs.scm:
* module/ice-9/ports.scm:
* module/ice-9/pretty-print.scm:
* module/ice-9/psyntax.scm:
* module/language/elisp/parser.scm:
* module/language/tree-il/compile-bytecode.scm:
* module/srfi/srfi-37.scm:
* module/srfi/srfi-43.scm:
* module/statprof.scm:
* module/texinfo/reflection.scm:
* test-suite/tests/eval.test:
* test-suite/tests/fluids.test:
Fix typos.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-05-06 11:51:53 +02:00
Ludovic Courtès
696acfc9e5
‘seek’ now accepts ‘SEEK_DATA’ and ‘SEEK_HOLE’ where supported.
* libguile/ports.c (scm_seek): Let SEEK_DATA and SEEK_HOLE through.
(scm_init_ice_9_ports): Define ‘SEEK_DATA’ and ‘SEEK_HOLE’.
* module/ice-9/ports.scm: Export ‘SEEK_DATA’ and ‘SEEK_HOLE’ when
defined.
* test-suite/tests/ports.test ("size of sparse file")
("SEEK_DATA while on data", "SEEK_DATA while in hole")
("SEEK_HOLE while in hole"): New tests.
* NEWS: Update.
2024-04-15 19:58:25 +02:00
Rob Browning
6059c99fc2 interp.test: add missing (test-suite lib) dependency
* test-suite/tests/interp.test: use (test-suite lib)
2024-04-14 16:15:10 -05:00
Rob Browning
d0301eac2c srfi-10.test: add missing (test-suite lib) dependency
* test-suite/tests/srfi-10.test: use (test-suite lib)
2024-04-14 16:15:10 -05:00
Rob Browning
0b259e98f8 r6rs-unicode.test: add emacs scheme mode marker
* test-suite/tests/r6rs-unicode.test add emacs scheme mode marker.
2024-04-14 13:24:23 -05:00
Denis 'GNUtoo' Carikli
bc2c612b89 SRFI-19: Add support for ISO 8601 zones with a colon.
* module/srfi/srfi-19.scm (zone-reader): handle a colon in the zone.

* test-suite/tests/srfi-19.test (SRFI date/time library test): Add test.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>

[rlb@defaultvalue.org: adjust commit message; add NEWS]
2024-04-13 14:35:29 -05:00
Rob Browning
0ffa802be2 eval-string.test: check source properties
* test-suite/tests/eval-string.test: add properties test.

cf. 025bb024ae
2024-04-05 17:51:48 -05:00
Andy Wingo
b012c80875 Add test: writes to specific fields clobber reads of whole objects
* test-suite/tests/compiler.test ("cse auxiliary definitions"): New
test.
2024-03-20 11:50:53 +01:00
Daniel Llorens
54c4753dd3 Add missing branch in scm_is_less_than()
Fixes https://debbugs.gnu.org/69725.

* libguile/numbers.c (scm_is_less_than): Add branch for (< fraction real).
* test-suite/tests/numbers.test (<): New test.
2024-03-19 16:03:09 +01:00
Andy Wingo
2b58dea2d2 (scheme foreign): API is less configuration-dependent
* libguile/foreign.h:
* libguile/foreign.c: Always define complex-float and complex-double.
Fall back to alignof float / 2*sizeof float if no complex numbers.  (But
with C99 surely it exists everywhere.)
* module/system/foreign.scm (*writers*, *readers*): Always include
complex-float and complex-double readers and writers.
* test-suite/tests/foreign.test: Always run the complex tests.
2024-03-17 21:40:58 +01:00
Andy Wingo
f95bf6921e peval: Enable inlining for functions with kwargs
* module/language/tree-il/peval.scm (peval): Handle all lambda inlining
the same, and extend with support for multiple clauses and keyword
arguments.
* test-suite/tests/peval.test ("case-lambda"): Enable kwarg inlining.
2024-03-13 20:19:59 +01:00
Andy Wingo
9e0f03c5fd Macro-introduced top-level vars scope to their module even if unbound
* module/ice-9/psyntax.scm (analyze-variable): Previously, a reference
to a top-level variable in a module other than the current module would
be silently rewritten to reference the current module, if the variable
was unbound in its original module.  This was a hack from the early days
of when we extended psyntax to know about the module system.  Fix to
properly use the scope of the introduced binding instead of the scope of
the macro use site.
* test-suite/tests/syntax.test ("macro-introduced cross-module unbound
identifiers"): Add test.
* module/ice-9/psyntax-pp.scm: Regenerate.
2024-02-20 14:15:12 +01:00
Andy Wingo
49f24d2bf5 Fix test for unique macro-introduced toplevels 2024-01-29 11:34:59 +01:00
Andy Wingo
1349c41a60 Ensure macro-introduced top-level identifiers are unique
* module/ice-9/psyntax.scm (expand-top-sequence): When making a fresh
name for an introduced identifier, the hash isn't enough: it's quite
possible for normal programs to have colliding hash values, because
Guile's hash functions on pairs doesn't traverse the whole tree.
Therefore, append a uniquifying counter if the introduced name is
already defined in the current expansion unit.
* test-suite/tests/syntax.test ("duplicate top-level introduced
definitions"): Add test.
2024-01-29 10:53:13 +01:00
Olivier Dion
455ee49f55
Fix asymetric mutex locking when joining thread.
If `join-thread' timeout, the thread mutex is not unlocked, resulting in
deadlock to the next call to it or deadlock of the thread itself when it
terminates.

Thus, always unlock the mutex.

Fixes <https://bugs.gnu.org/55356>.

* module/ice-9/threads.scm (join-thread): Always unlock thread mutex.
* test-suite/tests/threads.test (join-thread): New test to ensure the
mutex is released.
* NEWS: Update.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2024-01-25 23:12:53 +01:00
Andy Wingo
d7cf5bf373 Recognize append as a primcall and optimize it
* module/language/tree-il/primitives.scm (*primitive-constructors*):
(append): Recognize append and reduce it to only the two-operand form.
* module/language/tree-il/peval.scm (peval): Add optimizations to
append.
2023-11-27 14:30:41 +01:00
Andy Wingo
38e9bd7a2f Avoid swallowing errors for (values) operands of elided primcalls
* module/language/tree-il/peval.scm (peval): When visiting (values) in
anything other than an effect or values context,
residualize (values (values)), which will cause a run-time error.
* test-suite/tests/peval.test ("values"): Add test.
2023-11-27 14:24:50 +01:00
Andy Wingo
83449a8683 prompts avoid introducing throw; fixup peval test
* test-suite/tests/peval.test ("partial evaluation"): Fix to expect
raise-type-error from dynwind peval.  Update prompt expectation
similarly.
* module/language/tree-il/primitives.scm (call-with-prompt): Use
raise-type-error.
2023-11-23 12:30:36 +01:00