Megatest

Check-in [bc38bbc27d]
Login
Overview
Comment:Added eval test case for solving the configf problem
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.6584-ck5
Files: files | file ages | folders
SHA1: bc38bbc27d5cb286720c83c9a0f91cdd21994b6d
User & Date: matt on 2021-04-18 14:26:49
Other Links: branch diff | manifest | tags
Context
2021-04-18
16:28
wip - adding bigmod. Cleaned up mess of duplicated procedures in configfmod. check-in: 2f80db5a6c user: matt tags: v1.6584-ck5
14:26
Added eval test case for solving the configf problem check-in: bc38bbc27d user: matt tags: v1.6584-ck5
00:30
re-enabled serialize-env check-in: 0aa5896c79 user: matt tags: v1.6584-ck5
Changes

Modified Makefile from [aaa3a00076] to [bca3f9dd9a].

428
429
430
431
432
433
434





435
436
428
429
430
431
432
433
434
435
436
437
438
439
440
441







+
+
+
+
+


# (MSRCFILES)
# shell ls *.scm adjutant.scm cgisetup/models/pgdb.scm|sort -u|egrep -v '.import.|debugprint|mtargs|sretrieve|sauth|sharedat|tcmt')

deps.pdf : $(DEPSFILES)
	gendeps deps.inc $(DEPSFILES)
	dot deps.dot -Tpdf -o deps.pdf

mindeps.pdf :  $(DEPSFILES)
	gendeps deps.inc $(DEPSFILES)
	egrep -v 'debugprint|mtargs|mtver|hostinfo|stml2' deps.dot > mindeps.dot
	dot mindeps.dot -Tpdf -o mindeps.pdf

showdepfiles :
	@echo $(DEPSFILES)

Modified configfmod.scm from [b249cd13a4] to [6bc3d038a3].

1117
1118
1119
1120
1121
1122
1123



1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157























1158
1159
1160
1161
1162
1163
1164
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139





















1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169







+
+
+













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







;; read a line and process any #{ ... } constructs

(define configf:var-expand-regex (regexp "^(.*)#\\{(scheme|system|shell|getenv|get|runconfigs-get|rget|scm|sh|rp|gv|g|mtrah)\\s+([^\\}\\{]*)\\}(.*)"))

(define (configf:system ht cmd)
  (system cmd)
  )

(define configf:std-imports "(import configfmod commonmod)")
(module-environment configfmod)

(define (configf:process-line l ht allow-system #!key (linenum #f))
  (let loop ((res l))
    (if (string? res)
	(let ((matchdat (string-search configf:var-expand-regex res)))
	  (if matchdat
	      (let* ((prestr  (list-ref matchdat 1))
		     (cmdtype (list-ref matchdat 2)) ;; eval, system, shell, getenv
		     (cmd     (list-ref matchdat 3))
		     (poststr (list-ref matchdat 4))
		     (result  #f)
		     (start-time (current-seconds))
		     (cmdsym  (string->symbol cmdtype))
		     (fullcmd (case cmdsym
				((scheme scm) (conc "(lambda (ht)" cmd ")"))
				((system)     (conc "(lambda (ht)(configf:system ht \"" cmd "\"))"))
				((shell sh)   (conc "(lambda (ht)(string-translate (shell \""  cmd "\") \"\n\" \" \"))"))
				((realpath rp)(conc "(lambda (ht)(common:nice-path \"" cmd "\"))"))
				((getenv gv)  (conc "(lambda (ht)(get-environment-variable \"" cmd "\"))"))
				((mtrah)      (conc "(lambda (ht)"
                                                    "    (let ((extra \"" cmd "\"))"
						    "       (conc (or *toppath* (get-environment-variable \"MT_RUN_AREA_HOME\"))"
						    "             (if (string-null? extra) \"\" \"/\")"
						    "             extra)))"))
				((get g)   
				 (match (string-split cmd)
					((sect var)(conc "(lambda (ht)(configf:lookup ht \"" sect "\" \"" var "\"))"))
					(else
					 (debug:print-error 0 *default-log-port* "#{get ...} used with only one parameter, \"" cmd "\", two needed.")
					 "(lambda (ht) #f)")))
				((runconfigs-get rget) (conc "(lambda (ht)(runconfigs-get ht \"" cmd "\"))"))
				;; ((rget)           (conc "(lambda (ht)(runconfigs-get ht \"" cmd "\"))"))
				(else "(lambda (ht)(print \"ERROR\") \"ERROR\")"))))
		;; (print "fullcmd=" fullcmd)
		     (fullcmd
		      (conc  configf:std-imports
			     (case cmdsym
			       ((scheme scm) (conc "(lambda (ht)" cmd ")"))
			       ((system)     (conc "(lambda (ht)(configf:system ht \"" cmd "\"))"))
			       ((shell sh)   (conc "(lambda (ht)(string-translate (shell \""  cmd "\") \"\n\" \" \"))"))
			       ((realpath rp)(conc "(lambda (ht)(common:nice-path \"" cmd "\"))"))
			       ((getenv gv)  (conc "(lambda (ht)(get-environment-variable \"" cmd "\"))"))
			       ((mtrah)      (conc "(lambda (ht)"
						   "    (let ((extra \"" cmd "\"))"
						   "       (conc (or *toppath* (get-environment-variable \"MT_RUN_AREA_HOME\"))"
						   "             (if (string-null? extra) \"\" \"/\")"
						   "             extra)))"))
			       ((get g)   
				(match (string-split cmd)
				       ((sect var)(conc "(lambda (ht)(configf:lookup ht \"" sect "\" \"" var "\"))"))
				       (else
					(debug:print-error 0 *default-log-port* "#{get ...} used with only one parameter, \"" cmd "\", two needed.")
					"(lambda (ht) #f)")))
			       ((runconfigs-get rget) (conc "(lambda (ht)(runconfigs-get ht \"" cmd "\"))"))
			       ;; ((rget)           (conc "(lambda (ht)(runconfigs-get ht \"" cmd "\"))"))
			       (else "(lambda (ht)(print \"ERROR\") \"ERROR\")")))))
		(print "fullcmd=" fullcmd)
		(handle-exceptions
		 exn
		 (begin
		   (debug:print 0 *default-log-port* "WARNING: failed to process config input \"" l "\", exn=" exn)
		   (debug:print 0 *default-log-port* " message: " ((condition-property-accessor 'exn 'message) exn))
		   ;; (print "exn=" (condition->list exn))
		   (set! result (conc "#{( " cmdtype ") " cmd "}, full expansion: " fullcmd)))

Modified dbmod.scm from [17bea84150] to [2de4d37095].

15
16
17
18
19
20
21

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







+







;; 
;;     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 dbmod))

(declare (uses debugprint))
(declare (uses commonmod))
(declare (uses configfmod))
(declare (uses mtargs))
(declare (uses mtver))
(declare (uses csv-xml))
(declare (uses keysmod))
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
74
75
76
77
78
79
80



81

















82

83
84
85
86
87
88
89







-
-
-

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

-







	keysmod
	mtmod
	mtver
	pkts
	(prefix dbi dbi:)
	)

;;======================================================================
;; Database access
;;======================================================================

;; dbstruct vector containing all the relevant dbs like main.db, megatest.db, run.db etc

;; (use (srfi 18) extras tcp stack)
;; (use sqlite3 srfi-1 posix regex regex-case srfi-69 csv-xml s11n md5 message-digest base64 format dot-locking z3 typed-records matchable)
;; (import (prefix sqlite3 sqlite3:))
;; (import (prefix base64 base64:))
;; 
;; (declare (unit db))
;; (declare (uses common))
;; (declare (uses keys))
;; (declare (uses ods))
;; (declare (uses client))
;; (declare (uses mt))
;; 
;; (include "common_records.scm")

;; (include "db_records.scm")
(include "key_records.scm")
;; (include "run_records.scm")

;;======================================================================
;;  R E C O R D S
;;======================================================================

;; each db entry is a pair ( db . dbfilepath )
;; I propose this record evolves into the area record

Modified mtmod.scm from [39b5943135] to [c024f0a2df].

15
16
17
18
19
20
21

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







+







;; 
;;     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 mtmod))

(declare (uses debugprint))
(declare (uses commonmod))
(declare (uses configfmod))

(module mtmod
	*
	
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
63
64
65
66
67
68
69






















70
71
72
73
74
75
76







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







	srfi-69
	stack
	typed-records
	z3
	
	)



;; (use sqlite3 srfi-1 posix regex regex-case srfi-69 dot-locking (srfi 18) posix-extras directory-utils call-with-environment-variables)
;; (import (prefix sqlite3 sqlite3:))
;; 
;; (declare (unit mt))
;; (declare (uses db))
;; (declare (uses common))
;; (declare (uses items))
;; (declare (uses runconfig))
;; (declare (uses tests))
;; (declare (uses server))
;; (declare (uses runs))
;; (declare (uses rmt))
;; ;; (declare (uses filedb))
;; 
;; (include "common_records.scm")
;; (include "key_records.scm")
;; (include "db_records.scm")
;; (include "run_records.scm")
;; (include "test_records.scm")

;; This is the Megatest API. All generally "useful" routines will be wrapped or extended
;; here.

(define (mt:discard-blocked-tests run-id failed-test tests test-records)
  (if (null? tests)
      tests
      (begin

Added testeval/Makefile version [9f3da22ea1].















1
2
3
4
5
6
7
8
9
10
11
12
13
14
+
+
+
+
+
+
+
+
+
+
+
+
+
+
CSCOPTS=
SRCFILES=mod1.scm mod2.scm all.scm
MOFILES = $(SRCFILES:%.scm=%.o)
MOIMPFILES = $(SRCFILES:%.scm=%.import.o)

%.import.o : %.import.scm
	csc $(CSCOPTS) -unit $*.import -c $*.import.scm -o $*.import.o

%.o : %.scm
	csc $(CSCOPTS) -J -c $< -o $*.o

mod3.o : mod1.o mod2.o all.o
mod3 : mod3.scm $(MOFILES)
	csc $(CSCOPTS) $(MOFILES) mod3.scm -o mod3

Added testeval/all.scm version [0ce4acc683].














1
2
3
4
5
6
7
8
9
10
11
12
13
+
+
+
+
+
+
+
+
+
+
+
+
+
(declare (unit all))

(declare (uses mod1))
(declare (uses mod2))

(module all
	()
	(import scheme chicken.module mod1 mod2)
	(reexport mod1 mod2)

)
	 
 

Added testeval/mod1.scm version [8b378376bb].












1
2
3
4
5
6
7
8
9
10
11
+
+
+
+
+
+
+
+
+
+
+
(declare (unit mod1))

(module mod1
	*

(import scheme)
(define *mod1somevar* 1234)

)
	 
 

Added testeval/mod2.scm version [e1a15c38e7].












1
2
3
4
5
6
7
8
9
10
11
+
+
+
+
+
+
+
+
+
+
+
(declare (unit mod2))

(module mod2
	*

(import scheme)
(define *mod2somevar* 4321)

)
	 
 

Added testeval/mod3.scm version [9eca8b9972].




































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

(declare (uses mod1))
(declare (uses mod2))

(module mod3
	*

(import scheme
	chicken.eval
	mod1 mod2 all)

(define (vars) ;; 
  (- *mod2somevar* *mod1somevar*))

(define (mod1ok)
  (let ((modallenv (module-environment 'all)))
    (eval '*mod1somevar* modallenv)))

(define (mod2ok)
   (let ((modallenv (module-environment 'all)))
    (eval '*mod2somevar* modallenv)))
			 
(define (addsome)
  (let ((modallenv (module-environment 'all)))
    (eval '(+ *mod1somevar* *mod2somevar*) modallenv)))

)

(import mod3)

(print "vars: "(vars))
(print "mod1ok: "(mod1ok))
(print "mod2ok: "(mod2ok))
(print "addsome: "(addsome)) ;; => 5555