test_eval1(N) :- number(N),!, wall(run_id(N)).
test_eval1(last) :- !, wall(run_last_test).
test_eval1(N-M) :- number(N), number(M),!, wall(run_tests_by_id(N-M)).
test_eval1('..'(N,M)) :- !, test_eval1(N-M).
test_eval1(repeat(ID,M)) :- !, repeat_id(ID,M).
test_eval1(r) :- !, run_random_tests(25).
test_eval1(v) :- !,v.
test_eval1(verbose) :- !,v.
test_eval1(all_files) :- !, all_files(Files), length(Files,Len),
format('~nFiles = ~n~w~n # Files = ~w~n',[Files,Len]).
test_eval1(valid_files(Mode)) :- !, all_valid_files(Files,Mode), length(Files,Len),
format('~nValid ~w Files = ~n~w~n # Files = ~w~n',[Mode,Files,Len]).
test_eval1(files) :- !, traverse.
test_eval1(files(Dir)) :- !, traverse(Dir).
test_eval1(ex(Dir)) :- !, set_prob_examples_location(Dir).
test_eval1(cache) :- !,print('Enabling cache'),nl,
cache.
test_eval1(debug) :- !,print('Enabling Prolog debugging mode (use -v or -vv for ProB debugging info)'),nl,
debug,
retractall(multiply_timeout(_)),
assertz(multiply_timeout(10)).
test_eval1(factor(X)) :- !,
retractall(multiply_timeout(_)),
format('Setting timeout factor to ~w~n',[X]),
assertz(multiply_timeout(X)).
test_eval1(timeout(X)) :- !,
format('Adding -timeout ~w for model checking, disproving~nUse factor(X) to set TIME_OUT factor.~n',[X]),
add_additional_arguments(['-timeout',X]).
test_eval1(coverage) :- !,
format('Adding -coverage to all commands.~n',[]),
add_additional_arguments(['-coverage']).
test_eval1(opreuse) :- !,
format('Adding operation reuse to all commands.~n',[]),
add_additional_arguments(['-p', 'OPERATION_REUSE',true]).
test_eval1(opc) :- !,
format('Adding operation reuse and compression to all commands.~n',[]),
add_additional_arguments(['-p', 'COMPRESSION', 'TRUE', '-p', 'OPERATION_REUSE',true]).
test_eval1(opcf) :- !,
format('Adding operation reuse and compression to all commands.~n',[]),
add_additional_arguments(['-p', 'COMPRESSION', 'TRUE', '-p', 'OPERATION_REUSE',full]).
test_eval1(reset) :- !, reset_additional_arguments.
test_eval1(logxml) :- !, File = './test_runner_logxml.xml',
set_logxml_file(File).
test_eval1(xsd) :- !, File = './test_runner_logxml.xml',
set_logxml_file(File), set_use_logxml_schema.
test_eval1(debug_off) :- !,print('Disabling Prolog debugging mode'),nl,
nodebug,
retractall(multiply_timeout(_)).
test_eval1(fast) :- !,print('Enabling jvm_parser_fastrw'),nl,
% TODO: only works at the very beginning; we need to be able to switch parser?
add_additional_preference('jvm_parser_fastrw','true'),
add_additional_preference('jvm_parser_force_parsing','true').
test_eval1(force) :- !,print('Setting jvm_parser_force_parsing'),nl,
add_additional_preference('jvm_parser_force_parsing','true').
test_eval1(clpfd) :- !,print('Enabling CLPFD'),nl,
add_additional_preference('CLPFD','TRUE').
test_eval1(clpfd_off) :- !,print('Disabling CLPFD'),nl,
add_additional_preference('CLPFD','FALSE').
test_eval1(smt) :- !,print('Enabling SMT'),nl,
add_additional_preference('SMT','TRUE').
test_eval1(smt_off) :- !,print('Disabling SMT'),nl,
add_additional_preference('SMT','FALSE').
test_eval1(chr) :- !,print('Enabling CHR'),nl,
add_additional_preference('CHR','TRUE').
test_eval1(chr_off) :- !,print('Disabling CHR'),nl,
add_additional_preference('CHR','FALSE').
test_eval1(cse_off) :- !,print('Disabling CSE'),nl,
add_additional_preference('CSE','FALSE').
test_eval1(cse) :- !,print('Enabling CSE'),nl,
add_additional_preference('CSE','TRUE').
test_eval1(cse_subst) :- !,print('Enabling CSE_SUBST'),nl,
add_additional_preference('CSE','TRUE'),
add_additional_preference('CSE_SUBST','TRUE').
test_eval1(trace_info) :- !,print('Enabling TRACE_INFO'),nl,
add_additional_preference('TRACE_INFO','TRUE').
test_eval1(p(PREF)) :- !,
get_preference_name(PREF,PName),
print('Enabling Preference '),print(PName),nl,
add_additional_preference(PName,'true').
test_eval1(p(PREF,VAL)) :- !,
get_preference_name(PREF,PName),
print('Setting Preference '),print(PName),nl,
add_additional_preference(PName,VAL).
test_eval1(random) :- !,print('Enabling RANDOMISE_ENUMERATION_ORDER'),nl,
add_additional_preference('RANDOMISE_ENUMERATION_ORDER','TRUE').
test_eval1(random_off) :- !,print('Enabling RANDOMISE_ENUMERATION_ORDER'),nl,
add_additional_preference('RANDOMISE_ENUMERATION_ORDER','FALSE').
test_eval1(safe) :- !,print('Setting PROB_SAFE_MODE'),nl,
run_safely.
test_eval1(sanity_check) :- !, sanity_check(false).
test_eval1(sc) :- !, sanity_check(false).
test_eval1(trace) :- !, print('Enabling TRACE_UPON_ERROR'),nl,
add_additional_preference('TRACE_UPON_ERROR','TRUE').
test_eval1(trace_off) :- !, print('Disabling TRACE_UPON_ERROR'),nl,
add_additional_preference('TRACE_UPON_ERROR','FALSE').
test_eval1(raise) :- !,print('Enabling STRICT_RAISE_ENUM_WARNINGS'),nl,
add_additional_preference('STRICT_RAISE_ENUM_WARNINGS','TRUE').
test_eval1(nopt) :- !,print('Disabling OPTIMIZE_AST'),nl,
add_additional_preference('OPTIMIZE_AST','FALSE').
test_eval1(vv) :- !,vv.
test_eval1(version(X)) :- !, print_version(X). %cpp, java, full, lib
test_eval1(version) :- !, print_version(full_verbose).
test_eval1(silent) :- !, run_silently.
test_eval1(nostrict) :- !, run_no_strict.
test_eval1(no_strict) :- !, run_no_strict.
test_eval1(strict) :- !, retractall(no_strict_running).
test_eval1(skip) :- !, (retract(skip_all_tests) -> X=false ; assertz(skip_all_tests),X=true),
format('Marking all tests as skipped: ~w~n',[X]).
test_eval1(x) :- !,halt.
test_eval1(reload) :- !,use_module(probsrc(test_runner)), use_module(probsrc(testcases)).
test_eval1(make) :- !,
print('make/0 is only supported on SWI-Prolog - reloading just the testcases instead.'),nl,
test_eval1(reload).
test_eval1(edit) :- last_testcase_run(Id),
cli_testcase(Id,_,_Infos,Arguments,_Comment),
member(File,Arguments), safe_file_exists(File),!,
edit_file(File).
test_eval1(e) :- !, test_eval1(edit).
test_eval1(diff) :- !, diff_in_editor.
test_eval1(halt) :- !,halt.
test_eval1(info) :- !, get_total_number_of_errors(X), format('~nTotal number of errors: ~w~n~n',[X]).
test_eval1(cat) :- !, print('Categories: '),
findall(Cat,
(cli_testcase(_, TestCategories, _, _, _), member(Cat, TestCategories)), List),
sort(List,SL), print(SL),nl,
format('Type cat(Cat) or name of category to run it.~n',[]),
format('Note: priv is an alias for private_source_not_available.~n',[]).
test_eval1(all) :- !, wall(run_tests_all).
test_eval1(cata) :- !, category_analysis.
test_eval1(cat(Category)) :- !,
wall(run_tests_by_category(Category,all)).
test_eval1(priv) :- !, test_eval1(cat(private_source_not_available)).
test_eval1(first(Category)) :- !,
wall(run_tests_by_first_category(Category)).
test_eval1(list(Category)) :- !,
get_tests_for_categories([Category],TList),
findall(Id,member(testcase(Id, _, _, _, _),TList),List),
format('Tests for category: ~w~n',[List]).
test_eval1(make(Categories)) :- !,
wall(makefile_by_category(user_output,Categories)).
test_eval1(make(File,Categories)) :- !,
wall(makefile_by_category(File,Categories)).
test_eval1(files(Category)) :- !, show_files(Category).
test_eval1(uses(Command)) :- !, wall(run_tests_using_command(Command)).
test_eval1(uses(Pref,Val)) :- !, wall(run_tests_using_preference(Pref,Val)).
test_eval1(p) :- !, test_eval1(profile).
test_eval1(ps) :- !, test_eval1(print_profile).
test_eval1(pc) :- !, test_eval1(print_coverage).
test_eval1(delta) :- !, print_delta_stats.
test_eval1(stats) :- !, print_current_stats.
test_eval1(statscsv) :- !, print_current_stats(user_output,',').
test_eval1(start) :- !, performance_session_start.
test_eval1(stop) :- !, performance_session_end('log/test_runner_performance_log.pl').
test_eval1(codespeed) :- !,
performance_session_start,
test_eval1(cat(codespeed)),
performance_session_end('log/test_runner_performance_codespeed_log.pl').
test_eval1(prob_profile) :- !,
cli_print_statistics(prob_profile),
cli_print_statistics(disprover_profile).
test_eval1(profile) :- !, print('PROFILING : '), %spy([avl:avl_size/2]),
(current_prolog_flag(profiling,on)
-> set_prolog_flag(profiling,off), print('OFF') ;
set_prolog_flag(profiling,on), print('ON')),
nl,print('USE ps to print_profile or pc to print_coverage info'),nl.
test_eval1(profile_stats) :- !, test_eval1(print_profile).
test_eval1(print_profile) :- !, nl,print('PROFILE INFORMATION:'), nl,
catch(print_profile,
error(existence_error(_,_),_),
print('CAN ONLY BE USED WHEN RUNNING PROB FROM SOURCE')),
nl, debug:timer_statistics.
test_eval1(print_coverage) :- !, nl,print('COVERAGE INFORMATION:'), nl,
(current_prolog_flag(source_info,on) -> true ; format_warning_nl('Only useful when current_prolog_flag(source_info,on)!',[])),
catch(print_coverage,
error(existence_error(_,_),_),
print('CAN ONLY BE USED WHEN RUNNING PROB FROM SOURCE')),
nl.
test_eval1(profile_reset) :- !, nl,print('RESETTING PROFILE INFORMATION'), nl,
catch(profile_reset,
error(existence_error(_,_),_),
print('CAN ONLY BE USED WHEN RUNNING PROB FROM SOURCE')),
nl.
test_eval1(perf) :- !, toggle_perfmessages.
test_eval1(Category) :- valid_category(Category),!,
wall(run_tests_by_category(Category,all)).
test_eval1(codespeed(Id)) :- !, codespeed_id(Id).
test_eval1(cs(Id)) :- !, codespeed_id(Id).
test_eval1('-'(ProBCLICommand)) :- atom(ProBCLICommand),
atom_concat('-',ProBCLICommand,Atom),
(prob_cli:recognised_option(Atom,Call) -> true % from probcli.pl
; format('Unknown probcli command: -~w~n',[ProBCLICommand]),fail),
!,
format('Executing probcli command ~w~n',[Call]),
call(prob_cli:Call).
test_eval1([H|T]) :- number(H),!, wall(run_tests_by_id([H|T],_,no_skipping)).
test_eval1([Category|T]) :- valid_category(Category),!,
wall(run_tests_by_category([Category|T],all)).
test_eval1(C) :-
(C=help -> true ; format('*** Unknown command ~w~n',[C])),
print(' Commands: Nr, Nr-Nr, last, q, x, v, vv, uses(Cmd), uses(Pref,Val),'),nl,
print(' repeat(id,nr), timeout(ms),factor(f), e,edit,diff, r (for 25 random tests),'),nl,
print(' cat, cat(Cats),make(Cats),make(File,Cats),files(Cat),'),nl,
print(' profile, profile_stats, (to turn Prolog profiling on and print info)'),nl,
print(' debug,debug_off, (to turn Prolog debug mode on or off)'),nl,
print(' perf, reload, sc,'),nl,
print(' -CMD, (for probcli commands like -profile)'),nl,
print(' * for setting preferences:'),nl,
print(' p(PREF), p(PREF,VAL),'),nl,
print(' clpfd,clpfd_off, smt,smt_off, chr,chr_off, cse,cse_subst,cse_off,'),nl,
print(' random,random_off, trace_info, nopt,'),nl,
print(' cache, perf, (turn ProB caching or performance messages on)'),nl,
print(' trace,trace_off, (set TRACE_UPON_ERROR preference)'),nl,
print(' * statistics:'),nl,
print(' delta, stats, info.'),nl.