Răsfoiți Sursa

Merge pull request #15930 from JanWielemaker/swipl-9.1.21

Updated swipl devel to 9.1.21
Tianon Gravi 1 an în urmă
părinte
comite
76136ef440
3 a modificat fișierele cu 108 adăugiri și 21 ștergeri
  1. 3 3
      library/swipl
  2. 1 1
      test/tests/run-swipl-in-container.sh
  3. 104 17
      test/tests/swipl-modules/container.pl

+ 3 - 3
library/swipl

@@ -1,11 +1,11 @@
 Maintainers: Jan Wielemaker <[email protected]> (@JanWielemaker),
              Dave Curylo <[email protected]> (@ninjarobot)
 GitRepo: https://github.com/SWI-Prolog/docker-swipl.git
-GitCommit: aed2f55c031507e8fe2a2fede471ffbb5ced5af0
+GitCommit: 1a0a739f7edf19f4282958568ac8245f4410e1b1
 Architectures: amd64, arm32v7, arm64v8
 
-Tags: latest, 9.1.19
-Directory: 9.1.19/bullseye
+Tags: latest, 9.1.21
+Directory: 9.1.21/bookworm
 
 Tags: stable, 9.0.4
 Directory: 9.0.4/bullseye

+ 1 - 1
test/tests/run-swipl-in-container.sh

@@ -4,4 +4,4 @@ set -e
 testDir="$(readlink -f "$(dirname "$BASH_SOURCE")")"
 runDir="$(dirname "$(readlink -f "$BASH_SOURCE")")"
 
-source "$runDir/run-in-container.sh" "$testDir" "$1" swipl -q -f ./container.pl -g test
+source "$runDir/run-in-container.sh" "$testDir" "$1" swipl -f none --on-error=status ./container.pl

+ 104 - 17
test/tests/swipl-modules/container.pl

@@ -1,17 +1,104 @@
-multiarch:-[library(space/space)], [library(prosqlite)], [library(r/r_call)].
-amd64arch:-[library(rocksdb)], [library(hdt)].
-
-cpu(Cpu):-current_prolog_flag(arch, Arch), split_string(Arch, "-", "", [Cpu, _]).
-
-test:-
-    (
-        cpu("x86_64")
-        -> multiarch
-        , amd64arch
-        , writeln("Loaded modules successfully.")
-        ;
-        cpu("armv8l")
-        -> multiarch
-        , writeln("Loaded modules successfully.")
-    )
-    , halt.
+% Test elementary functionality.
+
+:- initialization(test, main).
+
+:- if((current_prolog_flag(version, V), V>=90121)).
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+New version. This finds all foreign resources in the libraries and loads
+them while resolving all symbols immediately.
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+:- use_module(library(filesex)).
+:- use_module(library(lists)).
+:- use_module(library(occurs)).
+:- use_module(library(prolog_source)).
+:- use_module(library(solution_sequences)).
+
+test :-
+    forall(library_file(_File, Foreign),
+           load_foreign(Foreign)),
+    writeln("Loaded modules successfully.").
+
+load_foreign(Spec) :-
+    catch(load_foreign_(Spec), Ex,
+          print_message(error, Ex)).
+
+load_foreign_(Spec) :-
+    absolute_file_name(Spec, File,
+                       [ file_type(executable),
+                         access(read)
+                       ]),
+    open_shared_object(File, _Handle, [resolve(now)]).
+
+library_file(File, Foreign) :-
+    absolute_file_name(library(.), Dir,
+                       [ file_type(directory),
+                         solutions(all)
+                       ]),
+    directory_member(Dir, File, [ extensions([pl]) ]),
+    file_base_name(File, Base),
+    \+ skip_file(Base),
+    loads_foreign(File, Foreign).
+
+loads_foreign(File, Foreign) :-
+    (   current_prolog_flag(xref, Old)
+    ->  true
+    ;   Old = false
+    ),
+    setup_call_cleanup(
+        set_prolog_flag(xref, true),
+        limit(100, term_in_file(File, Term)),
+        set_prolog_flag(xref, Old)),
+    sub_term(Sub, Term),
+    foreign(Sub, Foreign),
+    !.
+
+foreign(use_foreign_library(Lib), Foreign) =>
+    strip_module(Lib, _, Foreign).
+foreign(use_foreign_library(Lib, _), Foreign) =>
+    strip_module(Lib, _, Foreign).
+foreign(_, _) => fail.
+
+term_in_file(File, Term) :-
+    setup_call_cleanup(
+        prolog_open_source(File, In),
+        (   repeat,
+            prolog_read_source_term(In, Read, Expanded, [])
+        ),
+        prolog_close_source(In)),
+    (   Read == end_of_file
+    ->  !
+    ;   is_list(Expanded)
+    ->  member(Term, Expanded)
+    ;   Term = Expanded
+    ).
+
+skip_file('check_installation.pl'). % refers to all foreign files
+skip_file('sty_xpce.pl').           % does not import operators, causing syntax errors
+
+:- else.
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+Old version. This checks only the extensions.   Note that we only try to
+load the extensions that are  in  the   library.  If  the package is not
+downloaded at all, this is on purpose.
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+
+lib(space/space).
+lib(prosqlite).
+lib(r/r_call).
+lib(rocksdb).
+lib(hdt).
+
+test :-
+    forall(lib(Lib), check_lib(library(Lib))),
+    writeln("Loaded modules successfully.").
+
+check_lib(Lib) :-
+    exists_source(Lib),
+    !,
+    use_module(Lib, []).
+check_lib(_).
+
+:- endif.