Skip to content

Commit 9ce4881

Browse files
author
erlanger
committed
Make saved state test shlibs available for test_installation
1 parent 0c1f5a5 commit 9ce4881

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

src/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,11 @@ endif(0)
436436
add_custom_target(check
437437
COMMAND ${PROG_SWIPL} -q -g test -t halt ${CMAKE_CURRENT_SOURCE_DIR}/test.pl)
438438

439+
add_custom_target(test_save_shlibs
440+
ALL
441+
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/Tests/save &&
442+
${PROG_SWIPL} -q -g build_test_shlibs -t halt ${CMAKE_CURRENT_SOURCE_DIR}/Tests/save/test_saved_states.pl)
443+
439444
set(SWIPL_TEST_DIRS unprotected core attvar library charset eclipse clp
440445
GC save)
441446
if(MULTI_THREADED)

src/Tests/save/test_saved_states.pl

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
*/
3434

3535
:- module(test_saved_states,
36-
[ test_saved_states/0
36+
[ test_saved_states/0,
37+
build_test_shlibs/0
3738
]).
3839

3940
:- prolog_load_context(directory, Here),
@@ -197,19 +198,30 @@
197198
remove_state(State) :-
198199
catch(delete_file(State), _, true).
199200

201+
swipl_ld(SwiplLd) :-
202+
current_prolog_flag(executable,SwiplExe),
203+
file_directory_name(SwiplExe, Dir),
204+
format(atom(SwiplLd0), "~w/swipl-ld",[Dir]),
205+
prolog_to_os_filename(SwiplLd0,SwiplLd).
206+
200207
build_shlib(Name) :-
201-
format(atom(Cmd), "swipl-ld -shared -fPIC -o input/~w.so input/~w.c",[Name, Name]),
202-
shell(Cmd).
208+
swipl_ld(SwiplLd),
209+
format(atom(Cmd),
210+
"~w -shared -fPIC -o input/~w.so input/~w.c",
211+
[SwiplLd,Name, Name]),
212+
shell(Cmd).
203213

204214
build_shlib(Name, Dep, DepDir) :-
205-
format(atom(Cmd), "swipl-ld -shared -fPIC -L~w -l~w -o input/~w.so input/~w.c ",[DepDir, Dep, Name, Name]),
206-
format(user_error, '~w~n', Cmd),
207-
shell(Cmd).
215+
swipl_ld(SwiplLd),
216+
format(atom(Cmd),
217+
"~w -shared -fPIC -L~w -l~w -o input/~w.so input/~w.c ",
218+
[SwiplLd, DepDir, Dep, Name, Name]),
219+
shell(Cmd).
208220

209221
build_test_shlibs :-
210-
build_shlib("shlib_no_deps"),
211-
build_shlib("libdep"),
212-
build_shlib("shlib_with_dep", "dep", "input").
222+
build_shlib("shlib_no_deps"),
223+
build_shlib("libdep"),
224+
build_shlib("shlib_with_dep", "dep", "input").
213225

214226
%% read_terms(+In:stream, -Data:list)
215227
%

0 commit comments

Comments
 (0)