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

1263 commits

Author SHA1 Message Date
Andy Wingo
9c5d7fa671 paper over some "lexical vars are collectable" flakiness
* test-suite/tests/gc.test ("gc"): Hack around flakiness in "lexical
  vars are collectable" on some architectures.
2012-01-29 22:45:56 +01:00
Andy Wingo
d062a8c1ee Implement local-eval', local-compile', and `the-environment'
* module/ice-9/local-eval.scm: New module (ice-9 local-eval) which
  exports `the-environment', `local-eval', and `local-compile'.

* libguile/debug.c (scm_local_eval): New C function that calls the
  Scheme implementation of `local-eval' in (ice-9 local-eval).

* libguile/debug.h (scm_local_eval): Add prototype.

* doc/ref/api-evaluation.texi (Local Evaluation): Add documentation.

* test-suite/tests/eval.test (local evaluation): Add tests.

* test-suite/standalone/test-loose-ends.c (test_scm_local_eval):
  Add test.

* module/Makefile.am: Add ice-9/local-eval.scm.

Based on a patch by Mark H Weaver <mhw@netris.org>.
2012-01-26 12:08:58 +01:00
Ludovic Courtès
60273407f9 Add warnings for unsupported `simple-format' options.
* module/language/tree-il/analyze.scm
  (format-analysis)[check-simple-format-args]: New procedure.  Use it.
  Add support for applications of <module-ref>.

* module/system/base/message.scm (%warning-types): Handle the `format
  simple-format' warning.

* module/language/scheme/spec.scm (scheme)[make-default-environment]:
  Use `simple-format' as the default `format'.

* test-suite/tests/tree-il.test ("warnings")["format"]: Explicitly use
  (@ (ice-9 format) format) where needed.
  ("simple-format"): New test prefix.
2012-01-26 00:35:46 +01:00
Andy Wingo
a2b62b48ab fix "lexical vars are collectable" test
* test-suite/tests/gc.test ("gc"): Fix "lexical vars are collectable"
  test.  (Previously, the binding was getting inlined, so we weren't
  testing what we meant to test.  Besides that, the value was a
  constant, not a closure, so it wasn't collectable in the first place!)
2012-01-25 19:03:50 +01:00
Andy Wingo
c3d5344a92 fix values miscompilation in push context with RA
* module/language/tree-il/compile-glil.scm (flatten-lambda-case): Fix
  miscompilation of `values' in a push context with RA.
* test-suite/tests/tree-il.test: Add low-level test for this
  miscompilation.
2012-01-25 10:37:25 +01:00
Ludovic Courtès
5765c5a82c FFI: Fix `set-pointer-finalizer!' to leave the type cell unchanged.
This is a followup to 690a0112e5 ("Remove
the "has finalizer?" bit from pointer objects.")

* libguile/foreign.c (scm_set_pointer_finalizer_x): Leave the type cell
  unchanged.  Before, `equal?' would break on pointers on which
  `set-pointer-finalizer!' had been called.

* test-suite/tests/foreign.test ("make-pointer")["equal? modulo
  finalizer (set-pointer-finalizer!)"]: New test.
2012-01-23 23:51:33 +01:00
Ludovic Courtès
73c080f9c0 Adjust tests that relied on the output of the hash table printer.
* libguile/hashtab.c (scm_i_hashtable_print): Use `SCM_UNPACK', not
  `SCM2PTR'.

* test-suite/tests/hash.test: Adjust tests that rely on the output of
  the printer to just check for the suffix of the hash table's external
  representation.
2012-01-23 00:44:29 +01:00
Ludovic Courtès
17cc6e40a9 Relax `asm-to-bytecode.test' for when target CPU == native CPU.
* test-suite/tests/asm-to-bytecode.test (native-cpu, native-word-size):
  New procedures.
  (test-target): When the target is the native CPU, use the native word
  size instead of WORD-SIZE.
2012-01-22 23:23:44 +01:00
Ludovic Courtès
d143fac660 Skip `tr_TR' tests on Solaris 2.10.
* test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved):
  Special-case Solaris 2.10.
2012-01-16 21:09:21 +01:00
Ludovic Courtès
6f0e534fcf Have `statprof.test' fail gracefully when samples could not be collected.
* test-suite/tests/statprof.test ("statistical sample counts within
  expected range"): Throw unresolved when one of A-DATA, B-DATA, and
  C-DATA is #f, which means samples were not collected for this one.
2012-01-14 23:02:03 +01:00
Ludovic Courtès
ea3cef045a Disable statprof tests on platforms that lack `ITIMER_PROF' support.
* test-suite/tests/statprof.test (when-implemented): New macro.
  ("statistical sample counts within expected range", "accurate call
  counting"): Use it.
2012-01-12 00:38:56 +01:00
Andy Wingo
91ee7515da Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/__scm.h
	libguile/array-map.c
	libguile/procprop.c
	libguile/tags.h
	module/ice-9/deprecated.scm
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
	test-suite/standalone/test-num2integral.c
	test-suite/tests/regexp.test
2012-01-10 00:41:42 +01:00
Andy Wingo
0bdd43515e Merge commit 'f78a1ccede' 2012-01-10 00:23:49 +01:00
Andy Wingo
bbc2364a3e Merge commit 'cc8afa2b36'
Conflicts:
	module/ice-9/psyntax-pp.scm
	module/language/tree-il/peval.scm
2012-01-10 00:21:48 +01:00
Ludovic Courtès
211e71a184 Make sure `regexp-quote' tests use Unicode-capable string ports.
* test-suite/tests/regexp.test (with-unicode): New macro.
  ("regexp-quote"): Wrap all `regexp-quote' calls in it.  This fixes
  tests on machines where the default port encoding is US-ASCII.
2012-01-09 23:16:20 +01:00
Ludovic Courtès
17cdda2181 i18n: Disable Turkish locale tests on FreeBSD 8.
* test-suite/tests/i18n.test (under-turkish-utf8-locale-or-unresolved):
  Check %HOST-TYPE and throw `unresolved' on FreeBSD 8.
2012-01-09 21:23:46 +01:00
Andy Wingo
017eb4a6be primitive-load returns the value(s) of the last expression
* libguile/load.c (scm_primitive_load): Return the values yielded from
  evaluating the last expression in the file.

* test-suite/tests/load.test ("return value of `load'"): Add tests.
2012-01-09 16:15:00 +01:00
Ludovic Courtès
be96155b50 ftw: Add an error' parameter to file-system-fold'.
* module/ice-9/ftw.scm (errno-if-exception): New macro.
  (file-system-fold): Add an `error' parameter.  Wrap `opendir' and STAT
  calls in `errno-if-exception' and call ERROR when appropriate.
  (file-system-tree): Provide an `error' procedure.  Return #f when
  FILE-NAME is unreadable.
  (scandir): Provide an `error' procedure.

* test-suite/tests/ftw.test (%top-builddir): New variable.
  (make-file-tree, delete-file-tree): New procedures.
  (with-file-tree): New macro.
  ("file-system-fold"): Update tests to add an `error' procedure.
  ["ENOENT", "EACCES", "dangling symlink and lstat", "dangling symlink
  and stat"]: New tests.
  ("file-system-tree")["ENOENT"]: New test.
  ("scandir")["EACCES"]: New test.

* doc/ref/misc-modules.texi (File Tree Walk): Update `file-system-fold'
  documentation.
2012-01-08 16:16:21 +01:00
Ludovic Courtès
9133716faa Fix the exception type of the (begin) test.
* test-suite/tests/syntax.test (exception:zero-expression-sequence): New
  variable.
  ("begin")["legal (begin)"]: Rename to "valid (begin)".
  ["illegal (begin)"]: Ditto.  Expect `exception:zero-expression-sequence'.
2012-01-05 23:49:01 +01:00
Ludovic Courtès
b3da54d181 Placate a number of `syntax-check' verifications.
- "filesystem" -> "file system"
  - remove doubled words
  - use EXIT_* macros instead of literal numbers
  - update `syntax-check' exclusion files
2012-01-05 23:38:10 +01:00
Ludovic Courtès
fe2400c993 Fix erroneous check in `set-procedure-properties!'.
* libguile/procprop.c
  (scm_set_procedure_properties_x)[SCM_ENABLE_DEPRECATED == 1]: Pass arguments
  to `scm_assq' in the right order, and check its return value with
  `scm_is_true'.  Reported by Mike Gran <spk121@yahoo.com>.
2012-01-05 22:52:36 +01:00
Ludovic Courtès
f78a1ccede Raise an error for (begin) when `--disable-deprecated'.
* module/ice-9/psyntax.scm (define-expansion-constructors)[begin-form]:
  Emit a syntax-violation error for empty sequences when
  --disable-deprecated.

* test-suite/tests/syntax.test (pass-if-syntax-error): Fix typo in error
  message.
2012-01-05 22:38:06 +01:00
Mike Gran
34a1045f7d Rework c-api.test to use test lib
The failure path for the c-api.test had been to call the undefined function
'fail', instead of logging the error like the other tests.

* test-suite/tests/c-api.test: modified
2012-01-04 08:02:05 -08:00
Daniel Llorens
848431b6b2 New array-map! and array-for-each tests
* ramap.test: New tests.
  - array-map! with noncompact arrays and more than one argument.
  - array-for-each with noncompact arrays and more than two arguments.
2011-12-22 17:13:07 -05:00
Andy Wingo
2b414e247f fix generalized-vector-{ref,set!} for slices
* libguile/generalized-vectors.c (scm_c_generalized_vector_ref):
  (scm_c_generalized_vector_set_x): Fix for the case in which base was
  not 1, lbnd was not 0, or inc was not 1.

* test-suite/tests/arrays.test (array): Add a test.  Thanks to Daniel
  Llorens for the report.
2011-12-22 17:03:04 -05:00
Andy Wingo
61fe8eafc2 HTTP: Fix qstring writing of cache-extension values
* module/web/http.scm ("Cache-Control"): Write string values using the
  default val writer, to get quoting correct.

* test-suite/tests/web-http.test (pass-if-round-trip): New helper.
  ("general headers"): Check that cache-extensions round trip properly.
2011-12-22 08:18:05 -05:00
Daniel Hartwig
321770b2a3 Extend handling of "Cache-Control" header.
* module/web/http.scm ("Cache-Control"): Value for `max-stale' is
  optional.  Strict validation for value-less directives (`no-store',
  etc.).  String values optional for "cache-extension" directives.
* test-suite/tests/web-http.test: Value for `max-stale' is optional.
2011-12-22 08:00:57 -05:00
Andy Wingo
cc8afa2b36 peval fix: (cons 1 #nil) is not (list 1)
* module/language/tree-il/peval.scm (peval): (cons FOO #nil) is not
  (cons FOO '()).

* test-suite/tests/tree-il.test ("partial evaluation"): Add a test.
2011-12-21 22:04:18 -05:00
Andy Wingo
dc65d1cf5b document invalidity of (begin) as expression; add back-compat shim
* doc/ref/api-control.texi (begin): Update to distinguish between
  splicing begin and sequencing begin.

* module/ice-9/psyntax.scm (expand-expr): Add a back-compatibility shim
  for `(begin)'.
* module/ice-9/psyntax-pp.scm: Regenerate.

* test-suite/tests/syntax.test: Update to run illegal (begin) test only
  if we are not including deprecated features.
2011-12-21 20:14:59 -05:00
Ludovic Courtès
a2c66014cf ftw: Include sub-directories in the result of `scandir'.
* module/ice-9/ftw.scm (scandir)[skip]: Keep NAME in the resulting list.

* test-suite/tests/ftw.test ("scandir")["top-srcdir"]: New test.
2011-12-19 22:25:30 +01:00
Andy Wingo
296004b3ba Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/feature.c
	m4/gnulib-cache.m4
	module/ice-9/deprecated.scm
	module/language/tree-il/peval.scm
2011-12-19 18:00:28 +01:00
Ludovic Courtès
de92987002 ftw: Clarify the behavior of `scandir' for flat files and unreadable dirs.
* module/ice-9/ftw.scm (scandir)[leaf]: Only add NAME when RESULT is a
  pair.
  [down]: Ignore RESULT.
  Start with #f instead of the empty list.

* test-suite/tests/ftw.test ("scandir")["flat file"]: New test.

* doc/ref/misc-modules.texi (File Tree Walk): Update `scandir'
  documentation accordingly.
2011-12-19 09:11:51 +01:00
Ludovic Courtès
1629429d63 ftw: Add `scandir'.
Suggested by Nala Ginrut <nalaginrut@gmail.com>.

* module/ice-9/ftw.scm (scandir): New procedure.
* test-suite/tests/ftw.test ("scandir"): New test prefix.
* doc/ref/misc-modules.texi (File Tree Walk): Document `scandir'.
2011-12-18 21:18:38 +01:00
Ludovic Courtès
243db01e51 Add file-system-fold' and file-system-tree' to (ice-9 ftw).
* module/ice-9/ftw.scm (file-system-fold, file-system-tree): New
  procedures.

* test-suite/tests/ftw.test (%top-srcdir, %test-dir): New variables.
  ("file-system-fold", "file-system-tree"): New test prefixes.

* doc/ref/misc-modules.texi (File Tree Walk): Document
  `file-system-tree' and `file-system-fold'.
2011-12-13 23:56:19 +01:00
Andy Wingo
bfe35b90ff Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	configure.ac
2011-12-13 10:20:44 +01:00
Andy Wingo
9670f238d4 current-input-port et al are srfi-39 parameters
* libguile/ports.c (scm_init_ports): Export the port fluids to Scheme,
  temporarily.

* module/ice-9/boot-9.scm (fluid->parameter): Turn `current-input-port'
  et al into srfi-39 parameters, backed by the exported fluids, then
  remove the fluids from the guile module.
  (%cond-expand-features): Add srfi-39.

* module/srfi/srfi-39.scm: Re-export features from boot-9.

* test-suite/tests/parameters.test: Add tests.
2011-12-10 21:37:19 +01:00
Ludovic Courtès
bcec8858a8 peval: Truncate multiple values when extending the environment.
Reported by Cédric Cellier <rixed@happyleptic.org>.

* module/language/tree-il/peval.scm (truncate-values): New procedure.
  (make-operand): Call `truncate-values' SOURCE.

* test-suite/tests/tree-il.test ("partial evaluation"): New tests for
  multiple value truncation.
2011-12-06 21:36:49 +01:00
Andy Wingo
04ec290f8b Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/deprecation.c
	libguile/load.c
	libguile/print.c
2011-12-06 19:14:50 +01:00
Andy Wingo
c9caa6c88d fix asm-to-bytecode.test
* test-suite/tests/asm-to-bytecode.test (%objcode-cookie-size)
  (test-target): The objcode version embedded in the cookie is not an
  effective version, so elide it from the test.
2011-12-06 18:09:02 +01:00
Andy Wingo
679eea4f0e allow URIs of the form file:///etc/hosts
* module/web/uri.scm (parse-authority): Allow empty authorities, so that
  we accept URIs of the form, file:///etc/hosts.
* test-suite/tests/web-uri.test ("string->uri"): Add tests.
2011-12-06 11:47:41 +01:00
Andy Wingo
90de5c4c2e add srfi-39 parameters to boot-9
* module/ice-9/boot-9.scm (<parameter>, make-parameter, parameter?)
  (parameter-fluid, parameter-converter, parameterize): New top-level
  bindings, implementing SRFI-39 parameters.  Currently,
  current-input-port and similar procedures are not yet parameters.

* test-suite/Makefile.am:
* test-suite/tests/parameters.test: Add tests, taken from srfi-39
  tests.
2011-12-05 14:25:25 +01:00
Andy Wingo
b2208d2e98 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	configure.ac
	libguile/fluids.c
	libguile/gc.c
	libguile/gc.h
	libguile/objcodes.c
	libguile/procprop.c
	libguile/vm.c
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
2011-12-01 23:31:50 +01:00
Ludovic Courtès
59a0273338 FFI: Hold a weak reference to the procedure passed to `procedure->pointer'.
* libguile/foreign.c (scm_procedure_to_pointer): Keep a weak reference
  to PROC.

* test-suite/tests/foreign.test ("procedure->pointer")["procedure is
  retained"]: New test.
2011-11-26 22:27:32 +01:00
Daniel Hartwig
4855c63441 web-http.test validates headers
* test-suite/tests/web-http.test (pass-if-parse): Validate header values
  as well.
2011-11-23 23:35:20 +01:00
Ludovic Courtès
de2c0a10fe Complete cross-compilation support.
* module/system/base/target.scm (%target-endianness, %target-word-size):
  New fluids.
  (%native-word-size): New variable.
  (with-target): Set these fluids.
  (cpu-endianness, cpu-word-size, triplet-cpu, triplet-vendor,
  triplet-os): New procedures.
  (target-cpu, target-vendor, target-os): Use them.
  (target-endianness, target-word-size): Refer to the corresponding
  fluid.

* libguile/objcodes.c (target_endianness_var, target_word_size_var): New
  global variables.
  (NATIVE_ENDIANNESS): New macro.
  (target_endianness, target_word_size, to_native_order): New functions.
  (make_objcode_from_file): Use `scm_bytecode_to_native_objcode' instead
  of `scm_bytecode_to_objcode'.
  (bytecode_to_objcode): New function, based on `scm_bytecode_to_objcode',
  with the addition of an `endianness' and `word_size' parameters.
  (scm_bytecode_to_objcode): Use it.
  (scm_bytecode_to_native_objcode): New function.
  (scm_write_objcode): Use `target_word_size' and `target_endianness'.
  Convert OBJCODE's len and meta-len to native byte order.
  (scm_init_objcodes): Initialize `target_endianness_var' and
  `target_word_size_var'.

* libguile/objcodes.h (scm_bytecode_to_native_objcode): New declaration.

* libguile/vm.c (really_make_boot_program): Use
  `scm_bytecode_to_native_objcode' instead of `scm_bytecode_to_objcode'.

* test-suite/tests/asm-to-bytecode.test (%objcode-cookie-size): New
  variable.
  (test-target): New procedure.
  ("cross-compilation"): Add `test-target' calls and the "unknown
  target" test.
2011-11-22 00:22:46 +01:00
Ludovic Courtès
e0a9f02224 Fix `validate-target' in (system base target).
* module/system/base/target.scm (validate-target): Accept any tuple with
  at least 3 parts.

* test-suite/tests/asm-to-bytecode.test (test-triplet): New procedure.
  ("cross-compilation"): New test prefix.
2011-11-22 00:22:46 +01:00
Ludovic Courtès
8071964943 Allow overlapping regions to be passed to `bytevector-copy!'.
Reported by Dmitry Chestnykh <dmitry@codingrobots.com>.
Fixes <http://debbugs.gnu.org/10070>.

* libguile/bytevectors.c (scm_bytevector_copy_x): Use `memmove', not
  `memcpy'.

* test-suite/tests/bytevectors.test ("2.2 General
  Operations")["bytevector-copy! overlapping"]: New test.

* doc/ref/api-data.texi (Bytevector Manipulation): Mention possible
  overlapping.
2011-11-20 01:10:58 +01:00
Andy Wingo
7f622b82a2 eval.test work
* test-suite/tests/eval.test ("stacks"): Enable another test, fix to use
  with-throw-handler, and remove a duplicate test, now that there is no
  difference between subrs and gsubrs.
2011-11-17 10:52:06 +01:00
Ludovic Courtès
449c4d44d0 FFI: Add a `procedure->pointer' test.
* test-suite/tests/foreign.test ("procedure->pointer")["procedures
  returning a pointer"]: New test.
2011-11-16 23:51:34 +01:00
Ludovic Courtès
936d0bf321 Re-enable a couple of evaluator tests.
These tests had been disabled as part of
b7742c6b71 ("new evaluator, y'all").

* test-suite/tests/eval.test ("define set procedure-name")["closure"]:
  Change to `pass-if' since it now works, as a result of
  ee15aa46e3 ("set names of functions
  defined at the toplevel from `eval'").
  ("stacks")["arguments of a gsubr stack frame"]: Remove (throw
  'unresolved).
2011-11-16 15:11:55 +01:00