summaryrefslogtreecommitdiff
path: root/test-suite/standalone
AgeCommit message (Collapse)AuthorFilesLines
2024-07-12test-hashing: support 32-bitRob Browning1-1/+7
* test-suite/standalone/test-hashing.c (test_hashing): add expected value for 32-bit architectures.
2024-06-20Avoid stompling user TESTS_ENVIRONMENT varAndy Wingo1-2/+2
* test-suite/standalone/Makefile.am (top_srcdir): Use AM_TESTS_ENVIRONMENT.
2024-04-14test-bad-identifiers: ignore *.[hc] dotfilesRob Browning1-8/+5
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-01-05Stop signal thread before forking, restart it afterwards.Ludovic Courtès2-2/+89
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.
2023-07-17In test-extensions test, must export library fuctions when built as DLLMichael Gran1-2/+8
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-03-18scm_i_utf8_string_hash: compute u8 chars not bytesRob Browning3-0/+71
Noticed while investigating a migration to utf-8 strings. After making changes that routed non-ascii symbol hashing through this function, encoding-iso88597.test began intermittently failing because it would traverse trailing garbage when u8_strnlen reported 8 chars instead of 4. Change the scm_i_str2symbol and scm_i_str2uninterned_symbol internal hash type to unsigned long to explicitly match the scm_i_string_hash result type. * libguile/hash.c (scm_i_utf8_string_hash): Call u8_mbsnlen not u8_strnlen. * libguile/symbols.c (scm_i_str2symbol, scm_i_str2uninterned_symbol): Use unsigned long for scm_i_string_hash result. * test-suite/standalone/.gitignore: Add test-hashing. * test-suite/standalone/Makefile.am: Add test-hashing. * test-suite/standalone/test-hashing.c: Add.
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-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-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.
2021-05-08'primitive-fork' closes and recreates the current thread's 'sleep_pipe'.Ludovic Courtès2-0/+66
Partly fixes <https://bugs.gnu.org/41948>. Previously, the child process could end up using the same 'sleep_pipe' as its parent, leading to a race condition handling signals. * libguile/posix.c (do_fork): New function. (scm_fork): Call 'do_fork' via 'scm_without_guile'. * test-suite/standalone/test-signal-fork: New test. * test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it.
2021-03-11Build standalone test libraries as unversionedMike Gran1-4/+4
* test-suite/standalone/Makefile.am (libtest_asmobs_la_LDFLAGS): avoid version (libtest_ffi_la_LDFLAGS, libtest_extensions_la_LDFLAGS): avoid version
2021-01-21standalone tests require libgnu on DLL-based platformsMichael Gran1-13/+13
* test-suite/standalone/Makefile.am (test_conversion_LDADD): add libgnu (test_scm_to_latin1_string_LDADD): add libgnu (test_scm_values_LDADD): add libgnu (test_scm_c_bind_keyword_arguments): add libgnu (test_srfi_4_LDADD): add libgnu (libtest_extensions_la_LIBADD): add libgnu (test_with_guile_module_LDADD): add libgnu (test_scm_with_guile_LDADD): add libgnu (test_scm_spawn_thread_LDADD): add libgnu (test_pthread_create_LDADD): add libgnu (test_pthread_create_secondary_LDADD): add libgnu (test_smob_mark_LDADD): add libgnu (test_smob_mark_race_LDADD): add libgnu
2021-01-21test-foreign-object-c should link libgnuMichael Gran1-2/+2
For MinGW, the foreign object test requires stubs provided by libgnu * test-suite/standalone/Makefile.am (test_foreign_object_c_LDADD): add libgnu
2021-01-21for dynamic-link tests, mingw needs to link to msvcrtMichael Gran2-0/+5
* test-suite/standalone/test-ffi: link msvcrt for mingw * test-suite/standalone/test-foreign-object-scm: link msvcrt for mingw
2021-01-21in command line encoding test don't presume extant UTF-8 localeMichael Gran1-1/+4
* test-suite/standalone/test-command-line-encoding: abort if locale is not UTF-8
2021-01-21skip compile test when pause not availableMichael Gran1-2/+2
* test-suite/standalone/test-guild-compile: abort if pause does not exist
2019-08-25Fix out-of-memory test for top-level inliningAndy Wingo1-1/+5
* test-suite/standalone/test-out-of-memory: Prevent the test harness from being inlined. If the test harness is inlined, it might cause the optimizer to omit the allocations being tested!
2019-05-23Avoid leaking a file descriptor in test-unwindMike Gran1-2/+5
* test-suite/standalone/test-unwind.c (check_ports): explicitly close temp file
2018-06-21Replace uses of scm_t_int8, scm_t_uintmax, etc with stdint typesAndy Wingo4-114/+114
* libguile/bitvectors.c: * libguile/bitvectors.h: * libguile/bytevectors.c: * libguile/bytevectors.h: * libguile/chars.c: * libguile/continuations.c: * libguile/control.c: * libguile/conv-integer.i.c: * libguile/conv-uinteger.i.c: * libguile/dynstack.c: * libguile/dynstack.h: * libguile/foreign.c: * libguile/frames.c: * libguile/frames.h: * libguile/gc-inline.h: * libguile/gc.h: * libguile/gsubr.c: * libguile/gsubr.h: * libguile/hash.c: * libguile/i18n.c: * libguile/instructions.c: * libguile/intrinsics.c: * libguile/intrinsics.h: * libguile/loader.c: * libguile/loader.h: * libguile/numbers.c: * libguile/numbers.h: * libguile/pairs.c: * libguile/ports-internal.h: * libguile/ports.c: * libguile/ports.h: * libguile/posix.c: * libguile/print.c: * libguile/print.h: * libguile/programs.c: * libguile/programs.h: * libguile/r6rs-ports.c: * libguile/random.c: * libguile/random.h: * libguile/scm.h: * libguile/socket.c: * libguile/srfi-4.c: * libguile/srfi-4.h: * libguile/stacks.c: * libguile/stime.c: * libguile/strings.c: * libguile/struct.c: * libguile/struct.h: * libguile/symbols.c: * libguile/threads.c: * libguile/threads.h: * libguile/uniform.c: * libguile/vm-engine.c: * libguile/vm.c: * libguile/vm.h: * libguile/vports.c: * test-suite/standalone/test-conversion.c: * test-suite/standalone/test-ffi-lib.c: * test-suite/standalone/test-scm-take-u8vector.c: * test-suite/standalone/test-srfi-4.c: Replace e.g. scm_t_uint8 with uint8_t.
2018-06-20Update license notices in all C filesAndy Wingo24-408/+408
Update to newest recommended license notices from the FSF. Everything stays LGPLv3+ except guile-readline which is GPLv3+.
2018-06-20Remove (C) from copyright statementsAndy Wingo24-25/+47
As the FSF advises, 'There is no legal significance to using the three-character sequence “(C)”, but it does no harm.' It does take up space though! For that reason, we remove it here from our C files.
2018-06-20Fix missing includes in tests.Andy Wingo2-4/+7
* test-suite/standalone/test-scm-c-read.c: * test-suite/standalone/test-scm-to-latin1-string.c: Add <string.h>.
2018-06-20Use stdint.h limit macrosAndy Wingo1-88/+89
* libguile/__scm.h: Include <stdint.h>, now that we rely on C99. (SCM_T_UINT8_MAX, SCM_T_INT8_MIN, SCM_T_INT8_MAX, SCM_T_UINT16_MAX) (SCM_T_INT16_MIN, SCM_T_INT16_MAX, SCM_T_UINT32_MAX, SCM_T_INT32_MIN) (SCM_T_INT32_MAX, SCM_T_UINT64_MAX, SCM_T_INT64_MIN, SCM_T_INT64_MAX) (SCM_T_UINTMAX_MAX, SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX) (SCM_T_UINTPTR_MAX, SCM_T_INTPTR_MIN, SCM_T_INTPTR_MAX): Define in terms of equivalent stdint.h definitions. * libguile/gen-scmconfig.c: * libguile/instructions.c: * libguile/numbers.c: * libguile/random.c: * libguile/tags.h: * test-suite/standalone/test-conversion.c: Adapt to use C99 names.
2018-06-20Fix include in test-ffi-libAndy Wingo1-1/+3
* test-suite/standalone/test-ffi-lib.c: Add missing <string.h> include.
2017-05-16On Hurd, skip tests that require working setrlimits for memoryManolis Ragkousis2-0/+12
On Hurd, setrlimits are not yet implemented. See <https://lists.gnu.org/archive/html/bug-hurd/2017-05/msg00013.html>. * test-suite/standalone/test-out-of-memory: skip for Hurd. * test-suite/standalone/test-stack-overflow: skip for Hurd.
2017-03-05Can't recursively search DLLs with FFI on CygwinMike Gran2-4/+22
* doc/ref/api-foreign.text (dynamic-link): document problems with recursive DLLs. * test-suite/standalone/test-ffi (global): with Cygwin, dynamic-link C library explicitly * test-suite/standalone/test-foreign-object-scm (libc-ptr): with Cygwin, link C library explicitly * test-suite/tests/foreign.test (qsort): with Cygwin, link C library explicitly
2017-03-03Cygwin: skip tests that require working setrlimits for memoryMike Gran2-1/+17
On Cygwin, setrlimits cannot be used to set total memory availabe for a process. * test-suite/standalone/test-out-of-memory: skip for cygwin * test-suite/standalone/test-stack-overflow: skip for cygwin
2017-03-01Remove extraneous debugging output in testAndy Wingo1-1/+0
* test-suite/standalone/test-scm-c-bind-keyword-arguments.c (missing_value_error_handler): Remove debugging write.
2017-02-28Better errors for odd-length keyword argsAndy Wingo1-12/+10
* libguile/vm-engine.c (bind-kwargs): * libguile/vm.c (vm_error_kwargs_missing_value): * libguile/eval.c (error_missing_value) (prepare_boot_closure_env_for_apply): Adapt to mirror VM behavior. * libguile/keywords.c (scm_c_bind_keyword_arguments): Likewise. * module/ice-9/eval.scm (primitive-eval): Update to error on (foo #:kw) with a "Keyword argument has no value" instead of the horrible "odd argument list length". Also adapts to the expected args format for the keyword-argument-error exception printer in all cases. Matches 1.8 optargs behavior also. * test-suite/standalone/test-scm-c-bind-keyword-arguments.c (test_missing_value): (missing_value_error_handler): Update test. * test-suite/tests/optargs.test: Add tests.
2016-07-10Add meta/build-envAndy Wingo1-1/+1
* meta/build-env.in: New file which sets up an environment that does not inherit GUILE_LOAD_PATH / GUILE_LOAD_COMPILED_PATH (unless cross-compiling). * doc/ref/Makefile.am (autoconf-macros.texi): * libguile/Makefile.am (snarf2checkedtexi): * module/Makefile.am (ice-9/psyntax-pp.go): * test-suite/standalone/Makefile.am (GUILE_INSTALL_LOCALE): * am/bootstrap.am (.scm.go): * am/guilec (.scm.go): Use build-env. * configure.ac: Create build-env.
2016-06-24On Darwin, skip tests that depend on setrlimitDaniel Llorens2-0/+13
On Darwin, setrlimit is ignored, and these tests do not terminate. There doesn't seem to be another way to limit the memory allocated by a process. * test-suite/standalone/test-stack-overflow: Skip this test on Darwin. * test-suite/standalone/test-out-of-memory: Skip this test on Darwin.
2016-06-23Fix race between SMOB marking and finalizationAndy Wingo2-0/+71
* libguile/smob.c (clear_smobnum): New helper. (finalize_smob): Re-set the smobnum to the "finalized smob" type before finalizing. Fixes #19883. (scm_smob_prehistory): Pre-register a "finalized smob" type, which has no mark procedure. * test-suite/standalone/test-smob-mark-race.c: New file. * test-suite/standalone/Makefile.am: Arrange to build and run the new test.
2016-05-22tests: Make 'test-guild-compile' more reliable.Ludovic Courtès1-0/+5
Before that it would occasionally fail because the "$target" (not the intermediate temporary file) would be produced. * test-suite/standalone/test-guild-compile: Call 'pause' before 'sleep' in test program.
2016-05-13Use heap-allocated port types instead of ptobnumsAndy Wingo1-2/+2
This removes a limitation on the number of port types, simplifies the API, and removes a central point of coordination. * libguile/ports-internal.h (struct scm_t_port_type): Rename from scm_t_ptob_descriptor, now that it's private. Add GOOPS class fields. (struct scm_t_port): Rename from struct scm_port, especially considering that deprecated.h redefines scm_port using the preprocessor :(. * libguile/ports.h: Add definitions of SCM_PORT and SCM_PORT_TYPE, though the scm_t_port and scm_t_port_type types are incomplete. (SCM_TC2PTOBNUM, SCM_PTOBNUM, SCM_PTOBNAME): Remove, as there are no more typecodes for port types. (scm_c_num_port_types, scm_c_port_type_ref, scm_c_port_type_add_x): Remove. (scm_make_port_type): Return a scm_t_port_type*. All methods adapted to take a scm_t_port_type* instead of a ptobnum. (scm_c_make_port_with_encoding, scm_c_make_port): Take a port type pointer instead of a tag. (scm_new_port_table_entry): Remove; not useful. * libguile/ports.c: Remove things related to the port kind table. Adapt uses of SCM_PORT_DESCRIPTOR / scm_t_ptob_descriptor to use SCM_PORT_TYPE and scm_t_port_type. * libguile/deprecated.c: * libguile/deprecated.h: * libguile/filesys.c: * libguile/fports.c: * libguile/fports.h: * libguile/print.c: * libguile/r6rs-ports.c: * libguile/strports.c: * libguile/strports.h: * libguile/tags.h: * libguile/vports.c: * test-suite/standalone/test-scm-c-read.c: Adapt to change. * libguile/goops.c (scm_class_of, make_port_classes) (scm_make_port_classes, create_port_classes): Adapt to store the classes in the ptob.
2016-04-11Port read/write functions take bytevectorsAndy Wingo1-5/+7
This will allow better Scheme integration for ports. * libguile/ports.h (scm_t_port_buffer): Change "holder" member to be a bytevector defined to have "buf" as its starting point. (scm_t_ptob_descriptor): Change read and write functions to take bytevectors as arguments and to return the number of octets read or written. (scm_make_port_type): Adapt accordingly. (scm_c_read_bytes, scm_c_write_bytes): New functions that take bytevectors. * libguile/ports.c (scm_make_port_type): Adapt to read/write function prototype change. (scm_c_make_port_buffer): Arrange to populate the "bytevector" field. (scm_i_read_bytes_unlocked): New function. (scm_i_read_unlocked): Use scm_i_read_bytes_unlocked. (scm_c_read_bytes_unlocked): New function. (scm_c_read_unlocked): Update comment, and always go through the buffer. (scm_c_read_bytes): New function. (scm_flush_unlocked): Use scm_i_write_unlocked instead of the port's write function. (scm_i_write_bytes_unlocked): New function. (scm_i_write_unlocked): Use scm_i_write_bytes_unlocked. (scm_c_write_bytes_unlocked): New function. (scm_c_write_unlocked): Always write through the buffer. (scm_c_write_bytes): New function. (scm_truncate_file): Remove unused variable. (void_port_read, void_port_write): Adapt to read/write prototype change. * libguile/fports.c (fport_read, fport_write): * libguile/r6rs-ports.c (bytevector_input_port_read) (custom_binary_input_port_read, bytevector_output_port_write) (custom_binary_output_port_write, transcoded_port_write) (transcoded_port_read): Adapt to read/write prototype change. (scm_get_bytevector_n, scm_get_bytevector_n_x) (scm_get_bytevector_all): Use scm_c_read_bytes. (scm_put_bytevector): Use scm_c_write_bytes. * libguile/strports.c (string_port_read, string_port_write): * libguile/vports.c (soft_port_write, soft_port_read): Adapt to read/write prototype change. * test-suite/standalone/test-scm-c-read.c (custom_port_read): Fix for read API change.
2016-04-06Generic port facility provides buffering uniformlyAndy Wingo1-36/+23
* libguile/ports.h (struct scm_t_port_buffer): New data type. (struct scm_t_port): Refactor to use port buffers instead of implementation-managed read and write pointers. Add "read_buffering" member. (SCM_INITIAL_PUTBACK_BUF_SIZE, SCM_READ_BUFFER_EMPTY_P): Remove. (scm_t_ptob_descriptor): Rename "fill_input" function to "read", and take a port buffer, returning void. Likewise "write" takes a port buffer and returns void. Remove "end_input"; instead if there is buffered input and rw_random is true, then there must be a seek function, so just seek back if needed. Remove "flush"; instead all calls to the "write" function implicitly include a "flush", since the buffering happens in the generic port code now. Remove "setvbuf", but add "get_natural_buffer_sizes"; instead the generic port code can buffer any port. (scm_make_port_type): Adapt to read and write prototype changes. (scm_set_port_flush, scm_set_port_end_input, scm_set_port_setvbuf): Remove. (scm_slow_get_byte_or_eof_unlocked) (scm_slow_get_peek_or_eof_unlocked): Remove; the slow path is to call scm_fill_input. (scm_set_port_get_natural_buffer_sizes): New function. (scm_c_make_port_buffer): New internal function. (scm_port_non_buffer): Remove. This was a function for implementations that is no longer needed. Instead open with BUF0 or use (setvbuf port 'none). (scm_fill_input, scm_fill_input_unlocked): Return the filled port buffer. (scm_get_byte_or_eof_unlocked, scm_peek_byte_or_eof_unlocked): Adapt to changes in buffering and EOF management. * libguile/ports.c: Adapt to port interface changes. (initialize_port_buffers): New function, using the port mode flags to set up appropriate initial buffering for all ports. (scm_c_make_port_with_encoding): Create port buffers here instead of delegating to implementations. (scm_close_port): Flush the port if needed instead of delegating to the implementation. * libguile/filesys.c (set_element): Adapt to buffering changes. * libguile/fports.c (fport_get_natural_buffer_sizes): New function, replacing scm_fport_buffer_add. (fport_write, fport_read): Update to let the generic ports code do the buffering. (fport_flush, fport_end_input): Remove. (fport_close): Don't flush in a dynwind; that's the core ports' job. (scm_make_fptob): Adapt. * libguile/ioext.c (scm_redirect_port): Adapt to buffering changes. * libguile/poll.c (scm_primitive_poll): Adapt to buffering changes. * libguile/ports-internal.h (struct scm_port_internal): Remove pending_eof flag; this is now set on the read buffer. * libguile/r6rs-ports.c (struct bytevector_input_port): New type. The new buffering arrangement means that there's now an intermediate buffer between the bytevector and the user of the port; this could lead to a perf degradation, but on the other hand there are some other speedups enabled by the buffering refactor, so probably the memcpy cost is dwarfed by the cost of the other parts of the ports machinery. (make_bytevector_input_port, bytevector_input_port_read): (bytevector_input_port_seek, initialize_bytevector_input_ports): Adapt to new buffering arrangement. (struct custom_binary_port): Remove read buffer, as Guile handles that now. (custom_binary_input_port_setvbuf): Remove; now handled by Guile. (make_custom_binary_input_port, custom_binary_input_port_read) (initialize_custom_binary_input_ports): Adapt. (scm_get_bytevector_some): Adapt to new EOF management. (scm_t_bytevector_output_port_buffer): Hold on to the underlying port, so we can flush it if it's open. (make_bytevector_output_port, bytevector_output_port_write): (bytevector_output_port_seek): Adapt. (bytevector_output_port_procedure): Flush the port as appropriate, so that we get all the bytes. (make_custom_binary_output_port, custom_binary_output_port_write): Adapt. (make_transcoded_port): Don't muck with buffering. (transcoded_port_write): Simply forward the write to the underlying port. (transcoded_port_read): Likewise. (transcoded_port_close): No need to flush. (initialize_transcoded_ports): Adapt. * libguile/read.c (scm_i_scan_for_encoding): Adapt to buffering changes. * libguile/rw.c (scm_write_string_partial): Adapt to buffering changes. * libguile/strports.c: Adapt to the fact that we don't manage the buffer. Probably room for speed improvements here... * libguile/vports.c (soft_port_get_natural_buffer_sizes): New function. Adapt the rest of the file for the new buffering regime. * test-suite/tests/r6rs-ports.test ("8.2.10 Output ports"): Custom binary output ports need to be flushed before you can rely on the write! procedure having been called. Add necessary flush-port invocations. ("8.2.6 Input and output ports"): Transcoded ports now have an internal buffer by default. This test checks that the characters are transcoded one at a time, so to do that, call setvbuf on the transcoded port to remove the buffer. * test-suite/tests/web-client.test (run-with-http-transcript): Fix for different flushing regime on soft ports. (The vestigial flush procedure is now called after each write, which is not what the test was expecting.) * test-suite/standalone/test-scm-c-read.c: Update for changes to the C interface for defining port types. * doc/ref/api-io.texi (Ports): Update to discuss buffering in a generic way, and to remove a hand-wavey paragraph describing string ports as "interesting and powerful". (Reading, Writing): Remove placeholder comments. Document `scm_lfwrite'. (Buffering): New section. (File Ports): Link to buffering. (I/O Extensions): Join subnodes into parent and describe new API, including buffering API. * doc/ref/posix.texi (Ports and File Descriptors): Link to buffering. Remove unread-char etc, as they are documented elsewhere. (Pipes, Network Sockets and Communication): Link to buffering.
2014-09-30Merge branch 'stable-2.0'Mark H Weaver2-1/+47
Conflicts: benchmark-suite/benchmarks/ports.bm libguile/async.h libguile/bytevectors.c libguile/foreign.c libguile/gsubr.c libguile/srfi-1.c libguile/vm-engine.h libguile/vm-i-scheme.c module/Makefile.am module/language/tree-il/analyze.scm module/language/tree-il/peval.scm module/scripts/compile.scm module/scripts/disassemble.scm test-suite/tests/asm-to-bytecode.test test-suite/tests/peval.test test-suite/tests/rdelim.test
2014-09-17tests: Link test against Gnulib.Ludovic Courtès1-1/+2
Reported by Eli Zaretskii <eliz@gnu.org>. * test-suite/standalone/Makefile.am (test_scm_take_locale_symbol_LDADD): Add libgnu.la, for the 'strdup' replacement.
2014-06-04test-guild-compile: Increase sleep time before sending SIGINT.Mark H Weaver1-1/+1
* test-suite/standalone/test-guild-compile: Increase sleep time before sending SIGINT, for slow machines.
2014-06-03'guild compile' doesn't leave temporary files behind it.Ludovic Courtès2-0/+45
* module/scripts/compile.scm (compile): Add 'sigaction' call. * test-suite/standalone/test-guild-compile: New file. * test-suite/standalone/Makefile.am (check_SCRIPTS, TESTS): Add it.
2014-04-28Merge remote-tracking branch 'origin/stable-2.0'Andy Wingo3-0/+245
Conflicts: .gitignore doc/example-smob/Makefile doc/ref/api-smobs.texi doc/ref/libguile-concepts.texi doc/ref/libguile-smobs.texi libguile.h libguile/finalizers.c libguile/finalizers.h libguile/goops.c module/language/tree-il/compile-glil.scm module/oop/goops.scm
2014-04-28Add more foreign object interfacesAndy Wingo1-5/+4
* libguile/foreign-object.c: * libguile/foreign-object.h (scm_make_foreign_object_1) (scm_make_foreign_object_2, scm_make_foreign_object_3) (scm_make_foreign_object_n): Change to take void * arguments, and to add a comment to the header indicating that these are convenience constructors. * libguile/foreign-object.c: * libguile/foreign-object.h (scm_foreign_object_unsigned_ref) (scm_foreign_object_unsigned_set_x): New functions, equivalent to the old scm_foreign_object_ref and scm_foreign_object_set_x. * libguile/foreign-object.c: * libguile/foreign-object.h (scm_foreign_object_signed_ref) (scm_foreign_object_signed_set_x): New functions taking scm_t_signed_bits. * libguile/foreign-object.c: * libguile/foreign-object.h (scm_foreign_object_ref) (scm_foreign_object_set_x): New functions that take void*.
2014-04-28New foreign object facility, to replace SMOBsAndy Wingo3-0/+246
* libguile/foreign-object.c: * libguile/foreign-object.h: * module/system/foreign-object.scm: * test-suite/standalone/test-foreign-object-c.c: * test-suite/standalone/test-foreign-object-scm: New files. * test-suite/standalone/Makefile.am: * module/Makefile.am: * libguile/Makefile.am: Add new files. * libguile.h: Add foreign-object.h. * libguile/init.c (scm_i_init_guile): Call scm_register_foreign_object.
2014-04-25Merge branch 'stable-2.0'v2.1.0Mark H Weaver9-8/+119
Conflicts: GUILE-VERSION NEWS guile-readline/ice-9/readline.scm libguile/async.c libguile/backtrace.c libguile/deprecated.h libguile/gc-malloc.c libguile/gdbint.c libguile/init.c libguile/ioext.c libguile/mallocs.c libguile/print.c libguile/rw.c libguile/scmsigs.c libguile/script.c libguile/simpos.c libguile/snarf.h libguile/strports.c libguile/threads.c libguile/vm-i-scheme.c libguile/vm-i-system.c module/srfi/srfi-18.scm test-suite/Makefile.am test-suite/standalone/test-num2integral.c
2014-04-08Compile some standalone tests to bytecodeAndy Wingo2-0/+2
* test-suite/standalone/test-out-of-memory: * test-suite/standalone/test-stack-overflow: Compile these files before running them. That way, recursion can check the stack-overflow mechanism instead of the memory allocation mechanism. We compile beforehand as a prepass so as not to impose an rlimit on a Guile that previously ran auto-compilation.
2014-03-26Adapt test-out-of-memory to work on 32-bit systemsAndy Wingo1-4/+6
* test-suite/standalone/test-out-of-memory (*limit*): Reduce limit to 50 MB. Adapt vector test to avoid exceeding maximum vector size on 32-bit systems.
2014-03-22Out-of-memory situations raise exceptions instead of abortingAndy Wingo2-0/+63
* libguile/gc.c (scm_oom_fn, scm_init_gc): Install an out-of-memory handler that raises an unwind-only out-of-memory exception. (scm_gc_warn_proc, scm_init_gc): Install a warning proc that tries to print to the current warning port, if the current warning port is a file port. (scm_gc_after_nonlocal_exit): New interface. Should be called after a nonlocal return to potentially collect memory; otherwise allocations could try to expand again when they should collect. * libguile/continuations.c (scm_i_make_continuation): * libguile/eval.c (eval): * libguile/throw.c (catch): * libguile/vm.c (scm_call_n): Call scm_gc_after_nonlocal_exit after nonlocal returns. * libguile/throw.c (abort_to_prompt, throw_without_pre_unwind): Rework to avoid allocating memory. (scm_report_out_of_memory): New interface. (scm_init_throw): Pre-allocate the arguments for stack-overflow and out-of-memory errors. * module/ice-9/boot-9.scm: Add an out-of-memory exception printer. * module/system/repl/error-handling.scm (call-with-error-handling): Add out-of-memory to the report-keys set. * libguile/gc-malloc.c (scm_realloc): Call scm_report_out_of_memory if realloc fails. * libguile/error.h: * libguile/error.c: * libguile/deprecated.h: * libguile/deprecated.c (scm_memory_error): Deprecate. * test-suite/standalone/Makefile.am: * test-suite/standalone/test-out-of-memory: New test case.
2014-03-20tests: Add #undef NDEBUG when using <assert.h>.Ludovic Courtès8-7/+24
* test-suite/standalone/test-loose-ends.c, test-suite/standalone/test-num2integral.c, test-suite/standalone/test-round.c, test-suite/standalone/test-scm-c-bind-keyword-arguments.c, test-suite/standalone/test-scm-c-read.c, test-suite/standalone/test-scm-values.c, test-suite/standalone/test-smob-mark.c, test-suite/standalone/test-srfi-4.c: Add #undef NDEBUG.
2014-03-19Fix breakage of SRFI-4 C accessorsAndy Wingo2-0/+94
* libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): Fix bad assumption that width was a byte width. Thanks very much to Barry Fishman for the report, and to Daniel Llorens for tracking it down. * test-suite/standalone/Makefile.am (test_srfi_4_CFLAGS): * test-suite/standalone/test-srfi-4.c: Add test.
2014-03-16build: Link 'test-unwind.c' against libgnu.la.Ludovic Courtès1-2/+2
* test-suite/standalone/Makefile.am (test_unwind_LDADD): Add libgnu.la, which provides 'rpl_mkstemp' on systems missing 'mkstemp'.