Changes In Branch v1.80 Through [ac15ec2989] Excluding Merge-Ins
This is equivalent to a diff from 60b31fb56a to ac15ec2989
2024-05-14
| ||
16:46 | Changed version to 1.8032 check-in: 72cba60ca9 user: mmgraham tags: v1.80, v1.8032 | |
08:58 | added extra condition to tests:get-items to return #f when items and itemstable were #f check-in: ac15ec2989 user: mmgraham tags: v1.80 | |
2024-05-13
| ||
17:02 | Changed sleep after server start from 3 to 4 seconds to avoid unncessary server restarts. check-in: d5b4d7755f user: mmgraham tags: v1.80 | |
2023-10-20
| ||
05:12 |
Merged fork
This node ran run-core-tests.sh through kill-rerun - a pretty good result. Dashboard comes up quickly also. check-in: e607892c7d user: mrwellan tags: v1.80 | |
04:57 | Merged fork check-in: 53900a0d02 user: mrwellan tags: v1.80-start-all | |
2023-10-19
| ||
18:55 | changed a debug msg to level2, increased delay from 0.5 to 2 secs Leaf check-in: 60b31fb56a user: mmgraham tags: v1.80-processes | |
16:09 | moved make-tmpdir-name into commonmod check-in: 1624c400a9 user: mmgraham tags: v1.80-processes | |
Modified api.scm from [5fa313076b] to [13a08c65d1].
︙ | |||
369 370 371 372 373 374 375 | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | + - + + | ((dec-var) (apply db:dec-var dbstruct params)) ((del-var) (apply db:del-var dbstruct params)) ((add-var) (apply db:add-var dbstruct params)) ((insert-run) (apply db:insert-run dbstruct params)) ;; STEPS ((teststep-set-status!) |
︙ |
Modified common.scm from [0854266963] to [a6df612234].
︙ | |||
41 42 43 44 45 46 47 | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | - + | rmtmod (prefix mtargs args:)) (include "common_records.scm") (define (remove-files filespec) (let ((files (glob filespec))) |
︙ |
Modified dashboard.scm from [92015a98e3] to [6ea3e152b3].
︙ | |||
3110 3111 3112 3113 3114 3115 3116 | 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 | - + | exn (begin (debug:print 2 *default-log-port* "WARNING: error in accessing databases in get-youngest-run-db-mod-time: " ((condition-property-accessor 'exn 'message) exn) " db-dir="dbdir ", exn=" exn) (current-seconds)) ;; something went wrong - just print an error and return current-seconds (common:max (map (lambda (filen) (file-modification-time filen)) |
︙ | |||
3826 3827 3828 3829 3830 3831 3832 | 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 | + - + | ;; (print "Starting dashboard main") (let* ((mtdb-path (conc *toppath* "/.mtdb/main.db")) (target (args:get-arg "-target")) (commondat (dboard:commondat-make))) (if target (begin (hash-table-delete! args:arg-hash "-target") ;; workaround for the following commented out function |
︙ |
Modified db.scm from [b1837f1312] to [0a367c507f].
︙ | |||
2737 2738 2739 2740 2741 2742 2743 | 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 | - - | (sqlite3:execute db "INSERT OR REPLACE into test_steps (test_id,stepname,state,status,event_time,comment,logfile) VALUES(?,?,?,?,?,?,?);" test-id teststep-name state-in status-in (current-seconds) (if comment comment "") (if logfile logfile ""))))) |
︙ | |||
4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 | 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | (begin (debug:print 0 *default-log-port* "WARNING: path given, " outputfile " is relative, prefixing with current directory") (conc (current-directory) "/" outputfile))) results) ;; brutal clean up (dbfile:add-dbdat dbstruct #f dbdat) (system "rm -rf tempdir"))) ;;====================================================================== ;; cached writes stuff ;;====================================================================== (define (db:add-cached-write dbstruct proc run-id params) (debug:print 0 *default-log-port* "Adding cached write for run-id "run-id" params " params) (mutex-lock! *cached-writes-mutex*) (let* ((hkey (cons dbstruct run-id)) (cached-writes-queue (hash-table-ref/default *cached-writes-queues* hkey '()))) (hash-table-set! *cached-writes-queues* hkey (cons (list proc params) cached-writes-queue))) (if (not *cached-writes-flag*) (begin (set! *cached-writes-flag* #t) (thread-start! (make-thread (lambda () (debug:print 0 *default-log-port* "process cached writes thread started.") (thread-sleep! 1) (db:process-cached-writes-queue)))))) (mutex-unlock! *cached-writes-mutex*)) (define (db:process-cached-writes-queue) (mutex-lock! *cached-writes-mutex*) (hash-table-for-each *cached-writes-queues* (lambda (hkey writes-list) (let* ((dbstruct (car hkey)) (run-id (cdr hkey))) (debug:print 0 *default-log-port* "Processing "(length writes-list)" cached writes for run "run-id) (db:with-db dbstruct run-id #t (lambda (dbdat db) (sqlite3:with-transaction db (lambda () (for-each (lambda (queued-write) (match queued-write ((proc params)(apply proc dbstruct params)) (else (assert #f "BAD queued-write")))) writes-list))) (hash-table-delete! *cached-writes-queues* hkey)))))) (set! *cached-writes-flag* #f) (mutex-unlock! *cached-writes-mutex*)) ;; (db:extract-ods-file db "outputfile.ods" '(("sysname" "%")("fsname" "%")("datapath" "%")) "%") ;;====================================================================== ;; moving watch dogs here due to dependencies ;;====================================================================== |
︙ |
Modified dbfile.scm from [b5eea0764a] to [e2ffa01a50].
︙ | |||
444 445 446 447 448 449 450 | 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | - + + | (if sync-mode (sqlite3:execute db (conc "PRAGMA synchronous = "sync-mode";"))) (if journal-mode (sqlite3:execute db (conc "PRAGMA journal_mode = "journal-mode";"))) (if (and init-proc (or force-init (not db-exists))) (init-proc db)) |
︙ | |||
1511 1512 1513 1514 1515 1516 1517 | 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 | - + | (if (file-exists? fname) (handle-exceptions exn #f (with-input-from-file fname (lambda () (equal? key-string (read-line))))) (begin |
︙ | |||
1577 1578 1579 1580 1581 1582 1583 1584 | 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 | + + + + - + + + + + + + | (result (or stmth (let* ((newstmth (sqlite3:prepare db stmt))) ;; (db:hoh-set! stmt-cache db stmt newstmth) (hash-table-set! stmt-cache stmt newstmth) newstmth)))) (mutex-unlock! *get-cache-stmth-mutex*) result)) ;;====================================================================== ;; cached writes - run list of procs inside transaction ;; NOTE: this only works because we have once database per process ;;====================================================================== |
Modified dbmod.scm from [9f0ce614a3] to [2bc6505880].
︙ | |||
117 118 119 120 121 122 123 | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | - - + + + + | (debug:print-info 0 *default-log-port* "dbmod:with-db, database is busy, will try "count" more times.") (thread-sleep! 1) (loop (- count 1))) (begin (debug:print-info 0 *default-log-port* "dbmod:with-db, database is busy, giving up.") (exit 1)))) (exn () |
︙ | |||
518 519 520 521 522 523 524 | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | - + | ;; for each table ;; insert into dest.<table> select * from src.<table> where last_update>last_update ;; done (debug:print 2 *default-log-port* "Attaching "destdbfile" as auxdb") (handle-exceptions exn (begin |
︙ |
Modified launch.scm from [470997d4b0] to [9b7b7e2640].
︙ | |||
339 340 341 342 343 344 345 346 347 348 349 350 351 352 | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | (if (hash-table-ref/default misc-flags 'keep-going #f) ;; keep originals for cpu-load and disk-free unless they change more than the allowed delta (loop (calc-minutes) (or new-cpu-load cpu-load) (or new-disk-free disk-free) (if do-sync (current-seconds) last-sync))))))) (tests:update-central-meta-info run-id test-id (get-cpu-load) (get-df (current-directory))(calc-minutes) #f #f))) ;; NOTE: Checking twice for keep-going is intentional ;; read testconfig and create .logpro and script files ;; - use #f for tconfigreg to re-read the testconfigs from disk ;; (define (launch:extract-scripts-logpro test-dir test-name item-path tconfigreg-in) (let* ((tconfigreg (or tconfigreg-in (tests:get-all))) (tconfig-fname (conc test-dir "/.testconfig")) (tconfig-tmpfile (conc tconfig-fname ".tmp")) (tconfig (tests:get-testconfig test-name item-path tconfigreg #t force-create: #t)) ;; 'return-procs))) (scripts (configf:get-section tconfig "scripts")) (logpros (configf:get-section tconfig "logpro"))) ;; create .testconfig file (configf:write-alist tconfig tconfig-tmpfile) (file-move tconfig-tmpfile tconfig-fname #t) (delete-file* ".final-status") ;; extract scripts from testconfig and write them to files in test run dir (for-each (lambda (scriptdat) (match scriptdat ((name content) (debug:print-info 2 *default-log-port* "Creating script "(current-directory)"/"name) (with-output-to-file name (lambda () (print content))) (change-file-mode name (bitwise-ior perm/irwxg perm/irwxu))) (else (debug:print-info 0 "Invalid script definiton found in [scripts] section of testconfig. \"" scriptdat "\"")))) scripts) ;; extract logpro from testconfig and write them to files in test run dir (for-each (lambda (logprodat) (match logprodat ((name content) (debug:print-info 2 *default-log-port* "Creating logpro file "(current-directory)"/"name) (with-output-to-file name (lambda () (print content) ;; (change-file-mode name (bitwise-ior perm/irwxg perm/irwxu)) ))) (else (debug:print-info 0 "Invalid logpro definiton found in [logpro] section of testconfig. \"" logprodat "\"")))) logpros))) (define (launch:execute encoded-cmd) (let* ((cmdinfo (common:read-encoded-string encoded-cmd)) (tconfigreg #f)) (setenv "MT_CMDINFO" encoded-cmd) ;;(bb-check-path msg: "launch:execute incoming") (if (list? cmdinfo) ;; ((testpath /tmp/mrwellan/jazzmind/src/example_run/tests/sqlitespeed) |
︙ | |||
614 615 616 617 618 619 620 | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | - + - | (if (string-search tmppath " ") (debug:print 0 *default-log-port* "WARNING: spaces in PATH are not supported.")) (if mt-bindir-path (setenv "PATH" (conc tmppath":"mt-bindir-path)))) ;;(bb-check-path msg: "launch:execute post block 4") ;; (change-directory top-path) ;; Can setup as client for server mode now ;; (client:setup) |
︙ | |||
645 646 647 648 649 650 651 652 | 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 | + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + | (if (args:get-arg "-xterm") (set! fullrunscript "xterm") (if (and fullrunscript (common:file-exists? fullrunscript) (not (file-execute-access? fullrunscript))) (system (conc "chmod ug+x " fullrunscript)))) (launch:extract-scripts-logpro work-area test-name item-path tconfigreg) |
︙ | |||
755 756 757 758 759 760 761 | 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 | - - + + + + + + + + + + | (rmt:update-run-stats run-id (rmt:get-raw-run-stats run-id))) ;; end of let* (mutex-unlock! m) (launch:end-of-run-check run-id ) (debug:print 2 *default-log-port* "Output from running " fullrunscript ", pid " (launch:einf-pid exit-info) " in work area " work-area ":\n====\n exit code " (launch:einf-exit-code exit-info) "\n" "====\n") |
︙ | |||
885 886 887 888 889 890 891 | 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 | - + | runname (common:file-exists? fulldir)) (let ((tmpfile (conc fulldir "/.megatest.cfg." (current-seconds))) (targfile (conc fulldir "/.megatest.cfg-" megatest-version "-" megatest-fossil-hash)) (rconfig (conc fulldir "/.runconfig." megatest-version "-" megatest-fossil-hash))) (if (common:file-exists? rconfig) ;; only cache megatest.config AFTER runconfigs has been cached (begin |
︙ |
Modified megatest-version.scm from [5a374d2bf1] to [93d0d09127].
︙ | |||
16 17 18 19 20 21 22 | 16 17 18 19 20 21 22 23 | - + | ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;; Always use two or four digit decimal ;; 1.01, 1.02...1.10,1.11,1.1101 ... 1.99,2.00.. ;; (declare (unit megatest-version)) |
Modified megatest.scm from [af8974dd23] to [f4be8baece].
︙ | |||
109 110 111 112 113 114 115 | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | + + + - + + + + | ;;(lambda params (apply rmt:send-receive params))) ;; make send-receive available to rmtmod via parameter ;; load the ~/.megatestrc file, put (use trace)(trace-call-sites #t)(trace function-you-want-to-trace) in this file ;; (let ((debugcontrolf (conc (get-environment-variable "HOME") "/.megatestrc"))) (if (common:file-exists? debugcontrolf) (begin ;; for some reason, debug:print does not work here. Had to use print. (print (conc "WARNING: loading " debugcontrolf)) |
︙ | |||
255 256 257 258 259 260 261 | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | + - + | -mark-incompletes : find and mark incomplete tests -ping run-id|host:port : ping server, exit with 0 if found -debug N|N,M,O... : enable debug 0-N or N and M and O ... -debug-noprop N|M,M,O...: enable debug but do not propagate to subprocesses via MT_DEBUG -config fname : override the megatest.config file with fname -append-config fname : append fname to the megatest.config file -import-sexpr fname : import a sexpr file (use -list-runs % -dumpmode sexpr to create) -regen-testfiles : regenerate scripts and logpro files from testconfig, run in test context |
︙ | |||
464 465 466 467 468 469 470 471 472 473 474 475 476 477 | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | + | "-run-wait" ;; wait on a run to complete (i.e. no RUNNING) "-one-pass" ;; "-local" ;; run some commands using local db access "-generate-html" "-generate-html-structure" "-list-run-time" "-list-test-time" "-regen-testfiles" ;; misc queries "-list-disks" "-list-targets" "-list-db-targets" "-show-runconfig" "-show-config" |
︙ | |||
997 998 999 1000 1001 1002 1003 | 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 | - - - | (ttdat (make-tt areapath: *toppath*)) ) (format #t fmtstr "DB" "host:port" "PID" "age" "last mod" "state") (for-each (lambda (dbfile) (let* ( (dbfname (conc (pathname-file dbfile) ".db")) |
︙ | |||
1026 1027 1028 1029 1030 1031 1032 | 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | - - - | ) (format #t fmtstr db (conc host ":" port) pid age last-mod state) ) ) sinfos ) ) |
︙ | |||
1077 1078 1079 1080 1081 1082 1083 | 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | - + | (age (seconds->hr-min-sec (- (current-seconds) (list-ref sinfo 2)))) (last-mod (seconds->string (list-ref sinfo 2))) (killed (system (conc "ssh " host " kill " pid " > /dev/null"))) (dummy2 (sleep 1)) (state (if (> (system (conc "ssh " host " ps " pid " > /dev/null")) 0) "dead" "alive")) ) (format #t fmtstr db (conc host ":" port) pid age last-mod state) |
︙ | |||
2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 | 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 | + + + + + + + + + + + + + + + | (let* ((db #f) ;; DO NOT run remote (paths (tests:test-get-paths-matching keys target (args:get-arg "-test-files")))) (for-each (lambda (path) (print path)) paths)))))) ;;====================================================================== ;; Utils for test areas ;;====================================================================== (if (args:get-arg "-regen-testfiles") (if (getenv "MT_TEST_RUN_DIR") (begin (launch:setup) (change-directory (getenv "MT_TEST_RUN_DIR")) (let* ((testname (getenv "MT_TEST_NAME")) (itempath (getenv "MT_ITEMPATH"))) (launch:extract-scripts-logpro (getenv "MT_TEST_RUN_DIR") testname itempath #f)) (set! *didsomething* #t)) (debug:print 0 *default-log-port* "ERROR: Must run -regen-testfiles in a test environment (i.e. test xterm from dashboard)"))) ;;====================================================================== ;; Archive tests ;;====================================================================== ;; Archive tests matching target, runname, and testpatt (if (equal? (args:get-arg "-archive") "replicate-db") (begin ;; check if source |
︙ |
Modified mtargs/mtargs.scm from [09e4f74c98] to [c1d2bd2b3a].
︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | + | (module mtargs ( arg-hash get-arg get-arg-number get-arg-from remove-arg-from-ht get-args usage print-args any-defined? ) (import scheme) ;; gives us cond-expand in chicken-4 |
︙ | |||
62 63 64 65 66 67 68 69 70 71 72 73 74 75 | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | + + + + | ;; (define any any-defined?) (define (get-arg-from ht arg . default) (if (null? default) (hash-table-ref/default ht arg #f) (hash-table-ref/default ht arg (car default)))) (define (remove-arg-from-ht arg) (hash-table-delete! arg-hash arg) ) (define (get-args args params switches arg-hash num-needed) (let* ((numtargs (length args)) (adj-num-needed (if num-needed (+ num-needed 2) #f))) (if (< numtargs (if adj-num-needed adj-num-needed 2)) (if (>= num-needed 1) (usage "No arguments provided") |
︙ |
Modified portlogger.scm from [3334cefb6f] to [9754766f61].
︙ | |||
29 30 31 32 33 34 35 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - + + | (import srfi-1 posix srfi-69 hostinfo dot-locking z3 (srfi 18) extras s11n) (import (prefix sqlite3 sqlite3:)) (import debugprint dbmod) ;; lsof -i (define (portlogger:open-db fname) |
︙ |
Modified rmt.scm from [564930aec3] to [b6600b2d34].
︙ | |||
70 71 72 73 74 75 76 | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | - + - - - - - - - - - - - - - - - - - - - - - - - | (define *send-receive-mutex* (make-mutex)) ;; should have separate mutex per run-id ;; RA => e.g. usage (rmt:send-receive 'get-var #f (list varname)) ;; (define (rmt:send-receive cmd rid params #!key (attemptnum 1)(area-dat #f)) ;; start attemptnum at 1 so the modulo below works as expected (assert *toppath* "FATAL: rmt:send-receive called with *toppath* not set.") |
︙ |
Modified rmtmod.scm from [c4f748fe17] to [d2f108f299].
︙ | |||
85 86 87 88 89 90 91 | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | + + + - - - + + + - - + + + + + + + - - - + + + + + + + + + + + + | (define (rmt:import-run target run-dat) (let* ((runname (car run-dat)) (all-dat (cdr run-dat)) (tests-data (alist-ref "data" all-dat equal?)) (run-meta (alist-ref "meta" all-dat equal?)) (run-id (rmt:insert-run target runname run-meta))) (if (list? tests-data) (begin (debug:print 0 *default-log-port* "import-run: inserting " (length tests-data) " tests") |
︙ |
Modified runs.scm from [77337ff0b0] to [50ba01f6cc].
︙ | |||
2914 2915 2916 2917 2918 2919 2920 | 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 | - + | (lambda (key) (let* ((idx (cadr key)) (fld (car key)) (val (configf:lookup test-conf "test_meta" fld))) ;; (debug:print 5 *default-log-port* "idx: " idx " fld: " fld " val: " val) (if (and val (not (equal? (vector-ref currrecord idx) val))) (begin |
︙ |
Modified tcp-transportmod.scm from [cc561d90e9] to [27966bec9e].
︙ | |||
127 128 129 130 131 132 133 | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | + + + + + + - + + + + + + + + + + + + + + + + + + + + + - + - + | (equal? (dbfile:run-id->dbfname run-id) dbfname))) (tcp-buffer-size 2048) ;; (max-connections 4096) ;; do all the busy work of finding and setting up conn for ;; connecting to a server ;; This function, `tt:client-connect-to-server`, is designed to manage connections between a client and a server within a testing framework. ;; The function takes four arguments: ;; 1. `ttdat`: a data structure that holds information about the testing environment or connections. ;; 2. `dbfname`: The name of the database file that the client wants to connect to. ;; 3. `run-id`: An identifier for the current run of the test suite. ;; 4. `testsuite`: The test suite that is being run. |
︙ | |||
187 188 189 190 191 192 193 | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | - + | (tt:client-connect-to-server ttdat dbfname run-id testsuite))))))) (else ;; no good server found, if haven't started server in > 5 secs, start another (if (> (- (current-seconds) (tt-last-serv-start ttdat)) 3) ;; BUG - grow this number really do not want to swamp the machine with servers (begin (debug:print-info 0 *default-log-port* "Starting server for "dbfname) (server-start-proc) (tt-last-serv-start-set! ttdat (current-seconds)) |
︙ | |||
230 231 232 233 234 235 236 237 238 239 240 241 242 243 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | + | ;; client side handler ;; ;;(tt:handler #<tt> get-keys #f () 2 #f "/home/matt/data/megatest/ext-tests" #f "main.db" "ext-tests" "/home/matt/data/megatest/bin/.22.04/../megatest") ;; (define (tt:handler ttdat cmd run-id params attemptnum area-dat areapath readonly-mode dbfname testsuite mtexe) (debug:print 2 *default-log-port* "tt:handler cmd: " cmd " run-id: " run-id " attemptnum: " attemptnum) ;; NOTE: areapath is passed in and in tt struct. We'll use passed in value for now. ;; connect-to-server will start a server if needed. (let* ((conn (tt:client-connect-to-server ttdat dbfname run-id testsuite))) ;; (hash-table-ref/default (tt-conns ttdat) dbfname #f))) (if conn ;; have connection, call the server (let* ((res (tt:send-receive ttdat conn cmd run-id params))) ;; res is (status errmsg result meta) ; (debug:print 0 *default-log-port* "conn:" conn " res: " res) (match res |
︙ | |||
258 259 260 261 262 263 264 | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | - + | ((loaded) (debug:print 0 *default-log-port* "WARNING: server for "dbfname" is loaded, slowing queries.") (tt:backoff-incr (tt-conn-host conn)(tt-conn-port conn)) result) ;; (tt:handler ttdat cmd run-id params (+ attemptnum 1) area-dat areapath readonly-mode dbfname testsuite mtexe)) (else result))) (else ;; did not receive properly formated result |
︙ | |||
291 292 293 294 295 296 297 | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | - + | ;; start server - addressed in client-connect-to-server ;; delay - addressed in client-connect-to-server ;; try again (thread-sleep! 0.25) ;; dunno, I think this needs to be here (tt:handler ttdat cmd run-id params (+ attemptnum 1) area-dat areapath readonly-mode dbfname testsuite mtexe)) )))) (begin ;; no server file, delay and try again |
︙ | |||
474 475 476 477 478 479 480 | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 | + - + | (define (tt:start-server areapath run-id dbfname-in handler keys) (assert areapath "FATAL: areapath not provided for tt:start-server") ;; is there already a server for this dbfile? Then exit. (debug:print 2 *default-log-port* "tt:start-server: " dbfname-in) (let* ((ttdat (make-tt areapath: areapath)) (dbfname (or dbfname-in (dbmod:run-id->dbfname run-id))) (servers (tt:find-server areapath dbfname))) ;; should use tt:get-current-server-info instead (debug:print 0 *default-log-port* "Found " (length servers) " already running for " dbfname) |
︙ | |||
533 534 535 536 537 538 539 | 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | - + - - + | (nosyncdbpath (conc areapath"/.mtdb")) (cleanup (lambda () (if (tt-cleanup-proc ttdat) ((tt-cleanup-proc ttdat))) (dbfile:with-no-sync-db nosyncdbpath (lambda (db) (let* ((dbtmpname (dbr:dbstruct-dbtmpname dbstruct))) |
︙ | |||
583 584 585 586 587 588 589 590 591 592 593 594 595 596 | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | + | (debug:print 0 *default-log-port* "Failed to get server lock for "dbfname) #f)))))) (if (and res (common:low-noise-print 120 "top server message")) (debug:print-info 0 *default-log-port* "Keep running, I'm the top server for " dbfname" on "(tt-host ttdat)":"(tt-port ttdat))) res)) (else ;; wrong servinfo file (debug:print-info 0 *default-log-port* "I'm not the lead server: "servers) (let* ((leadsrv (car servers))) (match leadsrv ((host port startseconds server-id pid dbfname servinfofile) (let* ((result (tt:timed-ping host port server-id)) (res (car result)) (ping (cdr result))) |
︙ | |||
711 712 713 714 715 716 717 | 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 | - - + + + + + + + + + + + + + + + + + + + + + - - - + - - | ;; find valid server ;; get servers listed, last part of name must match :<dbfname> ;; if more than one, wait one second and look again ;; future: ping oldest, if alive remove other :<dbfname> files ;; (define (tt:find-server areapath dbfname) (let* ((servdir (tt:get-servinfo-dir areapath)) |
︙ | |||
882 883 884 885 886 887 888 | 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | + + - + + + | (handle-exceptions exn (if (< port 65535) (begin (portlogger:open-run-close portlogger:set-failed port) (thread-sleep! 0.25) (setup-listener-portlogger uconn)) (begin (assert #t "setup-listener-portlogger: could not get a port") |
︙ |
Modified tests.scm from [6fa611f761] to [f734d44190].
︙ | |||
146 147 148 149 150 151 152 | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | - + + + | (string-split global-waitons) '()))) ;; return items given config ;; (define (tests:get-items tconfig) (let ((items (hash-table-ref/default tconfig "items" #f)) ;; items 4 |
︙ | |||
1636 1637 1638 1639 1640 1641 1642 | 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 | - + | (if (and tcfg cache-file) (hash-table-set! tcfg "have fulldata" #t)) ;; mark this as fully read data (if tcfg (hash-table-set! *testconfigs* test-full-name tcfg)) (if (and testexists cache-file (file-write-access? cache-path) allow-write-cache) (let ((tpath (conc cache-path "/.testconfig"))) |
︙ |