Skip to content

Commit b5b549a

Browse files
committed
better for the test framework
1 parent 307da89 commit b5b549a

File tree

8 files changed

+137
-141
lines changed

8 files changed

+137
-141
lines changed

mettalog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export METTALOG_DIR=$(dirname "$SCRIPT")
1717
# echo "METTALOG_DIR=$METTALOG_DIR"
1818
# cd "$METTALOG_DIR" || { echo "Failed to navigate to $METTALOG_DIR"; [[ "$IS_SOURCED" == "1" ]] && return 1 || exit 1; }
1919

20+
METTALOG_TESTING_OPTS="--noninteractive --abort_trace --nodebug --repl=disable --no-regen"
21+
2022
need_compile=0
2123
exe=true
2224
compatio=false

prolog/metta_lang/metta_compiler.pl

Lines changed: 3 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -245,92 +245,6 @@
245245
partial_combine_lists(L1,L2,Lcomb,L1a,L2a).
246246
partial_combine_lists(L1,L2,[],L1,L2).
247247

248-
is_proper_arg(O):- compound(O),iz_conz(O), \+ is_list(O),!,bt, trace.
249-
is_proper_arg(_).
250-
% This hook is called when an attributed var is unified
251-
proper_list_attr:attr_unify_hook(_, Value) :- \+ compound(Value),!.
252-
proper_list_attr:attr_unify_hook(_, Value) :- is_list(Value),!.
253-
proper_list_attr:attr_unify_hook(_, Value) :- iz_conz(Value),!,trace.
254-
proper_list_attr:attr_unify_hook(_, _Value).
255-
% Attach the attribute if not already present and not already a proper list
256-
ensure_proper_list_var(Var) :- var(Var),!, put_attr(Var, proper_list_attr, is_proper_arg).
257-
ensure_proper_list_var(Var) :- is_proper_arg(Var),!.
258-
259-
260-
eval_at(_Fn,Where):- nb_current('eval_in_only',NonNil),NonNil\==[],!,Where=NonNil.
261-
eval_at( Fn,Where):- use_evaluator(fa(Fn, _), Only, only),!,Only=Where.
262-
eval_at(_Fn,Where):- option_value(compile,false),!,Where=interp.
263-
eval_at( Fn,Where):- use_evaluator(fa(Fn, _), Where, enabled),!.
264-
eval_at( Fn,Where):- nb_current(disable_compiler,WasDC),member(Fn,WasDC), Where==compiler,!,fail.
265-
eval_at( Fn,Where):- nb_current(disable_interp,WasDC),member(Fn,WasDC), Where==interp,!,fail.
266-
eval_at(_Fn,Where):- option_value(compile,full),!,Where=compiler.
267-
eval_at(_Fn, _Any):- !.
268-
269-
must_use_interp(Fn, only_interp(Fn), true):- use_evaluator(fa(Fn, _), interp, only).
270-
must_use_interp(_ , eval_in_only(compiler), never):- nb_current('eval_in_only',compiler).
271-
must_use_interp(_ , eval_in_only(interp), true):- nb_current('eval_in_only',interp).
272-
must_use_interp(Fn, disable_compiler(Fn), true):- nb_current(disable_compiler,WasDC), member(Fn,WasDC).
273-
must_use_interp(Fn,compiler_disabled(Fn), true):- use_evaluator(fa(Fn, _), compiler, disabled).
274-
must_use_interp(Fn,unknown(Fn), unknown).
275-
276-
must_use_compiler(_ ,eval_in_only(compiler)):- nb_current('eval_in_only',compiler).
277-
must_use_compiler(_ ,eval_in_only(interp)):- nb_current('eval_in_only',interp), fail.
278-
must_use_compiler(Fn,only_compiler(Fn)):- use_evaluator(fa(Fn, _), compiler, only).
279-
must_use_compiler(Fn,disable_interp(Fn)):- nb_current(disable_interp,WasDC), member(Fn,WasDC).
280-
must_use_compiler(Fn,interp_disabled(Fn)):- use_evaluator(fa(Fn, _), interp, disabled).
281-
282-
% Compiler is Disabled for Fn
283-
ci(PreInterp,Fn,Len,Eval,RetVal,_PreComp,_Compiled):- fail,
284-
once(must_use_interp(Fn,Why,TF)),
285-
TF \== unknown, TF \== never,
286-
debug_info(must_use_interp,why(Why,Fn=TF)),
287-
TF == true, !,
288-
289-
% \+ nb_current(disable_interp,WasDI),member(Fn,WasDI),
290-
call(PreInterp),
291-
maplist(lazy_eval_to_src,Eval,Src),
292-
if_t(Eval\=@=Src,
293-
debug_info(lazy_eval_to_src,ci(Fn,Len,Eval,RetVal))),
294-
%eval_fn_disable(Fn,disable_compiler,interp,((call(PreComp),call(Compiled)))),
295-
debug_info(Why,eval_args(Src,RetVal)),!,
296-
eval_args(Src,RetVal).
297-
298-
ci(_PreInterp,Fn,Len,_Eval,_RetVal,PreComp,Compiled):-
299-
%(nb_current(disable_interp,WasDI),member(Fn,WasDI);
300-
%\+ nb_current(disable_compiler,WasDC),member(Fn,WasDC)),!,
301-
%\+ \+ (maplist(lazy_eval_to_src,Eval,Src),
302-
% if_t(Eval\=@=Src, debug_info(lazy_eval_to_src,ci(Fn,Len,Eval,RetVal)))),
303-
if_t(false,debug_info(call_in_only_compiler,ci(Fn,Len,Compiled))),!,
304-
% eval_fn_disable(Fn,disable_compiler,eval_args(EvalM,Ret))
305-
%show_eval_into_src(PreInterp,Eval,_EvalM),
306-
(call(PreComp),call(Compiled)),
307-
%eval_fn_disable(Fn,disable_compiler,(call(PreComp),call(Compiled))),
308-
true.
309-
310-
eval_fn_disable(Fn,DisableCompiler,Call):-
311-
(nb_current(DisableCompiler,Was)->true;Was=[]),
312-
(New = [Fn|Was]),
313-
Setup = nb_setval(DisableCompiler,New),
314-
Restore = nb_setval(DisableCompiler,Was),
315-
redo_call_cleanup(Setup,Call,Restore).
316-
317-
318-
lazy_eval_to_src(A,O):- nonvar(O),trace,A=O.
319-
%lazy_eval_to_src(A,O):- var(A),!,O=A,ensure_proper_list_var(A).
320-
lazy_eval_to_src(A,O):- \+ compound(A),!,O=A.
321-
%lazy_eval_to_src(A,P):- is_list(A), maplist(lazy_eval_to_src,A,P),!.
322-
lazy_eval_to_src(A,P):- [H|T] = A, lazy_eval_to_src(H,HH),lazy_eval_to_src(T,TT),!,P= [HH|TT].
323-
lazy_eval_to_src(A,P):- as_p1_expr(A,P),!.
324-
325-
delistify(L,D):- is_list(L),L=[D],!.
326-
delistify(L,L).
327-
328-
create_prefixed_name(Prefix,LenArgs,FnName,String) :-
329-
%(sub_string(FnName, 0, _, _, "f") -> break ; true),
330-
length(LenArgs,L),
331-
append([Prefix,L|LenArgs],[FnName],Parts),
332-
atomic_list_concat(Parts,'_',String).
333-
334248
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
335249
%%%%%%%%%%%%%%%%% Evaluation (!)
336250
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -2401,7 +2315,9 @@
24012315
stream_property(Err, file_no(2)),
24022316
current_output(Cur), Cur\=@=Err,!,
24032317
with_output_to(Err, trace_break(G)).
2404-
trace_break(G):- nl, writeq(call(G)), trace,break.
2318+
trace_break(G):- notrace, nl, writeq(call(G)),nl,nl, current_prolog_flag(noninteractive,true), format('~nTRACE_BREAK_CALLED~n',[]),
2319+
once(bt), writeq(call(G)),throw('aborted').
2320+
trace_break(G):- notrace,nl, writeq(call(G)),nl,nl,format('~nTRACE_BREAK_CALLED~n',[]), nl, trace, \+ current_prolog_flag(noninteractive,true), break.
24052321
% :- set_prolog_flag(gc,false).
24062322

24072323
:- if(debugging(metta(compiler_bugs))).

prolog/metta_lang/metta_debug.pl

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -793,23 +793,32 @@
793793
sub_var_safely(Sub,Source):- assertion(acyclic_term(Source)),!,sub_var(Sub,Source).
794794
sub_term_safely(Sub,Source):- assertion(acyclic_term(Source)),!,sub_term(Sub,Source).
795795

796-
797-
maybe_abolish_trace:- \+ is_flag(abolish_trace), !.
798-
maybe_abolish_trace:- abolish_trace.
799-
abolish_trace:-
796+
maybe_abort_trace:- \+ is_flag(abort_trace), !.
797+
maybe_abort_trace:- abort_trace.
798+
abort_trace:-
800799
redefine_system_predicate(system:trace/0),
801800
abolish(system:trace/0),
802-
assert(( (system:trace) :- system:trace_called)),
801+
assert(( (system:trace) :- system:trace_called)), !.
802+
system:trace_called:- notrace,format(user_error,'~nTRACE_CALLED~n',[]), once(bt), current_prolog_flag(abort_trace,true), format(user_error,'~nTRACE_CALLED~n',[]), throw('aborted').
803+
system:trace_called:- break.
804+
805+
806+
maybe_noninteractive:- \+ is_flag(noninteractive), !.
807+
maybe_noninteractive:- noninteractive.
808+
noninteractive:-
809+
set_prolog_flag(noninteractive,true),
810+
%redefine_system_predicate(system:trace/0),
811+
%abolish(system:trace/0),
812+
%assert(( (system:trace) :- system:trace_called)),
813+
leash(-all),
814+
%no_interupts(nts1r),
803815
redefine_system_predicate(system:break/0),
804816
abolish(system:break/0),
805817
assert(( (system:break) :- system:break_called)).
818+
system:break_called:- notrace,format(user_error,'~nBREAK_CALLED~n',[]), once(bt), current_prolog_flag(noninteractive,true), format(user_error,'~nBREAK_CALLED~n',[]), throw('aborted').
819+
system:break_called:- prolog.
806820

807-
system:trace_called:- format(user_error,'~nTRACE_CALLED~n',[]), fail.
808-
system:trace_called:- once(bt), fail.
809-
%system:trace_called:- break.
810821

811-
system:break_called:- format(user_error,'~nBREAK_CALLED~n',[]), fail.
812-
system:break_called:- once(bt), fail.
813822
%system:break_called:- break.
814823

815824
% return true if we want to hide away developer chicanery

prolog/metta_lang/metta_eval.pl

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@
329329
eval_001(Eq,RetType,Depth,Self,X,YO):-
330330
eval_01(Eq,RetType,Depth,Self,X,YO).
331331

332-
overflow_depth(N,Depth):- Depth>(10_000-N).
332+
overflow_depth(N,Depth):- (10_000-N)=<Depth.
333333
overflow_depth(Depth):- Depth>10_000.
334334
deepen(Depth,Depth2):- succ(Depth,Depth2).
335335

@@ -341,7 +341,7 @@
341341

342342
if_t((overflow_depth(Depth), trace_on_overflow), debug(metta(e))),
343343

344-
trace_eval(eval_10(Eq,RetType),e,Depth2,Self,X,M),
344+
trace_eval(eval_07(Eq,RetType),e,Depth2,Self,X,M),
345345

346346
((M=@=XX;M==X;M=@=X) -> Y=M ; eval_03(Eq,RetType,Depth2,Self,M,Y)).
347347

@@ -465,13 +465,13 @@
465465
is_mettalog_tracing([X|_],Type):- !, is_mettalog_tracing(X,Type).
466466
is_mettalog_tracing(H,Type):- woc(metta_atom(_,[mettalog_trace,HH,Type])), \+ \+ H=HH, !.
467467

468-
eval_08(Eq,RetType,Depth,Self,X,Y):- is_mettalog_tracing(X,Type),!,
469-
with_debug(Type,eval_09(Eq,RetType,Depth,Self,X,Y)).
470-
eval_08(Eq,RetType,Depth,Self,X,Y):- eval_09(Eq,RetType,Depth,Self,X,Y).
468+
eval_07(Eq,RetType,Depth,Self,X,Y):- is_mettalog_tracing(X,Type),!,
469+
with_debug(Type,eval_08(Eq,RetType,Depth,Self,X,Y)).
470+
eval_07(Eq,RetType,Depth,Self,X,Y):- eval_08(Eq,RetType,Depth,Self,X,Y).
471471

472-
%eval_09(_Eq,_RetType, Depth,_Slf,X,Y):- Depth< 0, !, X=Y, fail.
473-
%eval_09(_Eq,_RetType, Depth,_Slf,X,Y):- Depth< 1, !, X=Y.
474-
%eval_09(_Eq,_RetType, Depth,_Slf,_X,_Y):- Depth<1, if_trace(e,bt),!, fail.
472+
%eval_08(_Eq,_RetType, Depth,_Slf,X,Y):- Depth< 0, !, X=Y, fail.
473+
%eval_08(_Eq,_RetType, Depth,_Slf,X,Y):- Depth< 1, !, X=Y.
474+
%eval_08(_Eq,_RetType, Depth,_Slf,_X,_Y):- Depth<1, if_trace(e,bt),!, fail.
475475

476476
%hybrid_interp :- !.
477477
hybrid_interp :- option_value(compile,hybrid),!.
@@ -480,16 +480,34 @@
480480
hybrid_interp :- option_value(compile,full),!,fail.
481481
hybrid_interp :- option_value(compile,true),!.
482482

483+
get_symbol_impl_only(interp,Fn,Len):- symbol_impl_only(interp,Fn,Len),!.
484+
get_symbol_impl_only(interp,Fn,Len):- eval_at(fa(Fn,Len), interp), \+ eval_at(fa(Fn,Len), compiler),!.
483485

484-
eval_09(Eq,RetType,Depth,Self,X,Y):-
486+
eval_08(Eq,RetType,Depth,Self,X,Y):- option_value(compile, false), !, eval_09(Eq,RetType,Depth,Self,X,Y).
487+
eval_08(Eq,RetType,Depth,Self,X,Y):- \+ compound(X), !, eval_09(Eq,RetType,Depth,Self,X,Y).
488+
eval_08(Eq,RetType,Depth,Self,X,Y):- \+ is_list(X), !, eval_09(Eq,RetType,Depth,Self,X,Y).
489+
eval_08(Eq,RetType,Depth,Self,X,Y):-
485490
nb_current('eval_in_only', interp), !,
486-
woc(eval_10(Eq,RetType,Depth,Self,X,Y)).
487-
eval_09(Eq,RetType,Depth,Self,X,Y):- hybrid_interp, !,
491+
eval_09(Eq,RetType,Depth,Self,X,Y).
492+
eval_08(Eq,RetType,Depth,Self,X,Y):-
493+
nb_current('eval_in_only', compiler), !,
494+
with_scope(Eq, RetType, Depth, Self, transpile_eval(X,Y)).
495+
eval_08(Eq,RetType,Depth,Self,X,Y):-
496+
nb_current('eval_in_only', rust), !,
497+
with_scope(Eq, RetType, Depth, Self, rust_metta_run(exec(X),Y)).
498+
eval_08(Eq,RetType,Depth,Self,X,Y):- X = [Fn|Args], length(Args,Len), eval_08(Fn,Len,Eq,RetType,Depth,Self,X,Y).
499+
500+
eval_08(Fn,Len,Eq,RetType,Depth,Self,X,Y):-
501+
get_symbol_impl_only(interp,Fn,Len),!, eval_09(Eq,RetType,Depth,Self,X,Y).
502+
eval_08(Fn,Len,Eq,RetType,Depth,Self,X,Y):-
503+
symbol_impl_exists(interp, Fn, Len),!, eval_09(Eq,RetType,Depth,Self,X,Y).
504+
eval_08(Eq,RetType,Depth,Self,X,Y):- hybrid_interp, !,
488505
eval_use_right_thing(Eq,RetType,Depth,Self,X,Y).
489506
eval_09(Eq,RetType,Depth,Self,X,Y):- woc(eval_10(Eq,RetType,Depth,Self,X,Y)).
490507

491-
%eval_09(Eq,RetType,Depth,Self,X,Y):- !, no_repeats(X+Y,eval_10(Eq,RetType,Depth,Self,X,Y)).
492-
eval_09_hide(Eq,RetType,Depth,Self,X,Y):- !,
508+
509+
%eval_08(Eq,RetType,Depth,Self,X,Y):- !, no_repeats(X+Y,eval_10(Eq,RetType,Depth,Self,X,Y)).
510+
eval_08_hide(Eq,RetType,Depth,Self,X,Y):- !,
493511
no_repeats_var(YY),
494512
eval_to_name(X,XX),!,
495513
eval_10(Eq,RetType,Depth,Self,X,Y), %break,
@@ -772,9 +790,11 @@
772790
eval_20(_,_,_,_,['echo',Value],Value):- !.
773791
%eval_20(=,Type,_,_,['coerce',Type,Value],Result):- !, coerce(Type,Value,Result).
774792

775-
eval_20(_Eq,RetType,Depth,Self,['py-atom-call!',[Sym|Specialize]|Args],Res):- is_list(Args), !,
793+
eval_20(_Eq,RetType,Depth,Self,['py-atom-call!',SymSpecialize|Args],Res):- is_list(Args), !,
794+
listify(SymSpecialize,[Sym|Specialize]),
776795
maplist(as_prolog_x(Depth,Self), Args , Adjusted),!,
777-
py_call_method_and_args_sig(RetType,[],Sym,Adjusted,Res).
796+
py_call_method_and_args_sig(RetType,Specialize,Sym,Adjusted,Res).
797+
778798
eval_40(Eq,RetType,Depth,Self,['py-atom-call',Sym|Args],Res):-
779799
eval_20(Eq,RetType,Depth,Self,['py-atom-call!',Sym|Args],Res).
780800

@@ -1172,7 +1192,7 @@
11721192

11731193

11741194

1175-
eval_20(Eq,RetType,_Dpth,_Slf,['repl!'],Y):- !, repl,check_returnval(Eq,RetType,Y).
1195+
eval_20(Eq,RetType,_Dpth,_Slf,['repl!'],Y):- !, repl, check_returnval(Eq,RetType,Y).
11761196
%eval_20(Eq,RetType,Depth,Self,['enforce',Cond],Res):- !, enforce_true(Eq,RetType,Depth,Self,Cond,Res).
11771197

11781198
eval_20(Eq,RetType,Depth,Self,['trace!',A,B],C):- !, % writeln(trace(A)),
@@ -3084,7 +3104,7 @@
30843104
no_repeat_variant_var(Var):- no_repeats_var(Var).
30853105
%no_repeat_variant_var(Var):- no_repeats_var(variant_by_type,Var).
30863106

3087-
eval_30(=,_RetType,_,_,[Var|Types],_):- var(Var), !,
3107+
eval_30(=,_RetType,_,_,[Var|Types],_):- var(Var), !,
30883108
throw(var_eval_30([Var|Types])).
30893109

30903110
eval_30(_Eq,_RetType,_Depth,_Self,[Space|More],[Space|More]):-
@@ -3435,7 +3455,7 @@
34353455
transpiler_peek(Sym,Len,TypeL,Fn, Min, SpreadArgs):-
34363456
is_list(TypeL), !, member(Type,TypeL),
34373457
transpiler_peek(Sym,Len,Type,Fn, Min, SpreadArgs).
3438-
3458+
34393459
transpiler_peek(Sym,Len,Type,Fn, Min, exactArgs):- Len=Min,
34403460
if_t((var(Sym)),ignore(transpiler_predicate_store(_, Sym,_ , _, _, _, _))),
34413461
nonvar(Sym),
@@ -3512,7 +3532,7 @@
35123532
jiggle_args(Args,Res,Len,Min,AsList,PArgs), ! ,
35133533
with_metta_ctx(Eq,RetType,Depth,Self,[Sym|Args],apply(Fn,PArgs)).
35143534

3515-
eval_30(Eq, RetType, Depth, Self, [Sym | Args], Res) :-
3535+
eval_30(Eq, RetType, Depth, Self, [Sym | Args], Res) :-
35163536
fail,
35173537
\+ eval_at(Sym,interp), symbol(Sym), is_list(Args),
35183538
len_or_unbound(Args, Len),

prolog/metta_lang/metta_interp.pl

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@
868868
% @example
869869
% ?- nullify_output.
870870
% true.
871+
871872
nullify_output :- keep_output, !.
872873
nullify_output :- dont_change_streams, !.
873874
nullify_output :- nullify_output_really.
@@ -1554,7 +1555,9 @@
15541555
on_set_value(Note,N,true). % true
15551556
on_set_value(Note,N,'False'):- nocut,
15561557
on_set_value(Note,N,false). % false
1557-
on_set_value(_Note,abolish_trace,true):- nocut, ignore(abolish_trace),!.
1558+
1559+
on_set_value(_Note,noninteractive,true):- nocut, ignore(noninteractive),!.
1560+
on_set_value(_Note,abort_trace,true):- nocut, ignore(abort_trace),!.
15581561

15591562
on_set_value(_Note,show, Value):-
15601563
if_t( \+ prolog_debug:debugging(filter_default,_,_), set_debug(default,false)),
@@ -1675,7 +1678,8 @@
16751678
!.
16761679
% Enable unit testing with specific runtime configurations.
16771680
set_is_unit_test(TF):-
1678-
maybe_abolish_trace,
1681+
maybe_noninteractive,
1682+
maybe_abort_trace,
16791683
% Reset all options to their default values.
16801684
%reset_default_flags,
16811685
% Disable specific trace settings during unit testing.
@@ -6948,7 +6952,7 @@
69486952
once(pre_halt1), fail.
69496953
maybe_halt(Seven) :-
69506954
% If the REPL is disabled (`repl = false`), halt with the specified exit code.
6951-
option_value('repl', false), !, halt(Seven).
6955+
option_value('repl', false), \+ current_prolog_flag(mettalog_rt, true), !, halt(Seven).
69526956
maybe_halt(Seven) :-
69536957
% If halting is explicitly enabled (`halt = true`), halt with the specified exit code.
69546958
option_value('halt', true), !, halt(Seven).
@@ -7181,9 +7185,10 @@
71817185
% is allowed, it handles modifications to `system:notrace/1` to customize its behavior.
71827186
%
71837187

7184-
%nts1 :- !. % Disable redefinition by cutting execution.
7188+
nts1 :- !. % Disable redefinition by cutting execution.
71857189
%nts1 :- is_flag(notrace),!.
7186-
nts1 :-
7190+
nts1 :- no_interupts(nts1r).
7191+
nts1r :-
71877192
% Redefine the system predicate `system:notrace/1` to customize its behavior.
71887193
redefine_system_predicate(system:notrace/1),
71897194
%listing(system:notrace/1),
@@ -7193,13 +7198,32 @@
71937198
dynamic(system:notrace/1),
71947199
% Define the meta-predicate behavior for `system:notrace/1`.
71957200
meta_predicate(system:notrace(0)),
7201+
71967202
% Define the new behavior for `system:notrace/1`.
71977203
% The redefined version executes the goal (`G`) with `once/1` and succeeds deterministically.
7198-
asserta(( system:notrace(G) :- (!, once(G) ))).
7199-
nts1 :-
7204+
asserta(( system:notrace(G) :- (!, unotrace(G),! ))).
7205+
nts1r :-
72007206
% Ensure that further redefinitions of `nts1` are not allowed after the first.
72017207
!.
72027208

7209+
:- meta_predicate(no_interupts(0)).
7210+
no_interupts(G):- setup_call_cleanup(G,true,true).
7211+
:- use_module(library(logicmoo/redo_locally)).
7212+
:- meta_predicate(unotrace(0)).
7213+
unotrace(G):- unotrace2(G).
7214+
:- meta_predicate(unotrace1(0)).
7215+
unotrace1(G):- (\+ tracing -> once(G) ; scce_orig(notrace,once(G),trace)).
7216+
:- meta_predicate(unotrace2(0)).
7217+
unotrace2(G):- with_leash_visible(-all,-all,G),!.
7218+
:- meta_predicate(with_leash_visible(+,+,0)).
7219+
with_leash_visible(Leash,Visible,Goal):-
7220+
'$leash'(OldL, OldL),'$visible'(OldV, OldV),
7221+
leash(Leash), visible(Visible),
7222+
'$leash'(NewL, NewL),'$visible'(NewV, NewV),
7223+
scce_orig(('$leash'(_, NewL),'$visible'(_, NewV)),
7224+
(Goal*->('$leash'(_, OldL),'$visible'(_, OldV));(('$leash'(_, OldL),'$visible'(_, OldV)),fail)),
7225+
('$leash'(_, OldL),'$visible'(_, OldV))).
7226+
72037227
%:-nts1.
72047228
:- initialization(nts1).
72057229
%! nts0 is det.

prolog/metta_lang/metta_repl.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,10 @@
232232
% metta>
233233
%
234234
repl2 :-
235+
if_t(option_value(repl,disable),throw('$aborted')),
236+
235237
% Load the REPL history and clean it up if necessary.
236238
ignore(catch(load_and_trim_history,_,true)),
237-
238239
% Begin an infinite loop using repeat to keep REPL active.
239240
repeat,
240241
% Reset internal caches for better performance.

scripts/run_commit_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ run_mettalog_tests() {
112112
echo "Running tests in: $test_dir"
113113

114114
# Construct the command
115-
local cmd=(mettalog --output="$output" --test --abolish_trace --no-regen --timeout="$max_time_per_test" "$test_dir")
115+
local cmd=(mettalog --output="$output" --test --noninteractive --abort_trace --repl=disable --no-regen --timeout="$max_time_per_test" "$test_dir")
116116

117117
if [ "${#args[@]}" -gt 0 ]; then
118118
cmd+=("${args[@]}")

0 commit comments

Comments
 (0)