1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 11:10:32 +02:00
guile/test-suite
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
..
lalr remove duplicate when/unless definitions 2012-01-20 21:16:50 +01:00
standalone test-hashing: support 32-bit 2024-07-12 17:49:45 -05:00
test-suite guile-test: support automake parallel test harness via --trs-file 2024-06-20 15:35:48 +02:00
tests Improve DLL search strategy for load-foreign-library 2025-03-22 07:05:31 -07:00
ChangeLog-2008 Rename ChangeLog' files to ChangeLog-2008'. 2008-09-12 21:49:58 +02:00
driver Switch to the preferred parallel automake test harness 2024-06-20 15:35:48 +02:00
guile-test Add missing, read-only, and typical copy-file tests 2025-03-19 21:25:40 -05:00
Makefile.am Fix distcheck problems with parallel tests 2024-06-23 23:26:47 +02:00
README Revert "Note need for subscription to bug-guile@gnu.org." 2008-12-10 19:07:14 +00:00

This directory contains some tests for Guile, and some generic test
support code.

To run these tests, you will need a version of Guile more recent than
15 Feb 1999 --- the tests use the (ice-9 and-let*) and (ice-9
getopt-long) modules, which were added to Guile around then.

For information about how to run the test suite, read the usage
instructions in the comments at the top of the guile-test script.

You can reference the file `lib.scm' from your own code as the module
(test-suite lib); it also has comments at the top and before each
function explaining what's going on.

Please write more Guile tests, and send them to bug-guile@gnu.org.
We'll merge them into the distribution.  All test suites must be
licensed for our use under the GPL, but I don't think I'm going to
collect assignment papers for them.



Some test suite philosophy:

GDB has an extensive test suite --- around 6300 tests.  Every time the
test suite catches a bug, it's great.

GDB is so complicated that folks are often unable to get a solid
understanding of the code before making a change --- we just don't
have time.  You'll see people say things like, "Here's a fix for X; it
doesn't cause any regressions."  The subtext is, I made a change that
looks reasonable, and the test suite didn't complain, so it must be
okay.

I think this is terrible, because it suggests that the writer is using
the test suite as a substitute for having a rock-solid explanation of
why their changes are correct.  The problem is that any test suite is
woefully incomplete.  Diligent reasoning about code can catch corner
conditions or limitations that no test suite will ever find.



Jim's rule for test suites:

Every test suite failure should be a complete, mysterious surprise,
never a possibility you were prepared for.  Any other attitude
indicates that you're using the test suite as a crutch, which you need
only because your understanding is weak.