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

2728 commits

Author SHA1 Message Date
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
Rob Browning
ad1f56675b test-hashing: support 32-bit
* test-suite/standalone/test-hashing.c (test_hashing): add expected
value for 32-bit architectures.
2024-07-12 17:49:45 -05:00
Andy Wingo
b2cc237a02 Fix distcheck problems with parallel tests
* test-suite/Makefile.am (EXTRA_DIST): Add (test-lib lib automake)
(TEST_LOG_DRIVER): Use srcdir.
2024-06-23 23:26:47 +02: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
Andy Wingo
2a4c095f79 Avoid stompling user TESTS_ENVIRONMENT var
* test-suite/standalone/Makefile.am (top_srcdir): Use
AM_TESTS_ENVIRONMENT.
2024-06-20 15:54:53 +02:00
Rob Browning
df04f5357a Switch to the preferred parallel automake test harness
Automake "strongly discourages" use of the serial driver, and switching
to the preferred parallel driver allows make -j4 check to run in about
half the time on a four core (not thread) host.

* Makefile.am (TESTS, TESTS_ENVIRONMENT): run ./check-guile from
test-suite/, not here.
* check-guile.in: let test harness handle progress output.
* configure.ac (AM_INIT_AUTOMAKE): allow parallel testing.
* test-suite/Makefile.am (SCM_TESTS): remove non-tests.
(EXTRA_DIST): move non-tests here.
(TESTS): include SCM_TESTS (now driven from here).
(TEST_EXTENSIONS): allow customization for .scm and .test.
(TESTS_ENVIRONMENT): stop defining (user only).
(AM_TESTS_ENVIRONMENT): replaces TESTS_ENVIRONMENT; drop guile.
(SCM_LOG_COMPILER): run .scm tests via meta/guile.
(AM_SCM_LOG_FLAGS): keep --no-auto-compile for .scm tests.
(TEST_LOG_DRIVER): run .test tests via custom automake ./driver.
* test-suite/driver: add automake test driver.
2024-06-20 15:35:48 +02:00
Rob Browning
590eb72c69 guile-test: support automake parallel test harness via --trs-file
Support an optional --trs-file PATH argument that causes guile-test to
write the status information expected by the automake parallel test
harness to PATH.

In addition, when --trs-file is specified, suppress the final test
summary (via print-counts) since it would be repeated per-test-file when
running in parallel, the automake harness prints its own summary.

cf. https://www.gnu.org/software/automake/manual/html_node/API-for-Custom-Test-Drivers.html

* test-suite/guile-test (main): support --trs-file and --log-file.
* test-suite/test-suite/lib.scm: add count-summary-line.
* test-suite/test-suite/lib/automake.scm: add automake custom test driver.
2024-06-20 15:35:48 +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
fc62dba31b guile-test: set module declarative #f to eliminate warning
* test-suite/guile-test: set module declarative #f to eliminate warning
2024-04-14 16:15:10 -05: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
3ff8836e64 test-bad-identifiers: ignore *.[hc] dotfiles
When generating the list of test files, ignore any whose names begin
with a dot.  If nothing else, this avoids crashing on the symlinks that
Emacs creates for files with pending changes.  In that case it creates a
symlink to nowhere until the content is saved or reverted, and those
symlinks produce test failures like this:

  Backtrace:
             3 (primitive-load "/home/rlb/src/guile/utf8-debug/test-su?")
  In ice-9/eval.scm:
      619:8  2 (_ #(#(#(#<directory (guile-user) 7f0239b32c80> #) #) #))
  In ice-9/ports.scm:
     450:11  1 (call-with-input-file "../../libguile/.#strings.c" #<p?> ?)
  In unknown file:
             0 (open-file "../../libguile/.#strings.c" "r" #:encoding # ?)

  ERROR: In procedure open-file:
  In procedure open-file: No such file or directory: "../../libguile/.#strings.c"
  FAIL: test-bad-identifiers

* test-suite/standalone/test-bad-identifiers: ignore files with names
beginning with a dot.
2024-04-14 15:59:31 -05:00
Rob Browning
6bb6c89f89 guile-test: ignore *.test dotfiles by default
Adjust guile-test to ignore any test files with names beginning with a
dot.

If nothing else, this avoids make check and ./check-guile failures when
Emacs has unsaved changes to a test file.  In that case Emacs creates a
symlink to nowhere until the content is saved or reverted.

* test-suite/guile-test: ignore test files whose names begin with a dot.
2024-04-14 15:51:33 -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
Arne Babenhauserheide
5bbc2d41d9 guile-test: define as non-declarative
* test-suite/guile-test (define-module): add #:declarative? #f because
  it uses load
2024-03-14 22:08:46 +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
Ludovic Courtès
5a8502a494
Stop signal thread before forking, restart it afterwards.
Fixes <https://bugs.gnu.org/68087>.

* libguile/scmsigs.h (scm_i_signals_pre_fork, scm_i_signals_post_fork):
New declarations.
(scm_i_signal_delivery_thread): Change type to SCM..
* libguile/threads.c (scm_all_threads): Adjust accordingly and exclude
threads that have ‘t->exited’.  Access ‘thread_count’ after grabbing
‘thread_admin_mutex’.
* libguile/posix.c (scm_fork): Add calls to ‘scm_i_signals_pre_fork’ and
‘scm_i_signals_post_fork’.
* libguile/scmsigs.c (signal_delivery_thread): Close signal_pipe[0] upon
exit and set it to -1.
(once): New file-global variable, moved from…
(scm_i_ensure_signal_delivery_thread): … here.
(stop_signal_delivery_thread, scm_i_signals_pre_fork)
(scm_i_signals_post_fork): New functions.
* test-suite/standalone/test-sigaction-fork: New file.
* test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it.
2024-01-05 18:59:58 +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
Andy Wingo
437e5ac43d Fix pretty-print with a per-line prefix
* module/ice-9/pretty-print.scm (pretty-print): Include the per-line
prefix in the indent.
* test-suite/tests/print.test ("pretty-print"): Add test.
2023-11-15 09:35:23 +01:00
Daniel Llorens
4daf4664cf Add test for r7rs string-for-each
* test-suite/tests/r7rs.test: As stated.
* module/scheme/base.scm: Reindent and add minimal doc.
2023-09-29 16:51:27 +02:00
Andy Wingo
8441d8ff56 Fix docstring for symbol->string, string->symbol
* libguile/symbols.c (scm_symbol_to_string, scm_string_to_symbol):
Remove some confusing documentation that assumes that Guile is
case-insensitive, and which uses a word that may be perceived as a slur.
* module/ice-9/test.scm:
* test-suite/tests/r4rs.test: Rename a test to avoid using a slur.
2023-09-18 16:03:41 +02:00
Andy Wingo
850b724f85 More robust asyncs.test
* test-suite/tests/asyncs.test: Instead of wrapping abort-to-prompt with
false-if-exception, to handle edge cases, guard with
suspendable-continuation?: this also catches recursive invocations.
2023-09-18 15:24:37 +02:00
Andy Wingo
1f724ccd39 Fix embarrassing pretty-print bug
* module/ice-9/pretty-print.scm (pretty-print): We were never indenting
more than 8 spaces.  Doh!
* test-suite/tests/print.test (prints?, "pretty-print"): Add test.
2023-08-24 12:20:45 +02:00
Michael Gran
0e9ccaf47c In test-extensions test, must export library fuctions when built as DLL
The test-extensions standalone test creates a library to be loaded with
load-extension.  When such libraries are DLLs, the public functions
must be marked with the dllexport function attribute.

* test-suite/standalone/test-extensions-lib.c (API): new define
  Mark public functions with define.
2023-07-17 21:05:07 -07:00