Megatest

Diff
Login

Differences From Artifact [511916cc75]:

To Artifact [613fa01aef]:


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
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







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

+
-
+
-




-
+







;;     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 common))
(declare (uses commonmod))
(declare (uses pkts))
(declare (uses dbi))

(import
 srfi-1
 srfi-69
 ;; data-structures posix
(use srfi-1 data-structures posix regex-case (prefix base64 base64:)
     format dot-locking csv-xml z3 udp ;; sql-de-lite
     hostinfo md5 message-digest typed-records directory-utils stack
     matchable regex posix (srfi 18) extras ;; tcp 
     (prefix nanomsg nmsg:)
     (prefix sqlite3 sqlite3:)
     pkts (prefix dbi dbi:)
     )
 regex-case (prefix base64 base64:)
 chicken.condition
 chicken.file
 chicken.file.posix
 chicken.format
 chicken.io
 chicken.pathname
 chicken.port
 chicken.pretty-print
 chicken.process
 chicken.process-context
 chicken.process-context.posix
 chicken.process.signal
 chicken.string
 chicken.sort
 chicken.time
 chicken.time.posix
 
 ;; dot-locking
 ;; csv-xml
 z3
 ;; udp ;; sql-de-lite
 ;; hostinfo
 md5
 message-digest typed-records
 ;; directory-utils
 sparse-vectors
 stack
 matchable regex
 ;; posix
 (srfi 18)
 srfi-13

 system-information
 ;; extras ;; tcp 
 (prefix nanomsg nmsg:)
 (prefix sqlite3 sqlite3:)
 pkts
 (prefix dbi dbi:)
 )

;; (import posix-extras pathname-expand files)
(declare (unit common))

(declare (uses commonmod))
(import commonmod)

(include "common_records.scm")


(define setenv set-environment-variable!)
;; (require-library margs)
;; (include "margs.scm")

;; (define old-exit exit)
;; 
;; (define (exit . code)
;;   (if (null? code)
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219

220
221
222
223
224
225
226
238
239
240
241
242
243
244


245
246
247
248
249
250
251
252
253
254
255
256
257

258
259
260
261
262
263
264
265







-
-













-
+







(define *launch-setup-mutex* (make-mutex))     ;; need to be able to call launch:setup often so mutex it and re-call the real deal only if *toppath* not set
(define *homehost-mutex*     (make-mutex))

;; Miscellaneous
(define *triggers-mutex*     (make-mutex))     ;; block overlapping processing of triggers
(define *numcpus-cache* (make-hash-table))

(use posix-extras pathname-expand files)

;; this plugs a hole in posix-extras in recent chicken versions > 4.9)
#;(let-values (( (chicken-release-number chicken-major-version)
               (apply values
                      (map string->number
                           (take
                            (string-split (chicken-version) ".")
                            2)))))
  (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) (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)))