Megatest

Check-in [4e134398af]
Login
Overview
Comment:wip
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.6584-ck5
Files: files | file ages | folders
SHA1: 4e134398af289385c8b57c1a6ad91b5636e1015b
User & Date: matt on 2021-04-07 08:51:17
Other Links: branch diff | manifest | tags
Context
2021-04-07
09:41
wip check-in: 07c8d202ea user: matt tags: v1.6584-ck5
08:51
wip check-in: 4e134398af user: matt tags: v1.6584-ck5
2021-04-06
22:53
Getting still closer but not there yet check-in: 38a3940f9b user: matt tags: v1.6584-ck5
Changes

Modified Makefile from [d1e874e844] to [7bea9e001e].

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#            subrun.scm portlogger.scm archive.scm env.scm		\
#            diff-report.scm cgisetup/models/pgdb.scm

# module source files
# MSRCFILES = 
# ftail.scm rmtmod.scm commonmod.scm removed
MSRCFILES = autoload.scm dbi.scm 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

GUISRCF = dashboard-context-menu.scm dashboard-tests.scm		\
          dashboard-guimonitor.scm gutils.scm dcommon.scm tree.scm	\
          vg.scm







|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#            subrun.scm portlogger.scm archive.scm env.scm		\
#            diff-report.scm cgisetup/models/pgdb.scm

# module source files
# MSRCFILES = 
# ftail.scm rmtmod.scm commonmod.scm removed
MSRCFILES = autoload.scm dbi.scm ducttape-lib.scm pkts.scm stml2.scm cookie.scm mutils.scm \
            mtargs.scm apimod.scm  commonmod.scm  dbmod.scm rmtmod.scm

# commonmod.scm dbmod.scm adjutant.scm ulex.scm	\
#            rmtmod.scm apimod.scm

GUISRCF = dashboard-context-menu.scm dashboard-tests.scm		\
          dashboard-guimonitor.scm gutils.scm dcommon.scm tree.scm	\
          vg.scm
64
65
66
67
68
69
70

71
72
73
74
75
76
77
mofiles/%.o : %.scm
	mkdir -p mofiles
	csc $(CSCOPTS) -J -c $< -o mofiles/$*.o

# module dependencies
mofiles/stml2.o : mofiles/dbi.o
mofiles/dbi.o   : mofiles/autoload.o


ADTLSCR=mt_laststep mt_runstep mt_ezstep
HELPERS=$(addprefix $(PREFIX)/bin/,$(ADTLSCR))
DEPLOYHELPERS=$(addprefix deploytarg/,$(ADTLSCR))
MTESTHASH=$(shell fossil info|grep checkout:| awk '{print $$2}')

ifeq ($(MTESTHASH),)







>







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
mofiles/%.o : %.scm
	mkdir -p mofiles
	csc $(CSCOPTS) -J -c $< -o mofiles/$*.o

# module dependencies
mofiles/stml2.o : mofiles/dbi.o
mofiles/dbi.o   : mofiles/autoload.o
mofiles/apimod.o mofiles/dbmod.o mofiles/rmtmod.o : mofiles/commonmod.o

ADTLSCR=mt_laststep mt_runstep mt_ezstep
HELPERS=$(addprefix $(PREFIX)/bin/,$(ADTLSCR))
DEPLOYHELPERS=$(addprefix deploytarg/,$(ADTLSCR))
MTESTHASH=$(shell fossil info|grep checkout:| awk '{print $$2}')

ifeq ($(MTESTHASH),)

Modified apimod.scm from [a7cef484dc] to [dc935cc366].

16
17
18
19
20
21
22
23
24
25
26
27
28
29




30
31

32
33
34
;;     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 apimod))
(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:))



)







<




|
|
>
>
>
>
|
|
>



16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
;;     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 apimod))
(declare (uses commonmod))


(module apimod
	*
	
(import scheme
	(prefix sqlite3 sqlite3:)

	typed-records
	srfi-18

	commonmod

	)


)

Modified commonmod.scm from [9423abd515] to [7df3d9436f].

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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
;;======================================================================

(declare (unit commonmod))

(module commonmod
	*
	
(import scheme chicken data-structures extras files)
(import (prefix sqlite3 sqlite3:) posix typed-records srfi-18 srfi-69



	md5 message-digest


	regex srfi-1)





;;======================================================================
;; CONTENTS
;;
;;  config file utils
;;  misc conversion, data manipulation functions
;;  testsuite and area utilites
;;
;;======================================================================

(include "megatest-version.scm")
(include "megatest-fossil-hash.scm")

(define (get-full-version)
  (conc megatest-version "-" megatest-fossil-hash))

(define (version-signature)
  (conc megatest-version "-" (substring megatest-fossil-hash 0 4)))


;;======================================================================
;; config file utils
;;======================================================================

(define (lookup cfgdat section var)
  (if (hash-table? cfgdat)
      (let ((sectdat (hash-table-ref/default cfgdat section '())))
	(if (null? sectdat)
	    #f
	    (let ((match (assoc var sectdat)))
	      (if match ;; (and match (list? match)(> (length match) 1))
		  (cadr match)
		  #f))
	    ))
      #f))

;; returns var key1=val1; key2=val2 ... as alist
(define (get-key-list cfgdat section var)
  ;; convert string a=1; b=2; c=a silly thing; d=
  (let ((valstr (lookup cfgdat section var)))
    (if valstr
	(val->alist valstr)
	'()))) ;; should it return empty list or #f to indicate not set?


(define (get-section cfgdat section)
  (hash-table-ref/default cfgdat section '()))

;;======================================================================
;; misc conversion, data manipulation functions
;;======================================================================

;; if it looks like a number -> convert it to a number, else return it
;;
(define (lazy-convert inval)
  (let* ((as-num (if (string? inval)(string->number inval) #f)))
    (or as-num inval)))

;; to '((a . 1)(b . 2)(c . "a silly thing")(d . ""))
;;
(define (val->alist val #!key (convert #f))
  (let ((val-list (string-split-fields ";\\s*" val #:infix)))
    (if val-list
	(map (lambda (x)
	       (let ((f (string-split-fields "\\s*=\\s*" x #:infix)))
		 (case (length f)
		   ((0) `(,#f))  ;; null string case
		   ((1) `(,(string->symbol (car f))))
		   ((2) `(,(string->symbol (car f)) .
			  ,(let ((inval (cadr f)))
			     (if convert (lazy-convert inval) inval))))
		   (else f))))
	     (filter (lambda (x)
		       (not (string-match "^\\s*" x)))
		     val-list))
	'())))

;;======================================================================
;; testsuite and area utilites
;;======================================================================

(define (get-testsuite-name toppath configdat)
  (or (lookup configdat "setup" "area-name")
      (lookup configdat "setup" "testsuite")
      (get-environment-variable "MT_TESTSUITE_NAME")
      (if (string? toppath)
          (pathname-file toppath)
          #f)))

(define (get-area-path-signature toppath #!optional (short #f))
  (let ((res (message-digest-string (md5-primitive) toppath)))
    (if short
	(substring res 0 4)
	res)))

(define (get-area-name configdat toppath #!optional (short #f))
  ;; look up my area name in areas table (future)
  ;; generate auto name
  (conc (get-area-path-signature toppath short)
	"-"
	(get-testsuite-name toppath configdat)))

;; need generic find-record-with-var-nmatching-val
;;


(define (path->area-record cfgdat path)
  (let* ((areadat (get-cfg-areas cfgdat))
	 (all     (filter (lambda (x)
			    (let* ((keyvals (cdr x))
				   (pth     (alist-ref 'path keyvals)))
			      (equal? path pth)))
			  areadat)))
    (if (null? all)
	#f
	(car all)))) ;; return first match

;; given a config return an alist of alists
;;   area-name => data
;;
(define (get-cfg-areas cfgdat)
  (let ((adat (get-section cfgdat "areas")))
    (map (lambda (entry)
	   `(,(car entry) . 
	     ,(val->alist (cadr entry))))
	 adat)))
	 
;; (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))

)







|
|
>
>
>
|
>
>
|
>
>
>
>













|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
<
|
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|


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
137
138
139


140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
;;======================================================================

(declare (unit commonmod))

(module commonmod
	*
	
(import scheme chicken.base
	(prefix sqlite3 sqlite3:)
	
	typed-records
	md5
	message-digest
	regex

	srfi-1
	srfi-18
	srfi-69

	)

;;======================================================================
;; CONTENTS
;;
;;  config file utils
;;  misc conversion, data manipulation functions
;;  testsuite and area utilites
;;
;;======================================================================

(include "megatest-version.scm")
(include "megatest-fossil-hash.scm")

;; (define (get-full-version)
;;   (conc megatest-version "-" megatest-fossil-hash))
;; 
;; (define (version-signature)
;;   (conc megatest-version "-" (substring megatest-fossil-hash 0 4)))
;; 
;; 
;; ;;======================================================================
;; ;; config file utils
;; ;;======================================================================
;; 
;; (define (lookup cfgdat section var)
;;   (if (hash-table? cfgdat)
;;       (let ((sectdat (hash-table-ref/default cfgdat section '())))
;; 	(if (null? sectdat)
;; 	    #f
;; 	    (let ((match (assoc var sectdat)))
;; 	      (if match ;; (and match (list? match)(> (length match) 1))
;; 		  (cadr match)
;; 		  #f))
;; 	    ))
;;       #f))
;; 
;; ;; returns var key1=val1; key2=val2 ... as alist
;; (define (get-key-list cfgdat section var)
;;   ;; convert string a=1; b=2; c=a silly thing; d=
;;   (let ((valstr (lookup cfgdat section var)))
;;     (if valstr
;; 	(val->alist valstr)
;; 	'()))) ;; should it return empty list or #f to indicate not set?
;; 
;; 
;; (define (get-section cfgdat section)
;;   (hash-table-ref/default cfgdat section '()))
;; 
;; ;;======================================================================
;; ;; misc conversion, data manipulation functions
;; ;;======================================================================
;; 
;; ;; if it looks like a number -> convert it to a number, else return it
;; ;;
;; (define (lazy-convert inval)
;;   (let* ((as-num (if (string? inval)(string->number inval) #f)))
;;     (or as-num inval)))
;; 
;; ;; to '((a . 1)(b . 2)(c . "a silly thing")(d . ""))
;; ;;
;; (define (val->alist val #!key (convert #f))
;;   (let ((val-list (string-split-fields ";\\s*" val #:infix)))
;;     (if val-list
;; 	(map (lambda (x)
;; 	       (let ((f (string-split-fields "\\s*=\\s*" x #:infix)))
;; 		 (case (length f)
;; 		   ((0) `(,#f))  ;; null string case
;; 		   ((1) `(,(string->symbol (car f))))
;; 		   ((2) `(,(string->symbol (car f)) .
;; 			  ,(let ((inval (cadr f)))
;; 			     (if convert (lazy-convert inval) inval))))
;; 		   (else f))))
;; 	     (filter (lambda (x)
;; 		       (not (string-match "^\\s*" x)))
;; 		     val-list))
;; 	'())))
;; 
;; ;;======================================================================
;; ;; testsuite and area utilites
;; ;;======================================================================
;; 
;; (define (get-testsuite-name toppath configdat)
;;   (or (lookup configdat "setup" "area-name")
;;       (lookup configdat "setup" "testsuite")
;;       (get-environment-variable "MT_TESTSUITE_NAME")
;;       (if (string? toppath)
;;           (pathname-file toppath)
;;           #f)))
;; 
;; (define (get-area-path-signature toppath #!optional (short #f))
;;   (let ((res (message-digest-string (md5-primitive) toppath)))
;;     (if short
;; 	(substring res 0 4)
;; 	res)))
;; 
;; (define (get-area-name configdat toppath #!optional (short #f))
;;   ;; look up my area name in areas table (future)
;;   ;; generate auto name
;;   (conc (get-area-path-signature toppath short)
;; 	"-"
;; 	(get-testsuite-name toppath configdat)))


;; 
;; ;; need generic find-record-with-var-nmatching-val
;; ;;
;; (define (path->area-record cfgdat path)
;;   (let* ((areadat (get-cfg-areas cfgdat))
;; 	 (all     (filter (lambda (x)
;; 			    (let* ((keyvals (cdr x))
;; 				   (pth     (alist-ref 'path keyvals)))
;; 			      (equal? path pth)))
;; 			  areadat)))
;;     (if (null? all)
;; 	#f
;; 	(car all)))) ;; return first match
;; 
;; ;; given a config return an alist of alists
;; ;;   area-name => data
;; ;;
;; (define (get-cfg-areas cfgdat)
;;   (let ((adat (get-section cfgdat "areas")))
;;     (map (lambda (entry)
;; 	   `(,(car entry) . 
;; 	     ,(val->alist (cadr entry))))
;; 	 adat)))
;; 	 
;; ;; (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))

)

Modified dbmod.scm from [2029a02dc3] to [9a7ceb343a].

19
20
21
22
23
24
25
26
27





28
29
30
31
32
33
34
;;======================================================================

(declare (unit dbmod))

(module dbmod
	*
	
(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)
;; 







|
|
>
>
>
>
>







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
;;======================================================================

(declare (unit dbmod))

(module dbmod
	*
	
(import scheme
	(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)
;; 

Modified megatest.scm from [0f4170fd94] to [f055a75702].

34
35
36
37
38
39
40





41
42
43
44
45
46
47
(declare (uses mutils))
(declare (uses autoload))
(declare (uses pkts))
(declare (uses ducttape-lib))
(declare (uses stml2))
(declare (uses cookie))
(declare (uses mtargs))






;; (include "call-with-environment-variables/call-with-environment-variables.scm")

(module megatest-main
	*

	(import scheme







>
>
>
>
>







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
(declare (uses mutils))
(declare (uses autoload))
(declare (uses pkts))
(declare (uses ducttape-lib))
(declare (uses stml2))
(declare (uses cookie))
(declare (uses mtargs))
(declare (uses commonmod))
(declare (uses apimod))
(declare (uses dbmod))
(declare (uses rmtmod))


;; (include "call-with-environment-variables/call-with-environment-variables.scm")

(module megatest-main
	*

	(import scheme

Modified rmtmod.scm from [4f89f84546] to [bdffc0cd93].

25
26
27
28
29
30
31
32
33



34
35
36

37
38
39
40
41
42
43
(declare (uses ulex))

;; (include "ulex/ulex.scm")

(module rmtmod
	*
	
(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:))


(defstruct alldat
  (areapath #f)
  (ulexdat  #f)
  )

;;======================================================================







|
|
>
>
>
|
|
|
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
(declare (uses ulex))

;; (include "ulex/ulex.scm")

(module rmtmod
	*
	
(import scheme 
	(prefix sqlite3 sqlite3:)
	posix
	typed-records
	srfi-18
	commonmod
	apimod

	)

(defstruct alldat
  (areapath #f)
  (ulexdat  #f)
  )

;;======================================================================