Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -29,11 +29,11 @@ CSCOPTS= INSTALL=install SRCFILES = launch.scm runconfig.scm \ server.scm configf.scm keys.scm \ process.scm runs.scm \ - tdb.scm mt.scm \ + mt.scm \ ezsteps.scm api.scm \ subrun.scm archive.scm env.scm # cgisetup/models/pgdb.scm @@ -43,11 +43,11 @@ configfmod.scm processmod.scm servermod.scm megatestmod.scm \ stml2.scm fsmod.scm cpumod.scm mtmod.scm odsmod.scm \ pkts.scm testsmod.scm pgdb.scm cookie.scm launchmod.scm \ subrunmod.scm runsmod.scm tasksmod.scm archivemod.scm \ ezstepsmod.scm mtbody.scm envmod.scm genexample.scm mutils.scm \ - diff-report.scm + diff-report.scm tdb.scm transport-mode.scm : transport-mode.scm.template cp transport-mode.scm.template transport-mode.scm dashboard-transport-mode.scm : dashboard-transport-mode.scm.template @@ -56,11 +56,11 @@ mtest : transport-mode.scm dboard : dashboard-transport-mode.scm # dbmod.import.o is just a hack here -mofiles/mtbody.o : mofiles/launchmod.o readline-fix.scm mofiles/envmod.o mofiles/genexample.o mofiles/mutils.o mofiles/diff-report.o +mofiles/mtbody.o : mofiles/launchmod.o readline-fix.scm mofiles/envmod.o mofiles/genexample.o mofiles/mutils.o mofiles/diff-report.o mofiles/tdb.o process.o : mofiles/processmod.o mofiles/configfmod.o : mofiles/processmod.o mofiles/processmod.o : mofiles/commonmod.o mofiles/servermod.o : mofiles/commonmod.o mofiles/rmtmod.o : mofiles/mtmod.o mofiles/apimod.o Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -17,13 +17,10 @@ ;; ;; (include "common.scm") ;; (include "megatest-version.scm") -;; fake out readline usage of toplevel-command -(define (toplevel-command . a) #f) - ;; (declare (uses common)) ;; (declare (uses megatest-version)) ;; (declare (uses margs)) (declare (uses mtargs)) (declare (uses mtargs.import)) @@ -86,8 +83,12 @@ (declare (uses launch)) (declare (uses server)) (declare (uses genexample)) (declare (uses mtbody)) +(import csi) +;; fake out readline usage of toplevel-command +(set! toplevel-command (lambda (a b) #f)) + (import mtbody) (main) Index: mtbody.scm ================================================================== --- mtbody.scm +++ mtbody.scm @@ -36,12 +36,14 @@ (declare (uses archivemod)) (declare (uses mutils)) (declare (uses odsmod)) (declare (uses testsmod)) (declare (uses diff-report)) +(declare (uses tdb)) -(use srfi-69 readline) +(use srfi-69) +(import csi) (module mtbody * (import scheme) @@ -61,11 +63,11 @@ md5 message-digest pathname-expand posix posix-extras - readline + ;; readline regex regex-case sparse-vectors srfi-1 srfi-18 @@ -116,11 +118,12 @@ debugprint ))) ;; imports common to chk5 and ck4 -(import srfi-13) +(import srfi-13 + csi) (import (prefix mtargs args:) archivemod debugprint dbmod @@ -147,25 +150,30 @@ genexample mutils odsmod testsmod diff-report + tdb ) (include "common_records.scm") (define *db* #f) ;; this is only for the repl, do not use in general!!!! + +;; (set! toplevel-command toplevel-command) ;; (include "common_records.scm") ;; (include "key_records.scm") ;; (include "db_records.scm") (include "run_records.scm") (include "megatest-fossil-hash.scm") -(use (prefix sqlite3 sqlite3:) srfi-1 posix regex regex-case srfi-69 (prefix base64 base64:)) -(use readline apropos json http-client directory-utils typed-records) -(use http-client srfi-18 extras format tcp-server tcp) +(import (prefix sqlite3 sqlite3:) srfi-1 posix regex regex-case srfi-69 (prefix base64 base64:)) +(import + ;; readline + apropos json http-client directory-utils typed-records) +(import http-client srfi-18 extras format tcp-server tcp) ;; Added for csv stuff - will be removed ;; (use sparse-vectors) @@ -2206,11 +2214,11 @@ target keys (or (args:get-arg "-runname")(args:get-arg ":runname") ) (args:get-arg "-lock") (args:get-arg "-unlock") - user)))) + (current-user-name))))) ;;====================================================================== ;; Get paths to tests ;;====================================================================== ;; Get test paths matching target, runname, and testpatt @@ -2607,11 +2615,11 @@ (let ((dbstructs (db:setup))) (common:cleanup-db dbstructs)) (set! *didsomething* #t))) - (if (args:get-arg "-mark-incompletes") + #;(if (args:get-arg "-mark-incompletes") (begin (if (not (launch:setup)) (begin (debug:print 0 *default-log-port* "Failed to setup, exiting") (exit 1))) @@ -2635,11 +2643,10 @@ ;; Start a repl ;;====================================================================== ;; fakeout readline (include "readline-fix.scm") - (when (args:get-arg "-diff-rep") (when (and (not (args:get-arg "-diff-html")) (not (args:get-arg "-diff-email"))) @@ -2678,26 +2685,28 @@ ;; export MT_RUNSCRIPT=yes ;; megatest << EOF ;; (print "Hello world") ;; (exit) ;; EOF - + (repl)) (else (begin + (define toplevel-command (lambda (a b)(print a " "b))) (set! *db* dbstructs) (import extras) ;; might not be needed ;; (import csi) - (import readline) + ;; (import readline) (import apropos) (import dbfile) + ;; (import (prefix sqlite3 sqlite3:)) ;; doesn't work ... (if *use-new-readline* (begin - (install-history-file (get-environment-variable "HOME") ".megatest_history") ;; [homedir] [filename] [nlines]) - (current-input-port (make-readline-port "megatest> "))) + #;(install-history-file (get-environment-variable "HOME") ".megatest_history") ;; [homedir] [filename] [nlines]) + #;(current-input-port (make-readline-port "megatest> "))) #;(begin (gnu-history-install-file-manager (string-append (or (get-environment-variable "HOME") ".") "/.megatest_history")) (current-input-port (make-gnu-readline-port "megatest> ")))) Index: rmtmod.scm ================================================================== --- rmtmod.scm +++ rmtmod.scm @@ -29,10 +29,11 @@ (declare (uses apimod)) (declare (uses servermod)) (module rmtmod ( + rmt:test-data-rollup rmt:import-sexpr rmt:read-test-data-varpatt rmt:get-run-status rmt:set-run-status @@ -282,18 +283,10 @@ (rmtmod:send-receive 'get-test-state-status-by-id run-id (list run-id test-id))) (define (rmt:test-get-rundir-from-test-id run-id test-id) (rmtmod:send-receive 'test-get-rundir-from-test-id run-id (list run-id test-id))) -;; (define (rmt:open-test-db-by-test-id run-id test-id #!key (work-area #f)) -;; (assert (number? run-id) "FATAL: Run id required.") -;; (let* ((test-path (if (string? work-area) -;; work-area -;; (rmt:test-get-rundir-from-test-id run-id test-id)))) -;; (debug:print 3 *default-log-port* "TEST PATH: " test-path) -;; (open-test-db test-path))) - ;; WARNING: This currently bypasses the transaction wrapped writes system (define (rmt:test-set-state-status-by-id run-id test-id newstate newstatus newcomment) (assert (number? run-id) "FATAL: Run id required.") (rmtmod:send-receive 'test-set-state-status-by-id run-id (list run-id test-id newstate newstatus newcomment))) Index: tdb.scm ================================================================== --- tdb.scm +++ tdb.scm @@ -1,6 +1,6 @@ -;;====================================================================== +>;;====================================================================== ;; Copyright 2006-2013, Matthew Welland. ;; ;; This file is part of Megatest. ;; ;; Megatest is free software: you can redistribute it and/or modify @@ -28,13 +28,24 @@ (declare (uses keys)) (declare (uses mt)) (declare (uses commonmod)) (declare (uses mtargs)) (declare (uses rmtmod)) + +(module tdb + * + +(import scheme + chicken + data-structures + ) (require-extension (srfi 18) extras tcp) -(use sqlite3 srfi-1 posix regex regex-case srfi-69 csv-xml s11n md5 message-digest base64) + +(import srfi-1 posix regex regex-case srfi-69 csv-xml s11n md5 + message-digest base64) + (import (prefix sqlite3 sqlite3:)) (import (prefix base64 base64:)) (import commonmod debugprint @@ -42,11 +53,11 @@ (prefix mtargs args:)) ;; (include "common_records.scm") ;; (include "db_records.scm") ;; (include "key_records.scm") -(include "run_records.scm") +;; (include "run_records.scm") ;;====================================================================== ;; ;; T E S T D A T A B A S E S ;; @@ -53,10 +64,19 @@ ;;====================================================================== ;;====================================================================== ;; T E S T S P E C I F I C D B ;;====================================================================== + +;; (define (rmt:open-test-db-by-test-id run-id test-id #!key (work-area #f)) +;; (assert (number? run-id) "FATAL: Run id required.") +;; (let* ((test-path (if (string? work-area) +;; work-area +;; (rmt:test-get-rundir-from-test-id run-id test-id)))) +;; (debug:print 3 *default-log-port* "TEST PATH: " test-path) +;; (open-test-db test-path))) + ;; =not-used= ;; Create the sqlite db for the individual test(s) ;; =not-used= ;; ;; =not-used= ;; Moved these tables into .db ;; =not-used= ;; THIS CODE TO BE REMOVED @@ -232,23 +252,23 @@ (loop (read-line))))) ;; roll up the current results. ;; FIXME: Add the status too (rmt:test-data-rollup run-id test-id #f)) -;; NOTE: Run this local with #f for db !!! -(define (tdb:load-logpro-data run-id test-id) - (let loop ((lin (read-line))) - (if (not (eof-object? lin)) - (begin - (debug:print 4 *default-log-port* lin) - ;;(when lin ;; this when blocked stack dump caused by .dat file from logpro being 0-byte. fixed by upgrading logpro - (rmt:csv->test-data run-id test-id lin) - ;;) - (loop (read-line))))) - ;; roll up the current results. - ;; FIXME: Add the status too - (rmt:test-data-rollup run-id test-id #f)) +;; ;; NOTE: Run this local with #f for db !!! +;; (define (tdb:load-logpro-data run-id test-id) +;; (let loop ((lin (read-line))) +;; (if (not (eof-object? lin)) +;; (begin +;; (debug:print 4 *default-log-port* lin) +;; ;;(when lin ;; this when blocked stack dump caused by .dat file from logpro being 0-byte. fixed by upgrading logpro +;; (rmt:csv->test-data run-id test-id lin) +;; ;;) +;; (loop (read-line))))) +;; ;; roll up the current results. +;; ;; FIXME: Add the status too +;; (rmt:test-data-rollup run-id test-id #f)) ;;====================================================================== ;; S T E P S ;;====================================================================== @@ -403,14 +423,16 @@ (conc (vector-ref b 2))) #f)) (string