Megatest

Changes On Branch 326c8c284032a2cb
Login

Changes In Branch list-runs-json Excluding Merge-Ins

This is equivalent to a diff from eb760222b4 to 326c8c2840

2015-03-15
22:44
Merged in json output for -list-runs. Bumped version to 1.6009. check-in: b63a26d1e6 user: matt tags: v1.60
2015-03-12
16:04
Started adding json support for list runs Closed-Leaf check-in: 326c8c2840 user: mrwellan tags: list-runs-json
2015-03-11
23:49
Attempt to add ITEM_CALC and QUEUED statuses. Caused problems Closed-Leaf check-in: f12afe92f6 user: matt tags: item_calc-queued
23:31
Moved loading of format module later to avoid strange crashes in read-only areas check-in: eb760222b4 user: matt tags: v1.60
2015-03-09
05:20
Bumping version check-in: 41f22e34be user: matt tags: v1.60

Modified megatest.scm from [eecae44588] to [a5b2922c14].

876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895



896
897
898
899
900
901
902
903
904
905
906
907





908
909
910
911



912
913
914
915
916
917
918
;;======================================================================

;; NOTE: list-runs and list-db-targets operate on local db!!!
;;
(if (or (args:get-arg "-list-runs")
	(args:get-arg "-list-db-targets"))
    (if (launch:setup-for-run)
	(let* ((dbstruct (make-dbr:dbstruct path: *toppath* local: #t))
	       (runpatt  (args:get-arg "-list-runs"))
	       (testpatt (if (args:get-arg "-testpatt") 
			     (args:get-arg "-testpatt") 
			     "%"))
	       (keys     (db:get-keys dbstruct))
	       ;; (runsdat  (db:get-runs dbstruct runpatt #f #f '()))
	       (runsdat  (db:get-runs-by-patt dbstruct keys (or runpatt "%") (common:args-get-target)
					 #f #f))
		;; (cdb:remote-run db:get-runs #f runpatt #f #f '()))
	       (runs     (db:get-rows runsdat))
	       (header   (db:get-header runsdat))
	       (db-targets (args:get-arg "-list-db-targets"))



	       (seen     (make-hash-table)))
	  ;; Each run
	  (for-each 
	   (lambda (run)
	     (let ((targetstr (string-intersperse (map (lambda (x)
							 (db:get-value-by-header run header x))
						       keys) "/")))
	       (if db-targets
		   (if (not (hash-table-ref/default seen targetstr #f))
		       (begin
			 (hash-table-set! seen targetstr #t)
			 ;; (print "[" targetstr "]"))))





			 (print targetstr))))
	       (if (not db-targets)
		   (let* ((run-id (db:get-value-by-header run header "id"))
			  (tests  (db:get-tests-for-run dbstruct run-id testpatt '() '() #f #f #f 'testname 'asc #f)))



		     (print "Run: " targetstr "/" (db:get-value-by-header run header "runname") 
			    " status: " (db:get-value-by-header run header "state")
			    " run-id: " run-id ", number tests: " (length tests))
		     (for-each 
		      (lambda (test)
			(handle-exceptions
			 exn







|
|
|
|
|
|

|
|

|
|

>
>
>
|











>
>
>
>
>
|
<
|
|
>
>
>







876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916

917
918
919
920
921
922
923
924
925
926
927
928
;;======================================================================

;; NOTE: list-runs and list-db-targets operate on local db!!!
;;
(if (or (args:get-arg "-list-runs")
	(args:get-arg "-list-db-targets"))
    (if (launch:setup-for-run)
	(let* ((dbstruct   (make-dbr:dbstruct path: *toppath* local: #t))
	       (runpatt    (args:get-arg "-list-runs"))
	       (testpatt   (if (args:get-arg "-testpatt") 
			       (args:get-arg "-testpatt") 
			       "%"))
	       (keys       (db:get-keys dbstruct))
	       ;; (runsdat  (db:get-runs dbstruct runpatt #f #f '()))
	       (runsdat    (db:get-runs-by-patt dbstruct keys (or runpatt "%") (common:args-get-target)
						#f #f))
		;; (cdb:remote-run db:get-runs #f runpatt #f #f '()))
	       (runs       (db:get-rows runsdat))
	       (header     (db:get-header runsdat))
	       (db-targets (args:get-arg "-list-db-targets"))
	       (mode       (let ((dmode (args:get-arg "-dumpmode")))
			     (if dmode (string->symbol dmode) #f)))
	       (seen       (make-hash-table))
	       (data       (make-hash-table))) ;; target -> 
	  ;; Each run
	  (for-each 
	   (lambda (run)
	     (let ((targetstr (string-intersperse (map (lambda (x)
							 (db:get-value-by-header run header x))
						       keys) "/")))
	       (if db-targets
		   (if (not (hash-table-ref/default seen targetstr #f))
		       (begin
			 (hash-table-set! seen targetstr #t)
			 ;; (print "[" targetstr "]"))))
			 (case mode
			   ((json)
			    (hash-table-set! data targetstr
					     (or (hash-table-ref/default data targetstr #f)(make-hash-table))))
			   (else 
			    (print targetstr)))))

		   (let* ((run-id   (db:get-value-by-header run header "id"))
			  (tests    (db:get-tests-for-run dbstruct run-id testpatt '() '() #f #f #f 'testname 'asc #f))
			  (run-data (hash-table-set! 
		     (case mode
		       ((json)
		     (print "Run: " targetstr "/" (db:get-value-by-header run header "runname") 
			    " status: " (db:get-value-by-header run header "state")
			    " run-id: " run-id ", number tests: " (length tests))
		     (for-each 
		      (lambda (test)
			(handle-exceptions
			 exn
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
			(if (not (or (equal? (db:test-get-status test) "PASS")
			   	     (equal? (db:test-get-status test) "WARN")
				     (equal? (db:test-get-state test)  "NOT_STARTED")))
			    (begin
			      (print   "         cpuload:  " (db:test-get-cpuload test)
				     "\n         diskfree: " (db:test-get-diskfree test)
				     "\n         uname:    " ;; (sdb:qry 'getstr 
				     (db:test-get-uname test) ;; )
				     "\n         rundir:   " ;; (sdb:qry 'getstr ;; (filedb:get-path *fdb* 
				     (db:test-get-rundir test) ;; )
				     )
			      ;; Each test
			      ;; DO NOT remote run
			      (let ((steps (db:get-steps-for-test dbstruct run-id (db:test-get-id test))))
				(for-each 







|







941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
			(if (not (or (equal? (db:test-get-status test) "PASS")
			   	     (equal? (db:test-get-status test) "WARN")
				     (equal? (db:test-get-state test)  "NOT_STARTED")))
			    (begin
			      (print   "         cpuload:  " (db:test-get-cpuload test)
				     "\n         diskfree: " (db:test-get-diskfree test)
				     "\n         uname:    " ;; (sdb:qry 'getstr 
			 	     (db:test-get-uname test) ;; )
				     "\n         rundir:   " ;; (sdb:qry 'getstr ;; (filedb:get-path *fdb* 
				     (db:test-get-rundir test) ;; )
				     )
			      ;; Each test
			      ;; DO NOT remote run
			      (let ((steps (db:get-steps-for-test dbstruct run-id (db:test-get-id test))))
				(for-each