Index: Makefile
==================================================================
--- Makefile
+++ Makefile
@@ -28,11 +28,11 @@
ezsteps.scm lock-queue.scm sdb.scm rmt.scm api.scm \
subrun.scm portlogger.scm archive.scm env.scm \
diff-report.scm cgisetup/models/pgdb.scm
# module source files
-MSRCFILES = dbmod.scm
+MSRCFILES = dbmod.scm servermod.scm apimod.scm commonmod.scm rmtmod.scm
# 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
@@ -45,22 +45,21 @@
MOFILES = $(addprefix mofiles/,$(MSRCFILES:%.scm=%.o))
# compiled import files
MOIMPFILES = $(MSRCFILES:%.scm=%.import.o)
-%.import.o : %.import.scm
+%.import.o : %.import.scm mofiles/%.o
csc $(CSCOPTS) -unit $*.import -c $*.import.scm -o $*.import.o
# I'm not sure the cp is a good idea, changed a lot of things and it may not have been necessary...
# mofiles/%.o %.import.scm : %.scm megatest-fossil-hash.scm
# @[ -e mofiles ] || mkdir -p mofiles
# csc $(CSCOPTS) -I mofiles -I $* -J -c $< -o $*.o
# cp $*.o mofiles/$*.o
# @touch $*.import.scm # ensure it is touched after the .o is made
-mofiles/%.o : %.scm
- mkdir -p mofiles
+mofiles/%.o %.import.scm : %.scm
csc $(CSCOPTS) -J -c $< -o mofiles/$*.o
ADTLSCR=mt_laststep mt_runstep mt_ezstep
HELPERS=$(addprefix $(PREFIX)/bin/,$(ADTLSCR))
DEPLOYHELPERS=$(addprefix deploytarg/,$(ADTLSCR))
@@ -127,11 +126,11 @@
ezsteps.o
# mofiles/rmtmod.o \
# mofiles/commonmod.o \
-tcmt : $(TCMTOBJS) tcmt.scm megatest-version.scm
+tcmt : $(TCMTOBJS) tcmt.scm megatest-version.scm $(MOIMPFILES) $(MOFILES)
csc $(CSCOPTS) $(TCMTOBJS) $(MOFILES) $(MOIMPFILES) tcmt.scm -o tcmt
# install documentation to $(PREFIX)/docs
# DOES NOT REBUILD DOCS
#
@@ -147,15 +146,17 @@
$(PREFIX)/share/db/mt-pg.sql : mt-pg.sql
mkdir -p $(PREFIX)/share/db
$(INSTALL) mt-pg.sql $(PREFIX)/share/db/mt-pg.sql
-# Special dependencies for the includes
+# Special dependencies for the module includes
$(MOFILE) $(MOIMPFILES) : megatest-fossil-hash.scm
-
-# common.o : mofiles/commonmod.o megatest-fossil-hash.scm
-
+megatest.o : $(MOIMPFILES)
+mofiles/commonmod.o : megatest-fossil-hash.scm
+mofiles/dbmod.o mofiles/servermod.o mofiles/apimod.o : mofiles/commonmod.o
+mofiles/rmtmod.o : mofiles/apimod.o
+common.o : mofiles/commonmod.o
# commonmod.o dashboard.o megatest.o tcmt.o apimod.o : megatest-fossil-hash.scm
tests.o db.o launch.o runs.o dashboard-tests.o \
dashboard-context-menu.o dashboard-guimonitor.o dashboard-main.o \
monitor.o dashboard.o archive.o megatest.o : db_records.scm megatest-fossil-hash.scm
Index: apimod.scm
==================================================================
--- apimod.scm
+++ apimod.scm
@@ -17,20 +17,20 @@
;; along with Megatest. If not, see .
;;======================================================================
(declare (unit apimod))
-(declare (uses commonmod))
-(declare (uses ulex))
+;; (declare (uses commonmod))
+;; (declare (uses ulex))
(module apimod
*
(import scheme chicken data-structures extras)
(import (prefix sqlite3 sqlite3:) posix typed-records srfi-18)
-(import commonmod)
-(import (prefix ulex ulex:))
+;; (import commonmod)
+;; (import (prefix ulex ulex:))
(define (api:execute-requests params)
#f)
Index: common.scm
==================================================================
--- common.scm
+++ common.scm
@@ -803,10 +803,16 @@
(8 "DEAD")
(9 "FAIL")
(10 "PREQ_FAIL")
(11 "PREQ_DISCARDED")
(12 "ABORT")))
+
+(define (common:status>? s1 s2)
+ (let* ((munged (map (lambda (x) `(,(cadr x) . ,(car x))) *common:std-statuses*))
+ (v1 (alist-ref s1 munged equal?))
+ (v2 (alist-ref s2 munged equal?)))
+ (> v1 v2)))
(define *common:ended-states* ;; states which indicate the test is stopped and will not proceed
'("COMPLETED" "ARCHIVED" "KILLED" "KILLREQ" "STUCK" "INCOMPLETE" ))
(define *common:badly-ended-states* ;; these roll up as CHECK, i.e. results need to be checked
Index: docs/manual/server.dot
==================================================================
--- docs/manual/server.dot
+++ docs/manual/server.dot
@@ -51,18 +51,23 @@
// server bootstrap
subgraph cluster_2 {
label="Startup";
node [style=filled,shape=box];
getlock [label="Get file lock"];
- starthttp [label="Start http server"];
- copydb [label="Copy db to /tmp"];
+ starthttpcpdb [label="Start http server/copy db to /tmp"];
createsrvfile [label="Create .nnn.server file containing host:port"];
releaselock [label="Release file lock"];
+ chksrv [label="Check if server already exists"];
+ exitstartup [label="exit/stop"];
+ sleep1 [label="Sleep few seconds"];
- getlock -> starthttp -> createsrvfile;
- getlock -> copydb -> createsrvfile;
- createsrvfile -> releaselock;
+ getlock -> starthttpcpdb [label="yes"];
+ getlock -> chksrv [label="no"];
+ starthttpcpdb -> createsrvfile -> releaselock;
+ chksrv -> exitstartup [label="yes"];
+ chksrv -> sleep1 [label="no"];
+ sleep1 -> getlock;
}
// shutting down server
subgraph cluster_3 {
label="Shutdown";
Index: megatest.scm
==================================================================
--- megatest.scm
+++ megatest.scm
@@ -42,14 +42,27 @@
(declare (uses env))
(declare (uses diff-report))
;; (declare (uses ftail))
;; (import ftail)
+;; Needed for repl even if not used here in megatest.scm
(declare (uses dbmod))
(import dbmod)
(declare (uses dbmod.import))
+(declare (uses servermod))
+(import servermod)
+(declare (uses servermod.import))
+
+(declare (uses apimod))
+(import apimod)
+(declare (uses apimod.import))
+
+;; (declare (uses commonmod))
+;; (import commonmod)
+;; (declare (uses commonmod.import))
+
(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")
ADDED mofiles/README
Index: mofiles/README
==================================================================
--- /dev/null
+++ mofiles/README
@@ -0,0 +1,1 @@
+Built modules go here - an attempt to minimize clutter.
Index: rmtmod.scm
==================================================================
--- rmtmod.scm
+++ rmtmod.scm
@@ -20,11 +20,11 @@
(declare (unit rmtmod))
(declare (uses commonmod))
(declare (uses apimod))
;; (declare (uses apimod.import))
-(declare (uses ulex))
+;; (declare (uses ulex))
;; (include "ulex/ulex.scm")
(module rmtmod
*
@@ -31,11 +31,11 @@
(import scheme chicken data-structures extras)
(import (prefix sqlite3 sqlite3:) posix typed-records srfi-18)
(import (prefix commonmod cmod:))
(import apimod)
-(import (prefix ulex ulex:))
+;; (import (prefix ulex ulex:))
(defstruct alldat
(areapath #f)
(ulexdat #f)
)
ADDED servermod.scm
Index: servermod.scm
==================================================================
--- /dev/null
+++ servermod.scm
@@ -0,0 +1,39 @@
+;;======================================================================
+;; Copyright 2017, 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 .
+
+;;======================================================================
+
+(declare (unit servermod))
+
+(module servermod
+ *
+
+(import scheme chicken data-structures extras)
+(import (prefix sqlite3 sqlite3:) posix typed-records srfi-18)
+
+(define (just-testing)
+ (print "JUST TESTING"))
+
+;; (define (debug:print . params) #f)
+;; (define (debug:print-info . params) #f)
+;;
+;; (define (set-functions dbgp dbgpinfo)
+;; (set! debug:print dbgp)
+;; (set! debug:print-info dbgpinfo))
+
+)