Megatest

Check-in [fa1cd94204]
Login
Overview
Comment:Added run_id as key on setting test state and status (used in cleaning up before running)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | run-launch-cleanup
Files: files | file ages | folders
SHA1: fa1cd942045a5a68c5887fac69c8d4b90daa9b1a
User & Date: mrwellan on 2011-07-12 17:25:37
Other Links: branch diff | manifest | tags
Context
2011-07-12
23:46
Crude fix on exiting when have bad launcher Closed-Leaf check-in: 318b48cb2a user: matt tags: run-launch-cleanup
17:25
Added run_id as key on setting test state and status (used in cleaning up before running) check-in: fa1cd94204 user: mrwellan tags: run-launch-cleanup
16:55
Refactor launch and run code check-in: 1d078c2e7b user: mrwellan tags: run-launch-cleanup
Changes

Modified db.scm from [80b3c65cff] to [5c1eda37b3].

225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
;; use currstate = #f and or currstatus = #f to apply to any state or status respectively
;; WARNING: SQL injection risk
(define (db:set-tests-state-status db run-id testnames currstate currstatus newstate newstatus)
  (for-each (lambda (testname)
	      (let ((qry (conc "UPDATE tests SET state=?,status=? WHERE "
					(if currstate  (conc "state='" currstate "' AND ") "")
					(if currstatus (conc "status='" currstatus "' AND ") "")
					" testname=? AND NOT (item_path='' AND testname in (SELECT DISTINCT testname FROM tests WHERE testname=? AND item_path != ''));")))
		;;(debug:print 0 "QRY: " qry)
		(sqlite3:execute db qry newstate newstatus testname testname)))
	    testnames))

(define (db:delete-tests-in-state db run-id state)
  (sqlite3:execute db "DELETE FROM tests WHERE state=? AND run_id=?;" state run-id))

(define (db:test-set-state-status-by-id db test-id newstate newstatus newcomment)
  (if newstate   (sqlite3:execute db "UPDATE tests SET state=?   WHERE id=?;" newstate   test-id))







|

|







225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
;; use currstate = #f and or currstatus = #f to apply to any state or status respectively
;; WARNING: SQL injection risk
(define (db:set-tests-state-status db run-id testnames currstate currstatus newstate newstatus)
  (for-each (lambda (testname)
	      (let ((qry (conc "UPDATE tests SET state=?,status=? WHERE "
					(if currstate  (conc "state='" currstate "' AND ") "")
					(if currstatus (conc "status='" currstatus "' AND ") "")
					" run_id=? AND testname=? AND NOT (item_path='' AND testname in (SELECT DISTINCT testname FROM tests WHERE testname=? AND item_path != ''));")))
		;;(debug:print 0 "QRY: " qry)
		(sqlite3:execute db qry run-id newstate newstatus testname testname)))
	    testnames))

(define (db:delete-tests-in-state db run-id state)
  (sqlite3:execute db "DELETE FROM tests WHERE state=? AND run_id=?;" state run-id))

(define (db:test-set-state-status-by-id db test-id newstate newstatus newcomment)
  (if newstate   (sqlite3:execute db "UPDATE tests SET state=?   WHERE id=?;" newstate   test-id))