;;======================================================================
;; Copyright 2019, Matthew Welland.
;;
;; This file is part of Megatest.
;;
;; Megatest is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; Megatest is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; 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/>.
;;======================================================================
(declare (unit megamod))
;; (declare (uses commonmod))
;; (declare (uses dbmod))
;; ;;(declare (uses apimod))
;; (declare (uses ftail))
;; ;; (declare (uses rmtmod))
;; (declare (uses commonmod))
;; (declare (uses apimod))
;; (declare (uses archivemod))
;; (declare (uses clientmod))
;; (declare (uses configfmod))
;; (declare (uses dbmod))
;; (declare (uses dcommonmod))
;; (declare (uses envmod))
;; (declare (uses ezstepsmod))
;; (declare (uses itemsmod))
;; (declare (uses keysmod))
;; (declare (uses launchmod))
;; (declare (uses odsmod))
;; (declare (uses processmod))
;; (declare (uses runconfigmod))
;; (declare (uses runsmod))
;; (declare (uses servermod))
;; (declare (uses subrunmod))
;; (declare (uses tasksmod))
;; (declare (uses testsmod))
;; (declare (uses vgmod))
(module megamod
*
(import scheme chicken data-structures extras)
(import
(prefix base64 base64:)
(prefix dbi dbi:)
(prefix nanomsg nmsg:)
(prefix sqlite3 sqlite3:)
call-with-environment-variables
canvas-draw
canvas-draw-iup
csv
csv-xml
data-structures
directory-utils
dot-locking
extras
files
fmt
format
hostinfo
http-client
intarweb
irregex
(prefix iup iup:)
matchable
md5
message-digest
pathname-expand
pkts
ports
posix
;; queue
regex
regex-case
s11n
sparse-vectors
spiffy
spiffy-directory-listing
spiffy-request-vars
sql-de-lite
srfi-1
srfi-4
srfi-13
srfi-18
srfi-69
stack
stml2
tcp
typed-records
udp
uri-common
z3
)
;; (import apimod)
;; (import archivemod)
;; (import clientmod)
;; (import commonmod)
;; (import configfmod)
;; (import dbmod)
;; (import dcommonmod)
;; (import envmod)
;; (import ezstepsmod)
;; (import ftail)
;; (import itemsmod)
;; (import keysmod)
;; (import launchmod)
;; (import odsmod)
;; (import processmod)
;; ;; (import rmtmod)
;; (import runconfigmod)
;; (import runsmod)
;; (import servermod)
;; (import subrunmod)
;; (import tasksmod)
;; (import testsmod)
;; (import vgmod)
(use (prefix ulex ulex:))
(include "common_records.scm")
(include "db_records.scm")
(include "key_records.scm")
(include "run_records.scm")
(include "task_records.scm")
(include "test_records.scm")
(include "vg_records.scm")
(include "js-path.scm")
;;======================================================================
;; L O C K I N G M E C H A N I S M S
;;======================================================================
(include "megatest-fossil-hash.scm")
(include "megatest-version.scm")
;; globals
(define *writes-total-delay* 0)
(define *exit-started* #f)
(define *tim* (iup:timer))
;; The watchdog is to keep an eye on things like db sync etc.
;;
;; 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)))
(common:watchdog)))
"Watchdog thread"))
(include "api-inc.scm")
(include "archive-inc.scm")
(include "client-inc.scm")
(include "common-inc.scm")
(include "configf-inc.scm")
(include "db-inc.scm")
(include "dcommon-inc.scm")
(include "dashboard-tests-inc.scm")
(include "env-inc.scm")
(include "ezsteps-inc.scm")
(include "gutils-inc.scm")
(include "http-transport-inc.scm")
(include "items-inc.scm")
(include "keys-inc.scm")
(include "launch-inc.scm")
(include "margs-inc.scm")
(include "mt-inc.scm")
(include "ods-inc.scm")
(include "pgdb-inc.scm")
(include "portlogger-inc.scm")
(include "process-inc.scm")
(include "rmt-inc.scm")
(include "runconfig-inc.scm")
(include "runs-inc.scm")
(include "server-inc.scm")
(include "subrun-inc.scm")
(include "tasks-inc.scm")
(include "tdb-inc.scm")
(include "tests-inc.scm")
(include "vg-inc.scm")
)
;; http-transport:server-dat definition moved to common_records.scm
;; bunch of small functions factored out of send-receive to make debug easier