Overview
Comment: | wip |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.70-ck5 |
Files: | files | file ages | folders |
SHA1: |
5ff7f6426732bfd189f3729681dda989 |
User & Date: | matt on 2022-09-04 20:10:43 |
Other Links: | branch diff | manifest | tags |
Context
2022-09-04
| ||
20:11 | Merging forward. Leaf check-in: d64a152659 user: matt tags: v1.70-ck5-round2 | |
20:10 | wip Leaf check-in: 5ff7f64267 user: matt tags: v1.70-ck5 | |
19:34 | blind merge from latest v1.70 check-in: 9154f466d1 user: matt tags: v1.70-ck5 | |
Changes
Modified Makefile from [80400e1e5d] to [6b16366d18].
︙ | ︙ | |||
32 33 34 35 36 37 38 39 40 | # cgisetup/models/pgdb.scm all : $(PREFIX)/bin/.$(ARCHSTR) mtest dboard mtut tcmt # module source files MSRCFILES = dbmod.scm dbfile.scm debugprint.scm mtargs.scm commonmod.scm \ ducttape-lib.scm pkts.scm dbi.scm autoload.scm stml2.scm # dbmod.import.o is just a hack here mofiles/dbfile.o : mofiles/debugprint.o dbmod.import.o | > | > > > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | # cgisetup/models/pgdb.scm all : $(PREFIX)/bin/.$(ARCHSTR) mtest dboard mtut tcmt # module source files MSRCFILES = dbmod.scm dbfile.scm debugprint.scm mtargs.scm commonmod.scm \ ducttape-lib.scm pkts.scm dbi.scm autoload.scm stml2.scm # dbmod.import.o is just a hack here mofiles/dbfile.o : mofiles/debugprint.o dbmod.import.o mofiles/debugprint.o : mofiles/margs.o # common.o : mofiles/margs.o # ftail.scm rmtmod.scm commonmod.scm removed # MSRCFILES = ducttape-lib.scm pkts.scm stml2.scm cookie.scm mutils.scm \ # mtargs.scm commonmod.scm dbmod.scm adjutant.scm ulex.scm \ # rmtmod.scm apimod.scm GUISRCF = dashboard-context-menu.scm dashboard-tests.scm \ |
︙ | ︙ |
Modified common.scm from [a6a75b4dc8] to [550380943a].
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ;;====================================================================== (declare (unit common)) (declare (uses commonmod)) (declare (uses pkts)) (declare (uses dbi)) (import srfi-1 srfi-69 ;; data-structures posix regex-case (prefix base64 base64:) chicken.condition | > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ;;====================================================================== (declare (unit common)) (declare (uses commonmod)) (declare (uses pkts)) (declare (uses dbi)) (declare (uses margs)) (import srfi-1 srfi-69 ;; data-structures posix regex-case (prefix base64 base64:) chicken.condition |
︙ | ︙ | |||
62 63 64 65 66 67 68 69 70 71 72 73 74 75 | system-information ;; extras ;; tcp (prefix nanomsg nmsg:) (prefix sqlite3 sqlite3:) pkts (prefix dbi dbi:) ) ;; (import posix-extras pathname-expand files) (import commonmod) (include "common_records.scm") | > | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | system-information ;; extras ;; tcp (prefix nanomsg nmsg:) (prefix sqlite3 sqlite3:) pkts (prefix dbi dbi:) margs ) ;; (import posix-extras pathname-expand files) (import commonmod) (include "common_records.scm") |
︙ | ︙ | |||
252 253 254 255 256 257 258 259 260 261 262 263 264 265 | (let ((resolve-pathname-broken? (or (> chicken-release-number 4) (and (eq? 4 chicken-release-number) (> chicken-major-version 9))))) (if resolve-pathname-broken? (define ##sys#expand-home-path pathname-expand)))) ;; (define (realpath x) (resolve-pathname (pathname-expand (or x "/dev/null")) )) (define (common:get-this-exe-fullpath #!key (argv (argv))) (let* ((this-script (cond ((and (> (length argv) 2) (string-match "^(.*/csi|csi)$" (car argv)) (string-match "^-(s|ss|sx|script)$" (cadr argv))) | > | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | (let ((resolve-pathname-broken? (or (> chicken-release-number 4) (and (eq? 4 chicken-release-number) (> chicken-major-version 9))))) (if resolve-pathname-broken? (define ##sys#expand-home-path pathname-expand)))) ;; (define (realpath x) (resolve-pathname (pathname-expand (or x "/dev/null")) )) (define (realpath x)(with-input-from-pipe (conc "realpath \""x"\"") read-line)) (define (common:get-this-exe-fullpath #!key (argv (argv))) (let* ((this-script (cond ((and (> (length argv) 2) (string-match "^(.*/csi|csi)$" (car argv)) (string-match "^-(s|ss|sx|script)$" (cadr argv))) |
︙ | ︙ | |||
341 342 343 344 345 346 347 | ((abort) "ABORT") ((skip) "SKIP") (else "FAIL"))) (define (common:logpro-exit-code->test-status exit-code) (status-sym->string (common:logpro-exit-code->status-sym exit-code))) | < < < < < < < < < < < < < < | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | ((abort) "ABORT") ((skip) "SKIP") (else "FAIL"))) (define (common:logpro-exit-code->test-status exit-code) (status-sym->string (common:logpro-exit-code->status-sym exit-code))) ;; launching and hosts (defstruct host (reachable #f) (last-update 0) (last-used 0) (last-cpuload 1)) |
︙ | ︙ | |||
408 409 410 411 412 413 414 | (define (common:get-full-version) (conc megatest-version "-" megatest-fossil-hash)) (define (common:version-signature) (conc megatest-version "-" (substring megatest-fossil-hash 0 4))) | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | (define (common:get-full-version) (conc megatest-version "-" megatest-fossil-hash)) (define (common:version-signature) (conc megatest-version "-" (substring megatest-fossil-hash 0 4))) (define (common:snapshot-file filepath #!key (subdir ".") ) (if (file-exists? filepath) (let* ((age-sec (lambda (file) (if (file-exists? file) (- (current-seconds) (file-modification-time file)) 1000000000))) ;; return really old value if file doesn't exist. we want to clobber it if old or not exist. (ok-flag #t) |
︙ | ︙ | |||
733 734 735 736 737 738 739 | (if dat dat "")))) (define (common:alist-ref/default key alist default) (or (alist-ref key alist) default)) | | | | | | | | | | | 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | (if dat dat "")))) (define (common:alist-ref/default key alist default) (or (alist-ref key alist) default)) ;; (define (common:low-noise-print waitval . keys) ;; (let* ((key (string-intersperse (map conc keys) "-" )) ;; (lasttime (hash-table-ref/default *common:denoise* key 0)) ;; (currtime (current-seconds))) ;; (if (> (- currtime lasttime) waitval) ;; (begin ;; (hash-table-set! *common:denoise* key currtime) ;; #t) ;; #f))) (define (common:get-megatest-exe) (or (getenv "MT_MEGATEST") "megatest")) (define (common:read-encoded-string instr) (handle-exceptions exn |
︙ | ︙ | |||
3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 | exn (begin (debug:print 0 *default-log-port* "joining threads failed. exn=" exn) #t) ;; just ignore it, it might have died in the meantime so joining it will throw an exception (thread-join! thread)) ))) (hash-table-keys *common:thread-punchlist*))) ;;====================================================================== ;; (define *common:telemetry-log-state* 'startup) ;; (define *common:telemetry-log-socket* #f) ;; ;; (define (common:telemetry-log-open) ;; (if (eq? *common:telemetry-log-state* 'startup) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 | exn (begin (debug:print 0 *default-log-port* "joining threads failed. exn=" exn) #t) ;; just ignore it, it might have died in the meantime so joining it will throw an exception (thread-join! thread)) ))) (hash-table-keys *common:thread-punchlist*))) ;;====================================================================== ;; L O G G I N G D B ;;====================================================================== (define (open-logging-db) (let* ((dbpath (conc (if *toppath* (conc *toppath* "/") "") "logging.db")) ;; fname) (dbexists (common:file-exists? dbpath)) (db (sqlite3:open-database dbpath)) (handler (sqlite3:make-busy-timeout (if (args:get-arg "-override-timeout") (string->number (args:get-arg "-override-timeout")) 136000)))) ;; 136000))) (sqlite3:set-busy-handler! db handler) (if (not dbexists) (begin (sqlite3:execute db "CREATE TABLE IF NOT EXISTS log (id INTEGER PRIMARY KEY,event_time TIMESTAMP DEFAULT (strftime('%s','now')),logline TEXT,pwd TEXT,cmdline TEXT,pid INTEGER);") (db:set-sync db) ;; (sqlite3:execute db (conc "PRAGMA synchronous = 0;")) )) db)) (define (db:log-local-event . loglst) (let ((logline (apply conc loglst))) (db:log-event logline))) (define (db:log-event logline) (let ((db (open-logging-db))) (sqlite3:execute db "INSERT INTO log (logline,pwd,cmdline,pid) VALUES (?,?,?,?);" logline (current-directory) (string-intersperse (argv) " ") (current-process-id)) (sqlite3:finalize! db) logline)) ;;====================================================================== ;; (define *common:telemetry-log-state* 'startup) ;; (define *common:telemetry-log-socket* #f) ;; ;; (define (common:telemetry-log-open) ;; (if (eq? *common:telemetry-log-state* 'startup) |
︙ | ︙ |
Modified db.scm from [d40c895261] to [17efeee69b].
︙ | ︙ | |||
1286 1287 1288 1289 1290 1291 1292 | ;; (define (db:archive-allocate-testsuite/area-to-block block-id testsuite-name areakey) ;; (let* ((dbdat (db:get-subdb dbstruct #f)) ;; archive tables are in main.db ;; (db (dbr:dbdat-dbh dbdat)) ;; (res '()) ;; (blocks '())) ;; a block is an archive chunck that can be added too if there is space ;; (sqlite3:for-each-row #f) | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 | ;; (define (db:archive-allocate-testsuite/area-to-block block-id testsuite-name areakey) ;; (let* ((dbdat (db:get-subdb dbstruct #f)) ;; archive tables are in main.db ;; (db (dbr:dbdat-dbh dbdat)) ;; (res '()) ;; (blocks '())) ;; a block is an archive chunck that can be added too if there is space ;; (sqlite3:for-each-row #f) ;;====================================================================== ;; D B U T I L S ;;====================================================================== ;;====================================================================== ;; M A I N T E N A N C E ;;====================================================================== |
︙ | ︙ | |||
5064 5065 5066 5067 5068 5069 5070 | (thread-start! th2) (thread-join! th1) ) ) 0) | > > > > > > > > > > > > > > > > | 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 | (thread-start! th2) (thread-join! th1) ) ) 0) ;; PULLED FROM COMMON ;;====================================================================== ;; (define (common:cleanup-db dbstruct #!key (full #f)) (apply db:multi-db-sync dbstruct 'schema 'killservers 'adj-target 'new2old '(dejunk) ) (if (common:api-changed?) (common:set-last-run-version))) |
Modified dbfile.scm from [0d9d222998] to [30042eb60c].
︙ | ︙ | |||
15 16 17 18 19 20 21 | ;; ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;;====================================================================== (declare (unit dbfile)) | | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ;; ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. ;;====================================================================== (declare (unit dbfile)) (declare (uses debugprint)) (declare (uses commonmod)) (module dbfile * (import scheme chicken.base chicken.condition chicken.file chicken.file.posix chicken.io chicken.pathname chicken.port chicken.process chicken.process-context.posix chicken.sort chicken.time chicken.string |
︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 64 | srfi-69 stack system-information ;; files ;; ports commonmod ) ;; (import debugprint) ;;====================================================================== ;; R E C O R D S ;;====================================================================== | > | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | srfi-69 stack system-information ;; files ;; ports commonmod debugprint ) ;; (import debugprint) ;;====================================================================== ;; R E C O R D S ;;====================================================================== |
︙ | ︙ | |||
484 485 486 487 488 489 490 | ) (dbfile:print-err " db, " (dbr:dbdat-dbfile tmpdb) " already exists or fresh enough, not propogating data from\n " (dbr:dbdat-dbfile mtdb) " mod time delta: " modtimedelta) ) ;; (db:multi-db-sync subdb 'old2new)) ;; migrate data from megatest.db automatically tmpdb)) (define (dbfile:cautious-open-database fname init-proc #!optional (tries-left 50)) | < | | | | | | | | | | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | ) (dbfile:print-err " db, " (dbr:dbdat-dbfile tmpdb) " already exists or fresh enough, not propogating data from\n " (dbr:dbdat-dbfile mtdb) " mod time delta: " modtimedelta) ) ;; (db:multi-db-sync subdb 'old2new)) ;; migrate data from megatest.db automatically tmpdb)) (define (dbfile:cautious-open-database fname init-proc #!optional (tries-left 50)) (let* ((busy-file (conc fname"-journal")) (delay-time (* (- 51 tries-left) 1.1)) (write-access (file-writable? fname)) (dir-access (file-writable? (pathname-directory fname))) (retry (lambda () (thread-sleep! delay-time) (if (> tries-left 0) (dbfile:cautious-open-database fname init-proc (- tries-left 1)))))) (assert (>= tries-left 0) (conc "FATAL: too many attempts in dbfile:cautious-open-database of "fname", giving up.")) (if (and (file-writable? fname) (file-exists? busy-file)) (begin (dbfile:print-err "INFO: dbfile:cautious-open-database: journal file " busy-file " exists, trying again in few seconds.") (thread-sleep! 1) (if (eq? tries-left 2) (begin (dbfile:print-err "INFO: forcing journal rollup "busy-file) |
︙ | ︙ | |||
540 541 542 543 544 545 546 | (retry)) (exn (permission)(dbfile:print-err exn "ERROR: database " fname " has some permissions problem.") (retry)) (exn () (dbfile:print-err exn "ERROR: Unknown error with database " fname " message: " ((condition-property-accessor 'exn 'message) exn)) (retry))))) | | | | 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | (retry)) (exn (permission)(dbfile:print-err exn "ERROR: database " fname " has some permissions problem.") (retry)) (exn () (dbfile:print-err exn "ERROR: Unknown error with database " fname " message: " ((condition-property-accessor 'exn 'message) exn)) (retry))))) #;(if (file-writable? fname) (dbfile:simple-file-release-lock lock-file)) result)))) (define (dbfile:brute-force-salvage-db fname) (let* ((backupfname (conc fname"-"(current-process-id)".bak")) (cmd (conc "cp "fname" "backupfname";mv "fname" "(conc fname ".delme;") "cp "backupfname" "fname))) (dbfile:print-err "WARNING: attempting recovery of file "fname" by running commands:\n" " "cmd) (system cmd))) #;(define (dbfile:cautious-open-database-orig fname init-proc #!optional (tries-left 50)) (let* ((lock-file (conc fname".lock")) (delay-time (* (- 51 tries-left) 1.1)) (retry (lambda () (thread-sleep! delay-time) (if (> tries-left 0) (dbfile:cautious-open-database fname init-proc (- tries-left 1)))))) (assert (>= tries-left 0) (conc "FATAL: too many attempts in dbfile:cautious-open-database of "fname", giving up.")) (if (and (file-writable? fname) (not (dbfile:simple-file-lock lock-file expire-time: 3))) (begin (dbfile:print-err "INFO: dbfile:cautious-open-database: lock file " lock-file " exists, trying again in few seconds.") (thread-sleep! 1) (if (eq? tries-left 2) (begin (dbfile:print-err "INFO: stealing the lock "lock-file) (delete-file* lock-file))) |
︙ | ︙ | |||
591 592 593 594 595 596 597 | (retry)) (exn (permission)(dbfile:print-err exn "ERROR: database " fname " has some permissions problem.") (retry)) (exn () (dbfile:print-err exn "ERROR: Unknown error with database " fname " message: " ((condition-property-accessor 'exn 'message) exn)) (retry))))) | | | 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | (retry)) (exn (permission)(dbfile:print-err exn "ERROR: database " fname " has some permissions problem.") (retry)) (exn () (dbfile:print-err exn "ERROR: Unknown error with database " fname " message: " ((condition-property-accessor 'exn 'message) exn)) (retry))))) (if (file-writable? fname) (dbfile:simple-file-release-lock lock-file) ) result)))) (define (dbfile:open-no-sync-db dbpath) (if *no-sync-db* |
︙ | ︙ |
Modified margs.scm from [af7404c1e8] to [30af224846].
︙ | ︙ | |||
15 16 17 18 19 20 21 | ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. (declare (unit margs)) ;; (declare (uses common)) | > > > > > > | | | | > > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see <http://www.gnu.org/licenses/>. (declare (unit margs)) ;; (declare (uses common)) (module margs * (import scheme chicken.base chicken.process-context srfi-1 srfi-69 ) (define help #f) (define args:arg-hash (make-hash-table)) (define (args:get-arg arg . default) (if (null? default) (hash-table-ref/default args:arg-hash arg #f) (hash-table-ref/default args:arg-hash arg (car default)))) |
︙ | ︙ | |||
92 93 94 95 96 97 98 | )) (define (args:print-args remargs arg-hash) (print "ARGS: " remargs) (for-each (lambda (arg) (print " " arg " " (hash-table-ref/default arg-hash arg #f))) (hash-table-keys arg-hash))) | > | 101 102 103 104 105 106 107 108 | )) (define (args:print-args remargs arg-hash) (print "ARGS: " remargs) (for-each (lambda (arg) (print " " arg " " (hash-table-ref/default arg-hash arg #f))) (hash-table-keys arg-hash))) ) |
Modified rmt.scm from [7bc7d08cca] to [90ab15c6f3].
︙ | ︙ | |||
1104 1105 1106 1107 1108 1109 1110 | res)) ;; All good, return res #;(set-functions rmt:send-receive remote-server-url-set! http-transport:close-connections remote-conndat-set! debug:print debug:print-info remote-ro-mode remote-ro-mode-set! remote-ro-mode-checked-set! remote-ro-mode-checked) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | res)) ;; All good, return res #;(set-functions rmt:send-receive remote-server-url-set! http-transport:close-connections remote-conndat-set! debug:print debug:print-info remote-ro-mode remote-ro-mode-set! remote-ro-mode-checked-set! remote-ro-mode-checked) ;; PULLED FROM COMMON ;;====================================================================== ;; from metadat lookup MEGATEST_VERSION ;; (define (common:get-last-run-version) ;; RADT => How does this work in send-receive function??; assume it is the value saved in some DB (rmt:get-var "MEGATEST_VERSION")) (define (common:get-last-run-version-number) (string->number (substring (common:get-last-run-version) 0 6))) (define (common:set-last-run-version) (rmt:set-var "MEGATEST_VERSION" (common:version-signature))) ;;====================================================================== ;; postive number if megatest version > db version ;; negative number if megatest version < db version (define (common:version-db-delta) (- megatest-version (common:get-last-run-version-number))) (define (common:version-changed?) (not (equal? (common:get-last-run-version) (common:version-signature)))) (define (common:api-changed?) (not (equal? (substring (->string megatest-version) 0 4) (substring (conc (common:get-last-run-version)) 0 4)))) |
Modified server.scm from [353b73963b] to [450285aad6].
︙ | ︙ | |||
63 64 65 66 67 68 69 70 71 72 73 74 75 76 | ;; (declare (uses daemon)) (import commonmod) (include "common_records.scm") (include "db_records.scm") (define (server:make-server-url hostport) (if (not hostport) #f (conc "http://" (car hostport) ":" (cadr hostport)))) (define *server-loop-heart-beat* (current-seconds)) | > > > > > > > > > > > > > > | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | ;; (declare (uses daemon)) (import commonmod) (include "common_records.scm") (include "db_records.scm") (defstruct remote (hh-dat (common:get-homehost)) ;; homehost record ( addr . hhflag ) (server-url #f) ;; (server:check-if-running *toppath*) #f)) (server-id #f) (server-info (if *toppath* (server:check-if-running *toppath*) #f)) (last-server-check 0) ;; last time we checked to see if the server was alive (connect-time (current-seconds)) (conndat #f) (transport *transport-type*) (server-timeout (server:expiration-timeout)) (force-server #f) (ro-mode #f) (ro-mode-checked #f)) ;; flag that indicates we have checked for ro-mode (define (server:make-server-url hostport) (if (not hostport) #f (conc "http://" (car hostport) ":" (cadr hostport)))) (define *server-loop-heart-beat* (current-seconds)) |
︙ | ︙ |