summaryrefslogtreecommitdiff
path: root/test-suite
AgeCommit message (Collapse)AuthorFilesLines
2016-07-11Support typed arrays in some sort functionslloda-array-supportDaniel Llorens1-5/+33
* libguile/sort.c (sort!, sort, restricted-vector-sort!, sorted?): Support arrays of rank 1, whatever the type. * libguile/quicksort.i.c: Fix accessors to handle typed arrays. * test-suite/tests/sort.test: Test also with typed arrays.
2016-07-11Fix a corner case with empty arrays in (array-for-each-cell)Daniel Llorens1-1/+13
* libguile/array-map.c (scm_array_for_each_cell): Bail out early if any of the sizes is zero. Pack ais at the end of the fake stack. * test-suite/tests/array-map.test: Add regression test.
2016-07-11Clean up (array-for-each-cell)Daniel Llorens2-3/+22
* libguile/array-map.c (array-for-each-cell, array-for-each-cell-in-order): Moved from libguile/arrays.c. Fix argument names. Complete docstring. * libguile/array-map.h (array-for-each-cell, array-for-each-cell-in-order): Declarations moved from libguile/arrays.h. * test-suite/tests/array-map.test: Renamed from test-suite/tests/ramap.test, fix module name. Add tests for (array-for-each-cell). * test-suite/Makefile.am: Apply rename array-map.test -> ramap.test. * doc/ref/api-compound.texi: Minor documentation fixes.
2016-07-11Speed up for multi-arg cases of scm_ramap functionsDaniel Llorens1-5/+5
This patch results in a 20%-40% speedup in the > 1 argument cases of the following microbenchmarks: (define A (make-shared-array #0(1) (const '()) #e1e7)) ; 1, 2, 3 arguments. (define a 0) ,time (array-for-each (lambda (b) (set! a (+ a b))) A) (define a 0) ,time (array-for-each (lambda (b c) (set! a (+ a b c))) A A) (define a 0) ,time (array-for-each (lambda (b c d) (set! a (+ a b c d))) A A A) (define A (make-shared-array (make-array 1) (const '()) #e1e7)) (define B (make-shared-array #0(1) (const '()) #e1e7)) ; 1, 2, 3 arguments. ,time (array-map! A + B) ,time (array-map! A + B B) ,time (array-map! A + B B B) * libguile/array-map.c (scm_ramap): note on cproc arguments. (rafill): assume that dst's lbnd is 0. (racp): assume that src's lbnd is 0. (ramap): assume that ra0's lbnd is 0. When there're more than two arguments, compute the array handles before the loop. Allocate the arg list once and reuse it in the loop. (rafe): like rafe, when there's more than one argument. (AREF, ASET): remove.
2016-07-11Fix compilation of rank 0 typed array literalsDaniel Llorens1-1/+7
* module/system/vm/assembler.scm (simple-uniform-vector?): array-length fails for rank 0 arrays; fix the shape condition. * test-suite/tests/arrays.test: test reading of #0f64(x) in compilation context.
2016-07-11Rename array-set-from!, scm_array_set_from_x to array-amend!, scm_array_amend_xDaniel Llorens1-8/+8
2016-07-11Tests & doc for array-from, array-from*, array-set-from!Daniel Llorens1-0/+109
* test-suite/tests/arrays.test: tests for array-from, array-from*, array-set-from! * doc/ref/api-compound.texi: document array-from, array-from*, array-set-from!.
2016-07-11Unuse array 'contiguous' flagDaniel Llorens1-0/+6
SCM_I_ARRAY_FLAG_CONTIGUOUS (arrays.h) was set by all array-creating functions (make-typed-array, transpose-array, make-shared-array) but it was only used by array-contents, which needed to traverse the dimensions anyway. * libguile/arrays.c (scm_make_typed_array, scm_from_contiguous_typed_array): don't set the contiguous flag. (scm_transpose_array, scm_make_shared_array): don't call scm_i_ra_set_contp. (scm_array_contents): inline scm_i_ra_set_contp() here. Adopt uniform type check order. Remove redundant comments. (scm_i_ra_set_contp): remove. * libguile/arrays.h: note. * test-suite/tests/arrays.test: test array-contents with rank 0 array.
2016-07-11Avoid unneeded internal use of array handlesDaniel Llorens1-13/+63
* libguile/arrays.c (scm_shared_array_root): adopt uniform check order. (scm_shared_array_offset, scm_shared_array_increments): use the array fields directly just as scm_shared_array_root does. * test-suite/tests/arrays.test: tests for shared-array-offset, shared-array-increments.
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-28tests-suite: resurrect invoking check-guile --coverage.Jan Nieuwenhuizen1-1/+1
* test-suite/guile-test (main): remove (the-vm) from with-code-coverage call.
2016-06-24Constant-folding eq? and eqv? uses deduplicationAndy Wingo1-0/+8
* test-suite/tests/peval.test ("partial evaluation"): Add tests. * module/language/tree-il/peval.scm (peval): Constant-fold eq? and eqv? using equal?, anticipating deduplication.
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-24Fix texinfo->html for @acronym, @itemizeAndy Wingo2-0/+37
* module/texinfo/html.scm (itemize, acronym, tag-replacements, rules): Fix HTML serialization of @itemize and @acronym. Fixes #21772. * test-suite/tests/texinfo.html.test: New file. * test-suite/Makefile.am: Add new file.
2016-06-23Don't serialize uninterned symbolsAndy Wingo1-0/+10
* module/system/vm/assembler.scm (intern-constant): Don't serialize uninterned symbols. * test-suite/tests/rtl.test ("bad constants"): Add a test.
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-06-23Fix relative file name canonicalization on paths with "."Andy Wingo1-7/+8
* libguile/filesys.c (scm_i_relativize_path): Canonicalize the file names elements that we will be using as prefixes. Fixes the case where a load path contains a relative file name: #19540. * test-suite/tests/ports.test ("%file-port-name-canonicalization"): Add tests that elements of the load path are canonicalized.
2016-06-21Fix (< 'foo) compilationAndy Wingo1-1/+5
* module/language/tree-il/primitives.scm (expand-chained-comparisons): Fix (< 'foo) compilation. * test-suite/tests/compiler.test ("regression tests"): Add test case.
2016-06-21Fix srfi-64.test for #:select borkage. The irony...Andy Wingo1-1/+2
* test-suite/tests/srfi-64.test: Fix for recent #:select borkage.
2016-06-21`define!' instruction returns the variableAndy Wingo1-0/+8
* doc/ref/vm.texi (Top-Level Environment Instructions): Update documentation. * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump, sadly. * module/system/vm/assembler.scm (*bytecode-minor-version*): Bump. * libguile/vm-engine.c (define!): Change to store variable in dst slot. * module/language/tree-il/compile-cps.scm (convert): * module/language/cps/compile-bytecode.scm (compile-function): Adapt to define! change. * module/language/cps/effects-analysis.scm (current-module): Fix define! effects. Incidentally here was the bug: in Guile 2.2 you can't have effects on different object kinds in one instruction, without reverting to &unknown-memory-kinds. * test-suite/tests/compiler.test ("regression tests"): Add a test.
2016-06-21Update and-let-star.testAndy Wingo1-4/+4
* test-suite/tests/and-let-star.test ("and-let*"): Update test expectations.
2016-06-21Add SRFI-2 (and-let*) test suite.Taylan Ulrich Bayırlı/Kammer2-0/+78
* test-suite/tests/srfi-2.test: New file. * test-suite/Makefile.am (SCM_TESTS): Add it.
2016-06-21Add R6RS bytevector->string, string->bytevectorAndy Wingo1-0/+134
* module/rnrs/io/ports.scm (string->bytevector): (bytevector->string): New procedures. * module/rnrs.scm: Export new procedures. * test-suite/tests/r6rs-ports.test: Add string->bytevector and bytevector->string tests.
2016-06-21Implement R6RS output-port-buffer-modeAndy Wingo1-0/+18
* module/rnrs/io/ports.scm (r6rs-open): Set buffer-mode on new port. (output-port-buffer-mode): Implement and export. * module/rnrs.scm (rnrs): Export output-port-buffer-mode * test-suite/tests/r6rs-ports.test (test-output-file-opener): Add tests.
2016-06-21(rnrs hashtables): Hash functions of eq? and eqv? hashtablesTaylan Ulrich Bayırlı/Kammer1-1/+5
Also pinging this thread with a (very slightly) updated patch. :-) [2. text/x-diff; 0001-Hashtable-hash-function-returns-f-on-eq-and-eqv-tabl.patch] From 17599f6ce7ba0beb100e80455ff99af07333d871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?= <taylanbayirli@gmail.com> Date: Tue, 21 Jun 2016 00:23:29 +0200 Subject: [PATCH] Hashtable-hash-function returns #f on eq and eqv tables. * module/rnrs/hashtables.scm (r6rs:hashtable)[type]: New field. (r6rs:hashtable-type): New procedure. * test-suite/tests/r6rs-hashtables.test: Add related tests.
2016-06-21(rnrs hashtables): Mutation of immutable hashtable ignoredTaylan Ulrich Bayırlı/Kammer1-2/+4
Pinging this thread with a (very slightly) updated patch. :-) [2. text/x-diff; 0001-Hashtable-set-errors-on-immutable-hashtable.patch] From 7f35d515d711e255bba5a89a013d9d92034edf41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?= <taylanbayirli@gmail.com> Date: Tue, 21 Jun 2016 00:25:19 +0200 Subject: [PATCH] Hashtable-set! errors on immutable hashtable. * module/rnrs/hashtables.scm (hashtable-set!): Raise an assertion violation error when the hashtable is immutable. * test-suite/tests/r6rs-hashtables.test: Fix accordingly.
2016-06-21Fix fixnum-range changes in R6RS fixnum bitopsAndy Wingo1-1/+1
* module/rnrs/arithmetic/fixnums.scm (fxcopy-bit, fxbit-field) (fxcopy-bit-field, fxarithmetic-shift) (fxarithmetic-shift-left, fx-arithmetic-shift-right) (fxrotate-bit-field, fxreverse-bit-field): Enforce range on amount by which to shift. Fixes #14917. * test-suite/tests/r6rs-arithmetic-fixnums.test ("fxarithmetic-shift-left"): Update test to not shift left by a negative amount.
2016-06-21Add another code coverage testAndy Wingo1-1/+19
* test-suite/tests/coverage.test ("line-execution-counts"): Add a test from Taylan Ulrich B, from bug #14849.
2016-06-20Fix peval on (call-with-values foo (lambda (x) x))Andy Wingo1-2/+4
* module/language/tree-il/peval.scm (peval): Don't inline (call-with-values foo (lambda (x) exp)) to (let ((x (foo))) exp). The idea is that call-with-values sets up an explicit context in which we are requesting an explicit return arity, and that dropping extra values when there's not a rest argument is the wrong thing. Fixes #13966. * test-suite/tests/peval.test ("partial evaluation"): Update test.
2016-06-20Fix size measurement in bytevector_large_setAndy Wingo1-1/+5
* libguile/bytevectors.c (bytevector_large_set): Fix computation of value size in words. * test-suite/tests/bytevectors.test: Add test. Thanks to Ben Rocer <fleabyte@mail.com> for the bug report and fix.
2016-06-20Fix uri-decode behavior for "+"Andy Wingo1-1/+4
* module/web/uri.scm (uri-decode): Add #:decode-plus-to-space? keyword argument. (split-and-decode-uri-path): Don't decode plus to space. * doc/ref/web.texi (URIs): Update documentation. * test-suite/tests/web-uri.test ("decode"): Add tests. * NEWS: Add entry. Based on a patch by Brent <brent@tomski.co.za>.
2016-06-09Update port documentation, rename sports to suspendable portsAndy Wingo2-4/+4
* module/ice-9/suspendable-ports.scm: Rename from ice-9/sports.scm, and adapt module names. Remove exports that are not related to the suspendable ports facility; we want people to continue using the port operations from their original locations. Add put-string to the replacement list. * module/Makefile.am: Adapt to rename. * test-suite/tests/suspendable-ports.test: Rename from sports.test. * test-suite/Makefile.am: Adapt to rename. * module/ice-9/textual-ports.scm (unget-char, unget-string): New functions. * doc/ref/api-io.texi (Textual I/O, Simple Output): Flesh out documentation. (Line/Delimited): Undocument write-line, read-string, and read-string!. This is handled by (ice-9 textual-ports). (Bytevector Ports): Fix duplicated section. (String Ports): Move the note about encodings down to the end. (Custom Ports): Add explanatory text. Remove mention of C functions; they should use the C port interface. (Venerable Port Interfaces): Add text, and make documentation refer to recommended interfaces. (Using Ports from C): Add documentation. (Non-Blocking I/O): Document more fully and adapt to suspendable-ports name change.
2016-05-30iprin1 uses scm_c_put_stringAndy Wingo1-1/+1
* libguile/print.c (iprin1): Use scm_c_put_string for strings. * test-suite/test-suite/lib.scm (exception:encoding-error): Add an additional expected error string for `encoding-error'.
2016-05-22get-bytevector-n in Scheme.Andy Wingo1-0/+1
* module/ice-9/sports.scm (fill-input): Add io-mode optional arg. (get-bytevector-n): New implementation. (port-bindings): Add get-bytevector-n. * test-suite/tests/sports.test: Add r6rs-ports tests.
2016-05-22More thorough ice-9 sports testingAndy Wingo1-1/+6
* module/ice-9/sports.scm: Export read-line, %read-line, and read-delimited. Add these latest three to install-sports!, and fix install-sports! if the current module isn't (ice-9 sports). * test-suite/tests/sports.test: Use install-sports! instead of lexical bindings, to allow us to nicely frob bindings in rdelim. Include rdelim tests.
2016-05-22http: Accept date strings with a leading space for hours.Ludovic Courtès1-0/+10
Fixes <http://bugs.gnu.org/23421>. Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>. * module/web/http.scm (parse-rfc-822-date): Add two clauses for hours with a leading space. * test-suite/tests/web-http.test ("general headers"): Add two tests.
2016-05-22http: Accept empty reason phrases.Ludovic Courtès1-1/+5
Fixes <http://bugs.gnu.org/22273>. Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>. * module/web/http.scm (read-header-line): New procedure. (read-response-line): Use it instead of 'read-line*'. * test-suite/tests/web-http.test ("read-response-line"): Add test.
2016-05-22http: Test that responses lacking CR/LF are rejected.Ludovic Courtès1-0/+5
* test-suite/tests/web-http.test ("read-response-line")["missing CR/LF"]: New test.
2016-05-22i18n: Add new collation test for posterity.Ludovic Courtès1-1/+18
* test-suite/tests/i18n.test ("text collation (Czech)"): New test prefix.
2016-05-22web: Gracefully handle premature EOF when reading chunk header.Ludovic Courtès1-0/+10
* module/web/http.scm (read-chunk-header): Return 0 when 'read-line' returns EOF.
2016-05-22web: Fix 'close' method of delimited input ports.Ludovic Courtès1-2/+12
* module/web/response.scm (make-delimited-input-port)[close]: Replace erroneous self-recursive call with a call to 'close-port'. * test-suite/tests/web-response.test ("example-1")["response-body-port + close"]: New test.
2016-05-22Heed the reader settings implied by #!r6rsAndreas Rottmann1-6/+39
When encountering the #!r6rs directive, apply the appropriate reader settings to the port. * libguile/read.scm (read-string-as-list): New helper procedure. (scm_read_shebang): Set reader options implied by the R6RS syntax upon encountering the #!r6rs directive. * test-suite/tests/reader.test (per-port-read-options): Add tests for the #!r6rs directive.
2016-05-22Fix atan procedure when applied to complex numbers.Mark H Weaver1-3/+4
Fixes a regression introduced in commit ad79736c68a803a59814fbfc0cb4b092c2b4cddf. * libguile/numbers.c (scm_atan): Fix the complex case. * test-suite/tests/numbers.test ("atan"): Add test.
2016-05-22Add more R6RS port encoding testsMark H Weaver1-0/+47
Originally applied to stable-2.0 as "Fix bytevector and custom binary ports to actually use ISO-8859-1 encoding.", commit d574d96f879c147c6c14df43f2e4ff9e8a6876b9. Related to http://bugs.gnu.org/20200, which was introduced in in stable-2.0 but never existed on master. Test modified by Andy Wingo to add a `force-output' where needed. * test-suite/tests/r6rs-ports.test: Add tests.
2016-05-22tests: Gracefully handle ENOSYS return for 'setaffinity'.Ludovic Courtès1-4/+14
Fixes <http://bugs.gnu.org/19646>. Reported by John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>. * test-suite/tests/posix.test ("affinity")["setaffinity"]: Wrap in 'catch' and throw 'unresolved upon ENOSYS.
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-22Implement 'string-utf8-length' and 'scm_c_string_utf8_length'.Mark H Weaver1-2/+18
* libguile/strings.c (utf8_length, scm_c_string_utf8_length) (scm_string_utf8_length): New functions. * libguile/strings.h (scm_c_string_utf8_length, scm_string_utf8_length): New prototypes. * doc/ref/api-data.texi (Bytevectors as Strings): Add docs. * doc/ref/guile.texi: Update manual copyright date to 2015. * test-suite/tests/strings.test (string-utf8-length): Add tests.
2016-05-22http: Do not buffer HTTP chunks.Ludovic Courtès1-2/+52
Fixes <http://bugs.gnu.org/19939>. * module/web/http.scm (read-chunk, read-chunk-body): Remove. (make-chunked-input-port)[next-chunk, buffer-, buffer-size, buffer-pointer]: Remove. [chunk-size, remaining]: New variables. [read!]: Rewrite to write directly to BV. * test-suite/tests/web-http.test ("chunked encoding")["reads chunks without buffering", "reads across chunk boundaries"]: New tests.
2016-05-22tests: Use 'pass-if-equal' in web-http chunked encoding tests.Ludovic Courtès1-15/+16
* test-suite/tests/web-http.test ("chunked encoding"): Use 'pass-if-equal' where appropriate.
2016-05-20Support for non-blocking I/OAndy Wingo1-14/+13
* doc/ref/api-io.texi (I/O Extensions): Document read_wait_fd / write_wait_fd members. (Non-Blocking I/O): New section. * libguile/fports.c (fport_read, fport_write): Return -1 if the operation would block. (fport_wait_fd, scm_make_fptob): Add read/write wait-fd implementation. * libguile/ports-internal.h (scm_t_port_type): Add read_wait_fd / write_wait_fd. * libguile/ports.c (default_read_wait_fd, default_write_wait_fd): New functions. (scm_make_port_type): Initialize default read/write wait fd impls. (trampoline_to_c_read, trampoline_to_scm_read) (trampoline_to_c_write, trampoline_to_scm_write): To Scheme, a return of #f indicates EWOULDBLOCk. (scm_set_port_read_wait_fd, scm_set_port_write_wait_fd): New functions. (port_read_wait_fd, port_write_wait_fd, scm_port_read_wait_fd) (scm_port_write_wait_fd, port_poll, scm_port_poll): New functions. (scm_i_read_bytes, scm_i_write_bytes): Poll if the read or write would block. * libguile/ports.h (scm_set_port_read_wait_fd) (scm_set_port_write_wait_fd): Add declarations. * module/ice-9/ports.scm: Shunt port-poll and port-{read,write}-wait-fd to the internals module. * module/ice-9/sports.scm (current-write-waiter): (current-read-waiter): Implement. * test-suite/tests/ports.test: Adapt non-blocking test to new behavior. * NEWS: Add entry.