Megatest

Check-in [ee563960f8]
Login
Overview
Comment:Stubs for reduce-records
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | v1.65-reduce-records
Files: files | file ages | folders
SHA1: ee563960f8474b8b2d6ef1d964ce55be449caa94
User & Date: matt on 2018-01-30 04:04:01
Other Links: branch diff | manifest | tags
Context
2018-01-30
04:04
Stubs for reduce-records Leaf check-in: ee563960f8 user: matt tags: v1.65-reduce-records
2018-01-29
12:11
added launch fail detection and fix for test panel crash on missing ld_lib_path issue check-in: fe0ca9de59 user: bjbarcla tags: v1.65
Changes

Modified db.scm from [75889bb557] to [05bd95b7e6].

934
935
936
937
938
939
940

















941
942
943
944
945
946
947
	     (curr-time (current-seconds))
	     (res      '())
	     (last-update (if use-last-update (cons "last_update" targ-db-last-mod) #f)))
	(db:sync-tables (db:sync-main-list source-db) last-update source-db cache-db)
	(db:sync-tables db:sync-tests-only last-update source-db cache-db)
	(hash-table-set! *global-db-store* target cache-db)
	cache-db)))


















;; ;; call a proc with a cached db
;; ;;
;; (define (db:call-with-cached-db proc . params)
;;   ;; first cache the db in /tmp
;;   (let* ((cname-part (conc "megatest_cache/" (common:get-testsuite-name)))
;; 	 (fname      (conc  (common:get-area-path-signature) ".db"))







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
	     (curr-time (current-seconds))
	     (res      '())
	     (last-update (if use-last-update (cons "last_update" targ-db-last-mod) #f)))
	(db:sync-tables (db:sync-main-list source-db) last-update source-db cache-db)
	(db:sync-tables db:sync-tests-only last-update source-db cache-db)
	(hash-table-set! *global-db-store* target cache-db)
	cache-db)))

;; move records for runs untouched for over given time (2 weeks default) to
;; megatest_additional.db if there are more than 5000 test records in the db
;;
(define (db:reduce-records #!key (use-last-update #f))
  (let* ((toppath   (launch:setup))
	 (srcdir    toppath)
	 (srcname   "megatest.db")
	 (trgdir    toppath)
	 (trgname   "megatest_additional.db")
	 (dest-db   (db:open-megatest-db path: trgdir name: trgname))
	 (source-db (db:open-megatest-db path: srcdir name: srcname)))
    ;; (db:sync-tables (db:sync-main-list source-db) last-update source-db cache-db)
    ;; (db:sync-tables db:sync-tests-only last-update source-db cache-db)
    ;; (hash-table-set! *global-db-store* target cache-db)
    ;; cache-db
    ))

;; ;; call a proc with a cached db
;; ;;
;; (define (db:call-with-cached-db proc . params)
;;   ;; first cache the db in /tmp
;;   (let* ((cname-part (conc "megatest_cache/" (common:get-testsuite-name)))
;; 	 (fname      (conc  (common:get-area-path-signature) ".db"))

Modified megatest.scm from [c08f51dcf7] to [3617cd9ef2].

176
177
178
179
180
181
182
183
184
185
186
187


188
189
190
191
192
193
194
  -sort fieldname         : in -list-runs sort tests by this field
  -testdata-csv [categorypatt/]varpatt  : dump testdata for given category

Misc 
  -start-dir path         : switch to this directory before running megatest
  -contour cname          : add a level of hierarcy to the linktree and run paths
  -area-tag tagname       : add a tag to an area while syncking to pgdb
  -rebuild-db             : bring the database schema up to date
  -cleanup-db             : remove any orphan records, vacuum the db
  -import-megatest.db     : push data from megatest.db to cache db files in /tmp/$USER
  -sync-to-megatest.db    : pull data from cache files in /tmp/$USER to megatest.db
  -sync-to dest           : sync to new postgresql central style database


  -update-meta            : update the tests metadata for all tests
  -setvars VAR1=val1,VAR2=val2 : Add environment variables to a run NB// these are
                                 overwritten by values set in config files.
  -server -|hostname      : start the server (reduces contention on megatest.db), use
                            - to automatically figure out hostname
  -transport http|rpc     : use http or rpc for transport (default is http) 
  -log logfile            : send stdout and stderr to logfile







<




>
>







176
177
178
179
180
181
182

183
184
185
186
187
188
189
190
191
192
193
194
195
  -sort fieldname         : in -list-runs sort tests by this field
  -testdata-csv [categorypatt/]varpatt  : dump testdata for given category

Misc 
  -start-dir path         : switch to this directory before running megatest
  -contour cname          : add a level of hierarcy to the linktree and run paths
  -area-tag tagname       : add a tag to an area while syncking to pgdb

  -cleanup-db             : remove any orphan records, vacuum the db
  -import-megatest.db     : push data from megatest.db to cache db files in /tmp/$USER
  -sync-to-megatest.db    : pull data from cache files in /tmp/$USER to megatest.db
  -sync-to dest           : sync to new postgresql central style database
  -reduce-records         : move old records to megatest_additional.db, respects selectors
  -restore-records        : bring records back to megatest.db, respects selectors
  -update-meta            : update the tests metadata for all tests
  -setvars VAR1=val1,VAR2=val2 : Add environment variables to a run NB// these are
                                 overwritten by values set in config files.
  -server -|hostname      : start the server (reduces contention on megatest.db), use
                            - to automatically figure out hostname
  -transport http|rpc     : use http or rpc for transport (default is http) 
  -log logfile            : send stdout and stderr to logfile
306
307
308
309
310
311
312


313
314
315
316
317
318
319
			"-extract-ods"
			"-pathmod"
			"-env2file"
			"-envcap"
			"-envdelta"
			"-setvars"
			"-set-state-status"



                        ;; move runs stuff here
                        "-remove-keep"           
			"-set-run-status"
			"-age"
			"-archive"
			"-actions"







>
>







307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
			"-extract-ods"
			"-pathmod"
			"-env2file"
			"-envcap"
			"-envdelta"
			"-setvars"
			"-set-state-status"
			"-reduce-records"
			"-restore-records"

                        ;; move runs stuff here
                        "-remove-keep"           
			"-set-run-status"
			"-age"
			"-archive"
			"-actions"
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
;;    started and completed
;;    - step started, timestamp
;;    - step completed, exit status, timestamp
;; 6. test phone home
;;    - if test run time > allowed run time then kill job
;;    - if cannot access db > allowed disconnect time then kill job

;; == duplicated == (if (or (args:get-arg "-run")(args:get-arg "-runtests"))
;; == duplicated ==   (general-run-call 
;; == duplicated ==    "-runtests" 
;; == duplicated ==    "run a test" 
;; == duplicated ==    (lambda (target runname keys keyvals)
;; == duplicated ==      ;;
;; == duplicated ==      ;; May or may not implement it this way ...
;; == duplicated ==      ;;
;; == duplicated ==      ;; Insert this run into the tasks queue
;; == duplicated ==      ;; (open-run-close tasks:add tasks:open-db 
;; == duplicated ==      ;;    	     "runtests" 
;; == duplicated ==      ;;    	     user
;; == duplicated ==      ;;    	     target
;; == duplicated ==      ;;    	     runname
;; == duplicated ==      ;;    	     (args:get-arg "-runtests")
;; == duplicated ==      ;;    	     #f))))
;; == duplicated ==      (runs:run-tests target
;; == duplicated == 		     runname
;; == duplicated == 		     (common:args-get-testpatt #f) ;; (args:get-arg "-runtests")
;; == duplicated == 		     user
;; == duplicated == 		     args:arg-hash))))

;;======================================================================
;; Rollup into a run
;;======================================================================

(if (args:get-arg "-rollup")
    (general-run-call 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1685
1686
1687
1688
1689
1690
1691





















1692
1693
1694
1695
1696
1697
1698
;;    started and completed
;;    - step started, timestamp
;;    - step completed, exit status, timestamp
;; 6. test phone home
;;    - if test run time > allowed run time then kill job
;;    - if cannot access db > allowed disconnect time then kill job























;;======================================================================
;; Rollup into a run
;;======================================================================

(if (args:get-arg "-rollup")
    (general-run-call 
1795
1796
1797
1798
1799
1800
1801


















1802
1803
1804
1805
1806
1807
1808
(if (args:get-arg "-archive")
    ;; else do a general-run-call
    (general-run-call 
     "-archive"
     "Archive"
     (lambda (target runname keys keyvals)
       (operate-on 'archive))))



















;;======================================================================
;; Extract a spreadsheet from the runs database
;;======================================================================

(if (args:get-arg "-extract-ods")
    (general-run-call







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
(if (args:get-arg "-archive")
    ;; else do a general-run-call
    (general-run-call 
     "-archive"
     "Archive"
     (lambda (target runname keys keyvals)
       (operate-on 'archive))))

;; reduce-records and restore-records are similar to archiving
;;
(if (args:get-arg "-reduce-records")
    (general-run-call
     "-reduce-records"
     "reduce records"
     (lambda (target runname keys keyvals)
       (operate-on 'reduce-records)
       )))

(if (args:get-arg "-restore-records")
    (general-run-call
     "-reduce-records"
     "reduce records"
     (lambda (target runname keys keyvals)
       (operate-on 'restore-records)
       )))

;;======================================================================
;; Extract a spreadsheet from the runs database
;;======================================================================

(if (args:get-arg "-extract-ods")
    (general-run-call