Megatest

Diff
Login

Differences From Artifact [bf539ba83a]:

To Artifact [221e1469ab]:


41
42
43
44
45
46
47
48

49
50
51
52
53
54


55
56
57
58
59
60
61
41
42
43
44
45
46
47

48
49
50
51
52


53
54
55
56
57
58
59
60
61







-
+




-
-
+
+







			common:get-disk-space-used  ;; if a proc call it, if a string it is a unix command
			(list testdir)))
	       (apath  (archive:get-archive testname itempath dused)))
	  (jobrunner:run-job
	   flavor
	   maxload
	   '()
	   archive:run-bup
	   archive:run-bup ;; this will break!!! need area-dat
	   (list testdir apath))))))
	  
;; Get archive disks from megatest.config
;;
(define (archive:get-archive-disks)
  (let ((section (configf:get-section *configdat* "archive-disks")))
(define (archive:get-archive-disks area-dat)
  (let ((section (configf:get-section (megatest:area-configdat area-dat) "archive-disks")))
    (if section
	section
	'())))

;; look for the best candidate archive area, else create new 
;; area
;;
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
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







-
+



+
+
-
-
+
+




-
-
-
+
+
+







;; archive - run bup
;;
;; 1. create the bup dir if not exists
;; 2. start the du of each directory
;; 3. gen index
;; 4. save
;;
(define (archive:run-bup archive-command run-id run-name tests)
(define (archive:run-bup archive-command run-id run-name tests area-dat)
  ;; move the getting of archive space down into the below block so that a single run can 
  ;; allocate as needed should a disk fill up
  ;;
  (let* ((configdat    (megatest:area-configdat area-dat))
	 (toppath      (megatest:area-path      area-dat))
  (let* ((min-space    (string->number (or (configf:lookup *configdat* "archive" "minspace") "1000")))
	 (archive-info (archive:allocate-new-archive-block *toppath* (common:get-testsuite-name) min-space))
	 (min-space    (string->number (or (configf:lookup configdat "archive" "minspace") "1000")))
	 (archive-info (archive:allocate-new-archive-block toppath (common:get-testsuite-name) min-space))
	 (archive-dir  (if archive-info (cdr archive-info) #f))
	 (archive-id   (if archive-info (car archive-info) -1))
	 (disk-groups  (make-hash-table))
	 (test-groups  (make-hash-table)) ;; these two (disk and test groups) could be combined nicely
	 (bup-exe      (or (configf:lookup *configdat* "archive" "bup") "bup"))
	 (compress     (or (configf:lookup *configdat* "archive" "compress") "9"))
	 (linktree     (configf:lookup *configdat* "setup" "linktree")))
	 (bup-exe      (or (configf:lookup configdat "archive" "bup") "bup"))
	 (compress     (or (configf:lookup configdat "archive" "compress") "9"))
	 (linktree     (configf:lookup configdat "setup" "linktree")))

    (if (not archive-dir) ;; no archive disk found, this is fatal
	(begin
	  (debug:print 0 "FATAL: No archive disks found. Please add disks with at least " min-space " MB space to the [archive-disks] section of megatest.config")
	  (debug:print 0 "       use [archive] minspace to specify minimum available space")
	  (debug:print 0 "   disks: " (string-intersperse (map cadr (archive:get-archive-disks)) "\n         "))
	  (exit 1))
194
195
196
197
198
199
200
201

202
203

204
205


206
207
208
209
210
211
212

213
214
215
216
217
218
219
196
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







-
+


+
-
-
+
+






-
+







	      (rmt:test-set-archive-block-id run-id test-id archive-id)
	      (if (member archive-command '("save-remove"))
		  (runs:remove-test-directory test-dat 'archive-remove))))
	  (hash-table-ref test-groups disk-group))))
     (hash-table-keys disk-groups))
    #t))

(define (archive:bup-restore archive-command run-id run-name tests)  ;; move the getting of archive space down into the below block so that a single run can 
(define (archive:bup-restore archive-command run-id run-name tests area-dat)  ;; move the getting of archive space down into the below block so that a single run can 
  ;; allocate as needed should a disk fill up
  ;;
  (let* ((configdat    (megatest:area-configdat area-dat))
  (let* ((bup-exe      (or (configf:lookup *configdat* "archive" "bup") "bup"))
	 (linktree     (configf:lookup *configdat* "setup" "linktree")))
	 (bup-exe      (or (configf:lookup configdat "archive" "bup") "bup"))
	 (linktree     (configf:lookup configdat "setup" "linktree")))

    ;; from the test info bin the path to the test by stem
    ;;
    (for-each
     (lambda (test-dat)
       ;; When restoring test-dat will initially contain an old and invalid path to the test
       (let* ((best-disk         (get-best-disk *configdat*))
       (let* ((best-disk         (get-best-disk configdat))
	      (item-path         (db:test-get-item-path test-dat))
	      (test-name         (db:test-get-testname  test-dat))
	      (test-id           (db:test-get-id        test-dat))
	      (run-id            (db:test-get-run_id    test-dat))
	      (keyvals           (rmt:get-key-val-pairs run-id))
	      (target            (string-intersperse (map cadr keyvals) "/"))