Megatest

Check-in [f40041db73]
Login
Overview
Comment:Make -import-sexpr work when the run or test already exists - dont try to overwrite
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.71
Files: files | file ages | folders
SHA1: f40041db73b12c99689d44b855d91308a80e9980
User & Date: mmgraham on 2024-04-05 22:04:08
Other Links: branch diff | manifest | tags
Context
2024-04-08
11:05
Changed version to v1.7102 check-in: c719bc2748 user: mmgraham tags: v1.71, v1.7102
2024-04-05
22:04
Make -import-sexpr work when the run or test already exists - dont try to overwrite check-in: f40041db73 user: mmgraham tags: v1.71
17:48
Got -import-sexpr working check-in: 2de9c99941 user: mmgraham tags: v1.71
Changes

Modified db.scm from [6048756900] to [c536b1d8e4].

1718
1719
1720
1721
1722
1723
1724
1725

1726
1727
1728
1729
1730
1731
1732
	   )
    (debug:print-info 11 *default-log-port* "db:simple-get-runs START qrystr: " qrystr " target: " target " offset: " offset " limit: " count)
    (db:with-db dbstruct #f #f
		(lambda (dbdat db)		
		  (sqlite3:for-each-row
		   (lambda (target id runname state status owner event_time)
		     (set! res (cons (make-simple-run target id runname state status owner event_time) res))
                     (debug:print-info 0 *default-log-port* "db:simple-get-runs: res = " res))

		   db
		   qrystr
		   )))
    (debug:print-info 11 *default-log-port* "db:simple-get-runs END qrystr: " qrystr " target: " target " offset: " offset " limit: " count)
    res))

;; TODO: Switch this to use max(update_time) from each run db? Then if using a server there is no disk traffic (using inmem db)







<
>







1718
1719
1720
1721
1722
1723
1724

1725
1726
1727
1728
1729
1730
1731
1732
	   )
    (debug:print-info 11 *default-log-port* "db:simple-get-runs START qrystr: " qrystr " target: " target " offset: " offset " limit: " count)
    (db:with-db dbstruct #f #f
		(lambda (dbdat db)		
		  (sqlite3:for-each-row
		   (lambda (target id runname state status owner event_time)
		     (set! res (cons (make-simple-run target id runname state status owner event_time) res))

                   )
		   db
		   qrystr
		   )))
    (debug:print-info 11 *default-log-port* "db:simple-get-runs END qrystr: " qrystr " target: " target " offset: " offset " limit: " count)
    res))

;; TODO: Switch this to use max(update_time) from each run db? Then if using a server there is no disk traffic (using inmem db)

Modified megatest.scm from [2dbfd5dfe6] to [0a3a4d7312].

2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
       'dejunk
       'adj-testids
       'old2new
       )
      (set! *didsomething* #t)))

(if (args:get-arg "-import-sexpr")
  (let* (
   (toppath (launch:setup))
   (tmppath (common:make-tmpdir-name toppath "")))
   (if (file-exists? (conc toppath "/.mtdb")) 
     (if (args:get-arg "-remove-dbs")
       (let* ((dbfiles (conc toppath "/.mtdb/* " tmppath "/*")))
        (debug:print 0 *default-log-port* "Removing db files: " dbfiles)
        (system (conc "rm -rvf " dbfiles))
       )
       (begin
         (debug:print 0 *default-log-port* "ERROR: Cannot import sexpr with an existing DB present.")
         (debug:print 0 *default-log-port* "Add '-remove-dbs all'  to remove the current Megatest DBs.")
         (set! *didsomething* #t)
         (exit)
       )
     )
   )
   (db:setup #f)
   (rmt:import-sexpr (args:get-arg "-import-sexpr"))
   (set! *didsomething* #t)))

(when (args:get-arg "-sync-brute-force")
  (launch:setup)
  ((server:get-bruteforce-syncer (db:setup #t) persist-until-sync: #t))
  (set! *didsomething* #t))







<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
|







2486
2487
2488
2489
2490
2491
2492









2493







2494
2495
2496
2497
2498
2499
2500
2501
       'dejunk
       'adj-testids
       'old2new
       )
      (set! *didsomething* #t)))

(if (args:get-arg "-import-sexpr")









   (begin







   (launch:setup)
   (rmt:import-sexpr (args:get-arg "-import-sexpr"))
   (set! *didsomething* #t)))

(when (args:get-arg "-sync-brute-force")
  (launch:setup)
  ((server:get-bruteforce-syncer (db:setup #t) persist-until-sync: #t))
  (set! *didsomething* #t))

Modified rmt.scm from [09dd1a2058] to [df8aa04bdb].

1157
1158
1159
1160
1161
1162
1163
1164






1165
1166




1167
1168
1169
       (begin
	(simple-run-id (car runs))
       ))))


(define (rmt:insert-test run-id test-rec)
  (let* ((testname  (alist-ref "testname" test-rec equal?))
	 (item-path (alist-ref "item_path" test-rec equal?)))






    (debug:print 0 *default-log-port* " Insert test in run "run-id": "testname"/"item-path)
    (rmt:send-receive 'insert-test run-id test-rec)))














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



1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
       (begin
	(simple-run-id (car runs))
       ))))


(define (rmt:insert-test run-id test-rec)
  (let* ((testname  (alist-ref "testname" test-rec equal?))
	 (item-path (alist-ref "item_path" test-rec equal?))
         (test-id (rmt:get-test-id run-id testname item-path))
         )

    (if test-id
       (debug:print 0 *default-log-port* "test "testname"/"item-path " already exists in run-id " run-id)
       (begin
         (debug:print 0 *default-log-port* " Insert test in run "run-id": "testname"/"item-path)
         (rmt:send-receive 'insert-test run-id test-rec)
       )
    )
  )
)