Megatest

Check-in [65f26a2bbf]
Login
Overview
Comment:pulled changes to loadrunner from v1.60 branch. Added -run-wait support to run queue.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.55
Files: files | file ages | folders
SHA1: 65f26a2bbf755cffec6c37aa70996cc380dd4a83
User & Date: matt on 2014-07-23 23:21:48
Other Links: branch diff | manifest | tags
Context
2014-07-24
00:04
test4 will use -run-wait rather than -preclean check-in: 28ec0ec411 user: matt tags: v1.55
2014-07-23
23:21
pulled changes to loadrunner from v1.60 branch. Added -run-wait support to run queue. check-in: 65f26a2bbf user: matt tags: v1.55
18:08
Unfinished -run-wait work check-in: 0bc44e3515 user: mrwellan tags: v1.55
Changes

Modified db.scm from [910a3594d9] to [61d06ab7ee].

1295
1296
1297
1298
1299
1300
1301


1302
1303







1304
1305
1306
1307

1308

1309
1310
1311
1312
1313
1314
1315
1295
1296
1297
1298
1299
1300
1301
1302
1303


1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315

1316
1317
1318
1319
1320
1321
1322
1323







+
+
-
-
+
+
+
+
+
+
+




+
-
+







    (sqlite3:for-each-row
     (lambda (count)
       (set! res count))
     db
     "SELECT count(id) FROM tests WHERE state in ('RUNNING','LAUNCHED','REMOTEHOSTSTART') AND run_id NOT IN (SELECT id FROM runs WHERE state='deleted') AND NOT (uname = 'n/a' AND item_path = '');")
    res))

;; override states to count with list of strings.
;;
(define (db:get-count-tests-running-for-run-id db run-id)
  (let ((res 0))
(define (db:get-count-tests-running-for-run-id db run-id states)
  (let ((res 0)
	(sqrystr (conc "SELECT count(id) FROM tests WHERE state in ('"
		       (if states
			   (string-intersperse states "','")
			   "RUNNING','LAUNCHED','REMOTEHOSTSTART")
		       "') AND run_id=? AND NOT (uname = 'n/a' AND item_path = '');")))
    (sqlite3:for-each-row
     (lambda (count)
       (set! res count))  ;; select * from tests where run_id=1 and uname = 'n/a' and item_path='';
     db
     sqrystr run-id)
     "SELECT count(id) FROM tests WHERE state in ('RUNNING','LAUNCHED','REMOTEHOSTSTART') AND run_id=? AND NOT (uname = 'n/a' AND item_path = '');" run-id)
     ;; "SELECT count(id) FROM tests WHERE state in ('RUNNING','LAUNCHED','REMOTEHOSTSTART') AND run_id=? AND NOT (uname = 'n/a' AND item_path = '');" run-id)
    res))

(define (db:get-running-stats db)
  (let ((res '()))
    (sqlite3:for-each-row
     (lambda (state count)
       (set! res (cons (list state count) res)))

Modified runs.scm from [e63d1d9f28] to [cd8c6d3d5e].

877
878
879
880
881
882
883
884

885
886
887
888
889
890
891
877
878
879
880
881
882
883

884
885
886
887
888
889
890
891







-
+







	     (priority    (tests:testqueue-get-priority   test-record))
	     (itemdat     (tests:testqueue-get-itemdat    test-record)) ;; itemdat can be a string, list or #f
	     (items       (tests:testqueue-get-items      test-record))
	     (item-path   (item-list->path itemdat))
	     (tfullname   (runs:make-full-test-name test-name item-path))
	     (newtal      (append tal (list hed)))
	     (regfull     (>= (length reg) reglen))
	     (num-running (cdb:remote-run db:get-count-tests-running-for-run-id #f run-id)))
	     (num-running (cdb:remote-run db:get-count-tests-running-for-run-id #f run-id #f)))

      (if (> num-running 0)
	  (set! last-time-some-running (current-seconds)))

      (if (> (current-seconds)(+ last-time-some-running 240))
	  (hash-table-set! *max-tries-hash* tfullname (+ (hash-table-ref/default *max-tries-hash* tfullname 0) 1)))
	;; (debug:print 0 "max-tries-hash: " (hash-table->alist *max-tries-hash*))
1038
1039
1040
1041
1042
1043
1044









1045

1046
1047
1048
1049
1050
1051
1052
1053
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053

1054

1055
1056
1057
1058
1059
1060
1061







+
+
+
+
+
+
+
+
+
-
+
-







	 ((not (null? tal))
	  (debug:print-info 4 "I'm pretty sure I shouldn't get here."))
	 ((not (null? reg)) ;; could we get here with leftovers?
	  (debug:print-info 0 "Have leftovers!")
	  (loop (car reg)(cdr reg) '() reruns))
	 (else
	  (debug:print-info 4 "Exiting loop with...\n  hed=" hed "\n  tal=" tal "\n  reruns=" reruns))
	 ))
	;; now *if* -run-wait we wait for all tests to be done
      (let loop ((num-running (cdb:remote-run db:get-count-tests-running-for-run-id #f run-id #f)))
	(if (and (args:get-arg "-run-wait")
		 (> num-running 0))
	    (begin
	      (debug:print-info 0 "-run-wait specified, waiting on " num-running " tests in RUNNING, REMOTEHOSTSTART or LAUNCHED state.")
	      (thread-sleep! 15)
	      (loop (cdb:remote-run db:get-count-tests-running-for-run-id #f run-id #f)))))
	 ))) ;; LET* ((test-record
      ) ;; LET* ((test-record
    
    ;; we get here on "drop through". All done!
    (debug:print-info 1 "All tests launched")))

(define (runs:calc-fails prereqs-not-met)
  (filter (lambda (test)
	    (and (vector? test) ;; not (string? test))
		 (equal? (db:test-get-state test) "COMPLETED")

tests/installall/config/megatest.config.dat became a symlink with target [736a5da885].

tests/installall/config/runconfigs.config.dat became a symlink with target [3b8f260acb].

Modified utils/loadrunner from [47902305ee] to [ba6e3962e1].

43
44
45
46
47
48
49

50
51
52
53
54
55
56
57
58
59
60

61
62
63
64
65
66

67
68

69
70
71
72
73
74
75

76
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

61
62
63
64
65
66

67
68
69
70
71
72
73
74
75
76

77
78







+










-
+





-
+


+






-
+

    numcpu=2
fi

# NB// max_load is in units of percent.
#
lperc=$(echo "100 * $load / $numcpu"|bc)
lperc2=$(echo "100 * $load2 / $numcpu"|bc)
let "lperc2adj=$lperc2 + $numcpu"
if [[ "x$MAX_ALLOWED_LOAD" == "x" ]]; then
  max_load=100
else
  max_load=$MAX_ALLOWED_LOAD
fi

lfile=/tmp/loadrunner-$USER.lockfile
lockfile -r 5 -l 60 $lfile &> /dev/null

if [[  $lperc -lt $max_load ]];then
  if [[ $lperc -le $lperc2 ]];then
  if [[ $lperc -le $lperc2adj ]];then
    # echo "Load acceptable: lperc=$lperc %, max_load=$max_load %, load=$load, numcpu=$numcpu, MAX_ALLOWED_LOAD=$MAX_ALLOWED_LOAD % and $lperc2 < $lperc"
    # echo "Starting command: \"$@\""
    launchjob "$@"
    # we sleep ten seconds here to keep the lock a little longer and give time for
    # the uptime to show a response
    sleep 10
    # sleep 2
  else
   echo "$LOADRUNNER $@" | at now + 2 minutes &> /dev/null
   # sleep 5
  fi
else
  # echo "Load too high: lperc=$lperc, max_load=$max_load, waiting two minutes before trying to run command: \"$@\""
  echo "$LOADRUNNER $@" | at now + 2 minutes &> /dev/null
fi

sleep $(get_delay_time 10)
sleep $(get_delay_time 3)
rm -f $lfile