Megatest

Check-in [1256c2f20d]
Login
Overview
Comment:Experimental optimizations. System is unstable so cannot test
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 1256c2f20d4278fa6e333f36d07bade433f73e47
User & Date: matt on 2013-04-28 19:05:04
Other Links: branch diff | manifest | tags
Context
2013-04-28
22:51
Corrected oops, used testpath when needed work-area. Added dump for cmdinfo check-in: 5bc1b6ab81 user: matt tags: dev
19:05
Experimental optimizations. System is unstable so cannot test check-in: 1256c2f20d user: matt tags: dev
17:18
Optimizations to -step and some removal of redundant calls check-in: 08194cc25b user: matt tags: dev
Changes

Modified db.scm from [ffbf6eecf9] to [3d1c7601f8].

1685
1686
1687
1688
1689
1690
1691
1692
1693



1694
1695
1696
1697
1698
1699
1700
1701
1685
1686
1687
1688
1689
1690
1691


1692
1693
1694

1695
1696
1697
1698
1699
1700
1701







-
-
+
+
+
-







			       ((<)  (if (<  value expected) "pass" "fail"))
			       ((>=) (if (>= value expected) "pass" "fail"))
			       ((<=) (if (<= value expected) "pass" "fail"))
			       (else (conc "ERROR: bad tol comparator " tol))))))
	       (debug:print 4 "AFTER2: category: " category " variable: " variable " value: " value 
			    ", expected: " expected " tol: " tol " units: " units " status: " status " comment: " comment)
	       (sqlite3:execute tdb "INSERT OR REPLACE INTO test_data (test_id,category,variable,value,expected,tol,units,comment,status,type) VALUES (?,?,?,?,?,?,?,?,?,?);"
				test-id category variable value expected tol units (if comment comment "") status type)
	       (sqlite3:finalize! tdb)))
				test-id category variable value expected tol units (if comment comment "") status type)))
	   csvlist)
	  (sqlite3:finalize! tdb)))))
	   csvlist)))))

;; get a list of test_data records matching categorypatt
(define (db:read-test-data db test-id categorypatt #!key (testpath #f))
  (let ((tdb  (db:open-test-db-by-test-id db test-id testpath: testpath)))
    (if tdb
	(let ((res '()))
	  (sqlite3:for-each-row 
1709
1710
1711
1712
1713
1714
1715
1716

1717
1718
1719
1720
1721
1722
1723
1709
1710
1711
1712
1713
1714
1715

1716
1717
1718
1719
1720
1721
1722
1723







-
+








;; NOTE: Run this local with #f for db !!!
(define (db:load-test-data db test-id #!key (testpath #f))
  (let loop ((lin (read-line)))
    (if (not (eof-object? lin))
	(begin
	  (debug:print 4 lin)
	  (db:csv->test-data db test-id lin)
	  (db:csv->test-data db test-id lin testpath: testpath)
	  (loop (read-line)))))
  ;; roll up the current results.
  ;; FIXME: Add the status to 
  (db:test-data-rollup db test-id #f testpath: testpath))

;; WARNING: Do NOT call this for the parent test on an iterated test
;; Roll up test_data pass/fail results

Modified megatest.scm from [16c915bf6c] to [d2483564c8].

868
869
870
871
872
873
874
875

876
877
878
879
880
881
882
868
869
870
871
872
873
874

875
876
877
878
879
880
881
882







-
+








	  ;; can setup as client for server mode now
	  ;; (client:setup)

	  (if (args:get-arg "-load-test-data")
	      ;; has sub commands that are rdb:
	      ;; DO NOT put this one into either cdb:remote-run or open-run-close
	      (db:load-test-data db test-id))
	      (db:load-test-data db test-id testpath: testpath))
	  (if (args:get-arg "-setlog")
	      (let ((logfname (args:get-arg "-setlog")))
		(cdb:test-set-log! *runremote* test-id logfname)))
	  (if (args:get-arg "-set-toplog")
	      ;; DO NOT run remote
	      (tests:test-set-toplog! db run-id test-name (args:get-arg "-set-toplog")))
	  (if (args:get-arg "-summarize-items")
947
948
949
950
951
952
953
954

955
956
957
958
959
960
961
947
948
949
950
951
952
953

954
955
956
957
958
959
960
961







-
+







		    (begin
		      (debug:print 0 "ERROR: You must specify :state and :status with every call to -test-status\n" help)
		      ;; (sqlite3:finalize! db)
		      (exit 6)))
		(let* ((msg    (args:get-arg "-m"))
		       (numoth (length (hash-table-keys otherdata))))
		  ;; Convert to rpc inside the tests:test-set-status! call, not here
		  (tests:test-set-status! test-id state newstatus msg otherdata))))
		  (tests:test-set-status! test-id state newstatus msg otherdata testpath: testpath))))
	  (if db (sqlite3:finalize! db))
	  (set! *didsomething* #t))))

;;======================================================================
;; Various helper commands can go below here
;;======================================================================

Modified tests.scm from [a123ccd9de] to [89af9a310e].

242
243
244
245
246
247
248
249

250
251
252
253
254
255
256
242
243
244
245
246
247
248

249
250
251
252
253
254
255
256







-
+







				  (loop (car tal)(cdr tal)))
			      #f))))))
      (pop-directory)
      result)))


;; Do not rpc this one, do the underlying calls!!!
(define (tests:test-set-status! test-id state status comment dat)
(define (tests:test-set-status! test-id state status comment dat #!key (testpath #f))
  (debug:print-info 4 "tests:test-set-status! test-id=" test-id ", state=" state ", status=" status ", dat=" dat)
  (let* ((db          #f)
	 (real-status status)
	 (otherdat    (if dat dat (make-hash-table)))
	 (testdat     (cdb:get-test-info-by-id *runremote* test-id))
	 (run-id      (db:test-get-run_id testdat))
	 (test-name   (db:test-get-testname   testdat))
288
289
290
291
292
293
294
295

296
297
298
299
300
301
302
288
289
290
291
292
293
294

295
296
297
298
299
300
301
302







-
+







    ;; update the primary record IF state AND status are defined
    (if (and state status)
	(cdb:test-set-status-state *runremote* test-id real-status state (if waived waived comment)))
    
    ;; if status is "AUTO" then call rollup (note, this one modifies data in test
    ;; run area, it does remote calls under the hood.
    (if (and test-id state status (equal? status "AUTO")) 
	(db:test-data-rollup #f test-id status))
	(db:test-data-rollup #f test-id status testpath: testpath))

    ;; add metadata (need to do this way to avoid SQL injection issues)

    ;; :first_err
    ;; (let ((val (hash-table-ref/default otherdat ":first_err" #f)))
    ;;   (if val
    ;;       (sqlite3:execute db "UPDATE tests SET first_err=? WHERE run_id=? AND testname=? AND item_path=?;" val run-id test-name item-path)))
322
323
324
325
326
327
328

329

330
331
332
333
334
335
336
322
323
324
325
326
327
328
329

330
331
332
333
334
335
336
337







+
-
+







			   variable ","
			   value    ","
			   expected ","
			   tol      ","
			   units    ","
			   dcomment ",," ;; extra comma for status
			   type     )))
	    ;; This was run remote, don't think that makes sense.
	    (cdb:remote-run db:csv->test-data #f test-id
	    (db:csv->test-data #f test-id
				dat))))
      
    ;; need to update the top test record if PASS or FAIL and this is a subtest
    (if (not (equal? item-path ""))
	(cdb:roll-up-pass-fail-counts *runremote* run-id test-name item-path status))

    (if (or (and (string? comment)

Modified tests/fullrun/config/mt_include_1.config from [6243d15a3d] to [c9e290ae6b].

1
2
3

4
5
6
7
8
9
10
1
2

3
4
5
6
7
8
9
10


-
+







[setup]
# exectutable /path/to/megatest
max_concurrent_jobs 25
max_concurrent_jobs 100

linktree #{getenv MT_RUN_AREA_HOME}/tmp/mt_links

[jobtools]
useshell yes
# ## launcher launches jobs, the job is managed on the target host
## by megatest, comment out launcher to run local