Megatest

Diff
Login

Differences From Artifact [8e862aec17]:

To Artifact [1840503be8]:


12
13
14
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
44
45
46
47
48
49
50
51
52
53
54
55
56







































57
58
59
60
61
62
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
91
92
93
94
95
96
97
98
99
100
12
13
14
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
44



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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
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







-
-
+
+
+
+
+



+

-
+
-
-
-
-
+
+
+
-
-
-
+
-
-
-
+
+
-

-
-
+
+
+
-
-
-
-
-
-
-
-
-





-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+













+
+
+
+
-
-
-
+
+
+
+
+
+

-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+









-
-
-
-
-
-
-
-







;;     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;     GNU General Public License for more details.
;; 
;;     You should have received a copy of the GNU General Public License
;;     along with Megatest.  If not, see <http://www.gnu.org/licenses/>.
;;

;; (include "common.scm")
(include "megatest-version.scm")
(use (prefix sqlite3 sqlite3:)
     srfi-1 posix regex regex-case
     srfi-69 (prefix base64 base64:) apropos json http-client
     directory-utils typed-records http-client srfi-18 extras format
     sparse-vectors)

;; fake out readline usage of toplevel-command
(define (toplevel-command . a) #f)
(use readline)

(declare (uses common))
(declare (uses margsmod))
;; (declare (uses megatest-version))
(declare (uses margs))
(declare (uses runs))
(declare (uses launch))
(import margsmod)
(declare (uses margsmod.import))

(declare (uses server))
(declare (uses client))
(declare (uses tests))
(declare (uses debugprint))
(declare (uses genexample))
;; (declare (uses daemon))
(declare (uses db))
(import debugprint)
(declare (uses debugprint.import))
;; (declare (uses dcommon))

(declare (uses tdb))
(declare (uses mt))
(declare (uses configfmod))
(import configfmod)
(declare (uses configfmod.import))
(declare (uses api))
(declare (uses tasks)) ;; only used for debugging.
(declare (uses env))
(declare (uses diff-report))
;; (declare (uses ftail))
;; (import ftail)

;; Needed for repl even if not used here in megatest.scm
;; ORDER MATTERS!

(declare (uses commonmod))
(import commonmod)
(declare (uses commonmod.import))

(declare (uses configfmod))
(import configfmod)
(declare (uses configfmod.import))
(declare (uses items))
(import items)
(declare (uses items.import))

(declare (uses ods))
(import ods)
(declare (uses ods.import))

(declare (uses dbmod))
(import dbmod)
(declare (uses dbmod.import))

(declare (uses pgdb))
(import pgdb)
(declare (uses pgdb.import))

(declare (uses tasks)) ;; only used for debugging.
(import tasks)
(declare (uses tasks.import))

(declare (uses apimod))
(import apimod)
(declare (uses apimod.import))

(declare (uses portlogger))
(import portlogger)
(declare (uses portlogger.import))

(declare (uses tdb))
(import tdb)
(declare (uses tdb.import))

(declare (uses rmtmod))
(import rmtmod)
(declare (uses rmtmod.import))

(declare (uses client))
(import client)
(declare (uses client.import))

(declare (uses ods))
(import ods)
(declare (uses ods.import))

(declare (uses dbmod))
(import dbmod)
(declare (uses dbmod.import))

(declare (uses servermod))
(import servermod)
(declare (uses servermod.import))


;; (include "common.scm")
(include "megatest-version.scm")

(declare (uses apimod))
(import apimod)
(declare (uses apimod.import))
(declare (uses common))
;; (declare (uses megatest-version))

(declare (uses runs))
(declare (uses launch))
(declare (uses server))

(declare (uses rmtmod))
(import rmtmod)
(declare (uses rmtmod.import))
(declare (uses tests))
(declare (uses genexample))
(declare (uses db))

(declare (uses tdb))
(declare (uses mt))

(declare (uses env))
(declare (uses diff-report))

;; Needed for repl even if not used here in megatest.scm
;; ORDER MATTERS!


(define *db* #f) ;; this is only for the repl, do not use in general!!!!

(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:)
     readline apropos json http-client directory-utils typed-records
     http-client srfi-18 extras format)

;; Added for csv stuff - will be removed
;;
(use sparse-vectors)

(require-library mutils)

(define *usage-log-file* #f)    ;; put path to file for logging usage in this var in the ~/.megatestrc file
(define *usage-use-seconds* #t) ;; for Epoc seconds in usage logging change this to #t in ~/.megatestrc file

;; load the ~/.megatestrc file, put (use trace)(trace-call-sites #t)(trace function-you-want-to-trace) in this file
;;
521
522
523
524
525
526
527
528

529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
557
558
559
560
561
562
563

564










565
566
567
568
569
570
571







-
+
-
-
-
-
-
-
-
-
-
-







;; immediately set MT_TARGET if -reqtarg or -target are available
;;
(let ((targ (or (args:get-arg "-reqtarg")(args:get-arg "-target"))))
  (if targ (setenv "MT_TARGET" targ)))

;; The watchdog is to keep an eye on things like db sync etc.
;;

;; moved to commonmod
;; TODO: for multiple areas, we will have multiple watchdogs; and multiple threads to manage
(define *watchdog* (make-thread
		    (lambda ()
		      (handle-exceptions
			  exn
			  (begin
			    (print-call-chain)
			    (print " message: " ((condition-property-accessor 'exn 'message) exn) ", exn=" exn))
			(common:watchdog)))
		    "Watchdog thread"))

;;(if (not (args:get-arg "-server"))
;;    (thread-start! *watchdog*)) ;; if starting a server; wait till we get to running state before kicking off watchdog
(let* ((no-watchdog-args
       '("-list-runs"
         "-testdata-csv"
         "-list-servers"