Overview
Comment: | Added built-in loadrunner into Megatest |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.55 |
Files: | files | file ages | folders |
SHA1: |
229f3fa92efccb0727ffe41f94a2ec36 |
User & Date: | matt on 2014-07-31 00:02:10 |
Other Links: | branch diff | manifest | tags |
Context
2014-07-31
| ||
00:16 | Corrected formating of info messages on load excess check-in: c15ca73559 user: matt tags: v1.55 | |
00:02 | Added built-in loadrunner into Megatest check-in: 229f3fa92e user: matt tags: v1.55 | |
2014-07-30
| ||
15:32 | Forcing synchronous to 0 check-in: b052a1ff92 user: mrwellan tags: v1.55 | |
Changes
Modified common.scm from [58265a2496] to [31132e4c26].
︙ | ︙ | |||
325 326 327 328 329 330 331 | (let ((newval (string->number (cadr match)))) (if (number? newval) (set! freespc newval)))))) (car df-results)) freespc)) (define (get-cpu-load) | > | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | (let ((newval (string->number (cadr match)))) (if (number? newval) (set! freespc newval)))))) (car df-results)) freespc)) (define (get-cpu-load) (car (common:get-cpu-load))) ;; (let* ((load-res (cmd-run->list "uptime")) ;; (load-rx (regexp "load average:\\s+(\\d+)")) ;; (cpu-load #f)) ;; (for-each (lambda (l) ;; (let ((match (string-search load-rx l))) ;; (if match ;; (let ((newval (string->number (cadr match)))) ;; (if (number? newval) ;; (set! cpu-load newval)))))) ;; (car load-res)) ;; cpu-load)) ;; get cpu load by reading from /proc/loadavg, return all three values ;; (define (common:get-cpu-load) (with-input-from-file "/proc/loadavg" (lambda ()(list (read)(read)(read))))) (define (common:wait-for-cpuload maxload numcpus waitdelay #!key (count 1000)) (let* ((loadavg (common:get-cpu-load)) (first (car loadavg)) (next (cadr loadavg)) (adjload (* maxload numcpus)) (loadjmp (- first next))) (cond ((and (> first adjload) (> count 0)) (print "waiting " waitdelay " seconds due to load " first " exceeding max of " adjload) (thread-sleep! waitdelay) (common:wait-for-cpuload maxload numcpus waitdelay count: (- count 1))) ((and (> loadjmp numcpus) (> count 0)) (print "waiting " waitdelay " seconds due to load jump " loadjmp " > numcpus " numcpus) (thread-sleep! waitdelay) (common:wait-for-cpuload maxload numcpus waitdelay count: (- count 1)))))) (define (common:get-num-cpus) (with-input-from-file "/proc/cpuinfo" (lambda () (let loop ((numcpu 0) (inl (read-line))) (if (eof-object? inl) numcpu (loop (if (string-match "^processor\\s+:\\s+\\d+$" inl) (+ numcpu 1) numcpu) (read-line))))))) (define (get-uname . params) (let* ((uname-res (cmd-run->list (conc "uname " (if (null? params) "-a" (car params))))) (uname #f)) (if (null? (car uname-res)) "unknown" (caar uname-res)))) |
︙ | ︙ |
Modified runs.scm from [7cf12a5297] to [3d2e89231a].
︙ | ︙ | |||
581 582 583 584 585 586 587 | (num-running (list-ref run-limits-info 1)) (num-running-in-jobgroup (list-ref run-limits-info 2)) (max-concurrent-jobs (list-ref run-limits-info 3)) (job-group-limit (list-ref run-limits-info 4)) (prereqs-not-met (mt:lazy-get-prereqs-not-met run-id waitons item-path mode: testmode itemmap: itemmap)) (fails (runs:calc-fails prereqs-not-met)) (non-completed (runs:calc-not-completed prereqs-not-met)) | | > > > > | 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | (num-running (list-ref run-limits-info 1)) (num-running-in-jobgroup (list-ref run-limits-info 2)) (max-concurrent-jobs (list-ref run-limits-info 3)) (job-group-limit (list-ref run-limits-info 4)) (prereqs-not-met (mt:lazy-get-prereqs-not-met run-id waitons item-path mode: testmode itemmap: itemmap)) (fails (runs:calc-fails prereqs-not-met)) (non-completed (runs:calc-not-completed prereqs-not-met)) (loop-list (list hed tal reg reruns)) ;; configure the load runner (numcpus (common:get-num-cpus)) (maxload (string->number (or (configf:lookup *configdat* "jobtools" "maxload") "3"))) (waitdelay (string->number (or (configf:lookup *configdat* "jobtools" "waitdelay") "60")))) (debug:print-info 4 "have-resources: " have-resources " prereqs-not-met: (" (string-intersperse (map (lambda (t) (if (vector? t) (conc (db:test-get-state t) "/" (db:test-get-status t)) (conc " WARNING: t is not a vector=" t ))) prereqs-not-met) ", ") ") fails: " fails) |
︙ | ︙ | |||
680 681 682 683 684 685 686 687 688 689 690 691 692 693 | (or (null? prereqs-not-met) (and (eq? testmode 'toplevel) (null? non-completed)))) ;; (hash-table-delete! *max-tries-hash* (runs:make-full-test-name test-name item-path)) ;; we are going to reset all the counters for test retries by setting a new hash table ;; this means they will increment only when nothing can be run (set! *max-tries-hash* (make-hash-table)) (run:test run-id run-info keyvals runname test-record flags #f test-registry all-tests-registry) (hash-table-set! test-registry (runs:make-full-test-name test-name item-path) 'running) (runs:shrink-can-run-more-tests-count) ;; DELAY TWEAKER (still needed?) ;; (thread-sleep! *global-delta*) (if (or (not (null? tal))(not (null? reg))) (list (runs:queue-next-hed tal reg reglen regfull) (runs:queue-next-tal tal reg reglen regfull) | > > > > | 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | (or (null? prereqs-not-met) (and (eq? testmode 'toplevel) (null? non-completed)))) ;; (hash-table-delete! *max-tries-hash* (runs:make-full-test-name test-name item-path)) ;; we are going to reset all the counters for test retries by setting a new hash table ;; this means they will increment only when nothing can be run (set! *max-tries-hash* (make-hash-table)) ;; well, first lets see if cpu load throttling is enabled. If so wait around until the ;; average cpu load is under the threshold before continuing (if (configf:lookup *configdat* "jobtools" "maxload") ;; only gate if maxload is specified (common:wait-for-cpuload maxload numcpus waitdelay)) (run:test run-id run-info keyvals runname test-record flags #f test-registry all-tests-registry) (hash-table-set! test-registry (runs:make-full-test-name test-name item-path) 'running) (runs:shrink-can-run-more-tests-count) ;; DELAY TWEAKER (still needed?) ;; (thread-sleep! *global-delta*) (if (or (not (null? tal))(not (null? reg))) (list (runs:queue-next-hed tal reg reglen regfull) (runs:queue-next-tal tal reg reglen regfull) |
︙ | ︙ |
Modified tests/fullrun/config/mt_include_1.config from [44520ee9a2] to [8efd108e44].
︙ | ︙ | |||
10 11 12 13 14 15 16 | ## by megatest, comment out launcher to run local # workhosts localhost hermes # launcher exec nbfake # launcher nbfake # launcher echo # launcher nbfind # launcher nodanggood | | > > > > > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## by megatest, comment out launcher to run local # workhosts localhost hermes # launcher exec nbfake # launcher nbfake # launcher echo # launcher nbfind # launcher nodanggood # launcher loadrunner launcher nbfake # maxload *per cpu* maxload 4 # default waitdelay is 60 seconds waitdelay 15 ## use "xterm -e csi -- " as a launcher to examine the launch environment. ## exit with (exit) ## get a shell with (system "bash") # launcher xterm -e csi -- |
tests/installall/config/megatest.config.dat became a symlink with target [736a5da885].
tests/installall/config/runconfigs.config.dat became a symlink with target [3b8f260acb].
Added utils/loadrunner.scm.notfinished version [a8651ba3f3].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | ;; Copyright 2006-2013, Matthew Welland. ;; ;; This program is made available under the GNU GPL version 2.0 or ;; greater. See the accompanying file COPYING for details. ;; ;; This program is distributed WITHOUT ANY WARRANTY; without even the ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. (use ssax) (use sxml-serializer) (use sxml-modifications) (use regex) (use srfi-69) (use regex-case) (use posix) (use json) (use csv) (use srfi-18) (use format) (require-library iup) (import (prefix iup iup:)) (require-library ini-file) (import (prefix ini-file ini:)) (use canvas-draw) (import canvas-draw-iup) (use sqlite3 srfi-1 posix regex regex-case srfi-69) (import (prefix sqlite3 sqlite3:)) (include "megatest-fossil-hash.scm") ;; ;; GLOBALS ;; (define *loadrunner:current-tab-number* 0) (define loadrunner:unrecognised-command "ERROR: Unrecognised command or missing params. Try \"loadrunner help\"") (define loadrunner:help (conc "Usage: loadrunner [action [params ...]] Note: run loadrunner without parameters to start the gui. run cmd [params ..] : Run cmd params ... when system load drops process : Process the queue Part of the Megatest tool suite. Learn more at http://www.kiatoa.com/fossils/megatest Version: " megatest-fossil-hash)) ;; " ;;====================================================================== ;; DB ;;====================================================================== (define (loadrunner:initialize-db db) (for-each (lambda (qry) (sqlite3:execute db qry)) (list "CREATE TABLE pkgs (id INTEGER PRIMARY KEY, cmd TEXT, datetime TEXT);"))) ;; Create the sqlite db (define (loadrunner:open-db path) (if (and path (directory? path) (file-read-access? path)) (let* ((dbpath (conc path "/loadrunner.db")) (writeable (file-write-access? dbpath)) (dbexists (file-exists? dbpath)) (handler (make-busy-timeout 136000))) (handle-exceptions exn (begin (debug:print 2 "ERROR: problem accessing db " dbpath ((condition-property-accessor 'exn 'message) exn)) (exit)) (set! db (sqlite3:open-database dbpath))) (if *db-write-access* (sqlite3:set-busy-handler! db handler)) (if (not dbexists) (begin (loadrunner:initialize-db db))) db))) ;;====================================================================== ;; GUI ;;====================================================================== ;; The main menu (define (loadrunner:main-menu) (iup:menu ;; a menu is a special attribute to a dialog (think Gnome putting the menu at screen top) (iup:menu-item "Files" (iup:menu ;; Note that you can use either #:action or action: for options (iup:menu-item "Open" action: (lambda (obj) (iup:show (iup:file-dialog)) (print "File->open " obj))) (iup:menu-item "Save" #:action (lambda (obj)(print "File->save " obj))) (iup:menu-item "Exit" #:action (lambda (obj)(exit))))) (iup:menu-item "Tools" (iup:menu (iup:menu-item "Create new blah" #:action (lambda (obj)(print "Tools->new blah"))) ;; (iup:menu-item "Show dialog" #:action (lambda (obj) ;; (show message-window ;; #:modal? #t ;; ;; set positon using coordinates or center, start, top, left, end, bottom, right, parent-center, current ;; ;; #:x 'mouse ;; ;; #:y 'mouse ;; ) )))) (define (loadrunner:publish-view) (iup:vbox (iup:hbox (iup:button "Pushme" #:expand "YES" )))) (define (loadrunner:get-view) (iup:vbox (iup:hbox (iup:button "Pushme" #:expand "YES" )))) (define (loadrunner:manage-view) (iup:vbox (iup:hbox (iup:button "Pushme" #:expand "YES" )))) (define (loadrunner:gui) (iup:show (iup:dialog #:title (conc "Loadrunner dashboard " (current-user-name) ":" (current-directory)) #:menu (loadrunner:main-menu) (let* ((tabs (iup:tabs #:tabchangepos-cb (lambda (obj curr prev) (set! *loadrunner:current-tab-number* curr)) (loadrunner:publish-view) (loadrunner:get-view) (loadrunner:manage-view) ))) ;; (set! (iup:callback tabs tabchange-cb:) (lambda (a b c)(print "SWITCHED TO TAB: " a " " b " " c))) (iup:attribute-set! tabs "TABTITLE0" "Publish") (iup:attribute-set! tabs "TABTITLE1" "Get") (iup:attribute-set! tabs "TABTITLE2" "Manage") ;; (iup:attribute-set! tabs "BGCOLOR" "190 190 190") tabs))) (iup:main-loop)) ;;====================================================================== ;; MAIN ;;====================================================================== (define (loadrunner:load-config path) (let ((fname (conc path "/.loadrunner.config"))) (ini:property-separator-patt " * *") (ini:property-separator #\space) (if (file-exists? fname) (ini:read fname) '()))) (define (main) (let* ((args (argv)) (prog (car args)) (rema (cdr args)) (conf (loadrunner:load-config (pathname-directory prog)))) ;; ( ????? (cond ((eq? (length rema) 1) (case (string->symbol (car rema)) ((process)(loadrunner:process-queue)) ((pause) (loadrunner:pause-queue (cdr rema))) ((help -h -help --h --help) (print loadrunner:help)) (else (print loadrunner:unrecognised-command)))) ((null? rema)(loadrunner:gui)) ((>= (length rema) 2) (case (string->symbol (car rema)) ((run) (loadrunner:process-cmd (cdr rema))) ((remove) (loadrunner:remove-cmds (cdr rema))) (else (print loadrunner:unrecognised-command)))) (else (print loadrunner:unrecognised-command))))) (main) |