1#!/usr/bin/env swipl
    2/* * module * Logicmoo_base sanity test script to be ran before a release
    3
    4*/
    5
    6
    7% ==============================
    8% Setup Testing Options
    9% ==============================
   10
   11:- asserta(baseKB:load_mud_www).   12:- asserta(t_l:verify_side_effect_buffer).   13:- asserta(baseKB:skip_el_assertions).   14
   15
   16% ==============================
   17% Setup Runtime paths
   18% ==============================
   19
   20:- user:ensure_loaded(setup_paths).   21
   22:- user:test_for_release(setup_paths).   23
   24% ==============================
   25% Load logicmoo REPL Base
   26% (and Default Daemons/inference engine)
   27% ==============================
   28
   29:- user:test_for_release(logicmoo_repl).   30
   31
   32% ==============================
   33% Release tests
   34% ==============================
   35
   36% :- statistics(globallimit,G),statistics(locallimit,L),statistics(traillimit,T),qsave_program(logicmoo_repl,[map('logicmoo_repl.sav'),global(G),trail(T),local(L)]).
   37
   38
   39:- tell(blalla).   40
   41:-listing(side_effect_buffer/3).   42
   43:-forall(t_l:actual_side_effect(H,B),(nl,portray_clause(H:-B))).   44
   45:-listing(side_effect_buffer/3).   46
   47:- told.   48
   49
   50% [Required] Load the Logicmoo Backchaining Inference System
   51:- gripe_time(40,with_no_mpred_expansions(if_file_exists(user:test_for_release(library(logicmoo_user))))).   52
   53
   54:- asserta(baseKB:skip_el_assertions).   55:- dynamic  el_assertions:el_holds/4.   56:- dynamic  el_assertions:el_holds/10.   57:- dynamic  el_assertions:el_holds/11.   58:- dynamic  el_assertions:el_holds/12.   59:- dynamic  el_assertions:el_holds/13.   60:- dynamic  el_assertions:el_holds/14.   61
   62
   63
   64:- user:test_for_release(library(logicmoo_plarkc)).   65% :- user:test_for_release(library(logicmoo_planner)).
   66%:- user:load_library_system(library(logicmoo_planner)).
   67%:- user:test_for_release(library(parser_all)).
   68:- user:test_for_release(init_mud_server).   69
   70
   71% [Never] saves about a 3 minute compilation time (for when not runing mud)
   72:- if((fail,gethostname(titan),fail)).   73:- if_startup_script( finish_processing_world).   74:- enqueue_agent_action("rez crackers").   75
   76:- endif.   77
   78
   79%:- flag_call(runtime_debug=false).
   80
   81%:- set_prolog_flag(trace_gc,false).
   82%:- set_prolog_flag(backtrace_depth,400).
   83
   84
   85% [Manditory] This loads the game and initializes so test can be ran
   86:- if_startup_script(finish_processing_world).   87
   88% sanity_test:- rescan_pfc.
   89
   90%:- rescan_pfc. 
   91:-dmsg("About to run Sanity").   92
   93
   94:- show_entry(gripe_time(40,if_startup_script(doall(sanity_test)))).   95
   96
   97feature_testp1:- forall(parserTest(Where,String),assert_text(Where,String)).
   98
   99:- if((fail,gethostname(titan))).  100
  101% :-feature_testp1.
  102
  103% [Optionaly] Run a battery of tests
  104% :- if_startup_script( doall(now_run_local_tests_dbg)).
  105
  106% [Optionaly] Run a battery of tests
  107% :- if_startup_script( doall(baseKB:regression_test)).
  108
  109
  110sanity_test0a:- enqueue_agent_action("hide").
  111
  112sanity_test0b:- enqueue_agent_action(actWho).
  113:-sanity_test0b.  114
  115sanity_test1:-   
  116   enqueue_agent_action("rez crackers"),
  117   enqueue_agent_action("drop crackers"),
  118   enqueue_agent_action('look'),
  119   enqueue_agent_action("take crackers"),
  120   enqueue_agent_action("eat crackers"),
  121   enqueue_agent_action('look').
  122:-sanity_test1.  123
  124sanity_test2:- enqueue_agent_action("rez pants"),
  125   enqueue_agent_action("wear pants"),
  126   enqueue_agent_action("tp to closet"),
  127   enqueue_agent_action("take shirt"),
  128   enqueue_agent_action("inventory").
  129
  130:-sanity_test2.  131
  132
  133% [Optionaly] Tell the NPCs to do something every 60 seconds (instead of 90 seconds)
  134% :- register_timer_thread(npc_ticker,60,npc_tick).
  135
  136:- show_entry(gripe_time(40,test_for_release(prologmud(mud_startup)))).  137
  138
  139:- pce_show_profile.  140
  141:-endif.  % MUD TESTS
  142
  143
  144
  145:- multifile(push_env_ctx/0).  146:- dynamic(push_env_ctx/0).  147
  148push_env_ctx:-!,fail.
  149push_env_ctx:-!.
  150
  151:- user:test_for_release(debug_mud_game).  152
  153
  154% :- statistics(globallimit,G),statistics(locallimit,L),statistics(traillimit,T),qsave_program(logicmoo_repl,[map('logicmoo_repl.sav'),global(G),trail(T),local(L)]).
  155
  156
  157
  158% [Mostly Required] Load the UPV Curry System
  159%:- time(test_for_release(library(upv_curry/main))).