Megatest

Changes On Branch ad2000389bacbff6
Login

Changes In Branch v1.65-junit-xml Through [ad2000389b] Excluding Merge-Ins

This is equivalent to a diff from 367ffc5bdf to ad2000389b

2020-05-31
21:19
Cherrypick 0495fb 2a858 from v1.65-broken. Better support for utilizing MT_ vars to fill defaults when -target, -testpatt, etc. are not specified check-in: 74a0e98868 user: mrwellan tags: v1.65
19:49
Cherrypick 0495fb 2a858 from v1.65-broken. check-in: fb39cefbf1 user: mrwellan tags: v1.65-cpick01
16:48
Pulled in changes only related to fixes from newview branch Closed-Leaf check-in: 4d6ba57051 user: matt tags: v1.65-oops-n
2020-05-27
14:13
Cherrypicked 5ea7 check-in: c13726326c user: pjhatwal tags: v1.65-junit-xml
13:11
Cherrypicked 76d6 check-in: ad2000389b user: pjhatwal tags: v1.65-junit-xml
12:46
Create new branch named "v1.65-junit-xml" check-in: 473d6eaf82 user: pjhatwal tags: v1.65-junit-xml
2020-04-20
21:49
Merged newview work into v1.65 to minimize divergences check-in: 3b86fd8d4c user: mrwellan tags: v1.65-broken
2020-04-06
16:21
Merged in v1.65 check-in: db55d34798 user: mrwellan tags: v1.65-newview
2020-03-10
15:14
merged branch check-in: 367ffc5bdf user: mmgraham tags: v1.65, v1.6545
15:14
Updated Version check-in: e1e57863ea user: jmoon18 tags: v1.65
2020-03-05
16:45
Fixed the removal of test and run directories. Leaf check-in: e24a447e39 user: mmgraham tags: v1.65-martins-stuff

Modified launch.scm from [6b5c8d69de] to [06437df700].

901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
           (running-cnt (rmt:get-count-tests-running-for-run-id run-id))
           (all-test-launched (rmt:get-var (conc "lunch-complete-" run-id)))
           (current-state (rmt:get-run-state run-id))
           (current-status (rmt:get-run-status run-id)))
     ;;get-vars run-id to query metadata table to check if all completed. if all-test-launched = yes then only not-completed-cnt = 0 means everyting is completed if no entry found in the table do nothing 
     (debug:print 0 *default-log-port* "rollup run state/status")                      
     (rmt:set-state-status-and-roll-up-run  run-id current-state current-status)
 
     (cond 
       ((and all-test-launched (eq? not-completed-cnt 0) (equal? all-test-launched "yes" ))
           	(debug:print 0 *default-log-port* "look for  post hook.")
          	(runs:run-post-hook run-id))
        ((> running-cnt 3) 
        	  (debug:print 0 *default-log-port* "There are " running-cnt " tests running." ))
        ((> running-cnt 0)







|







901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
           (running-cnt (rmt:get-count-tests-running-for-run-id run-id))
           (all-test-launched (rmt:get-var (conc "lunch-complete-" run-id)))
           (current-state (rmt:get-run-state run-id))
           (current-status (rmt:get-run-status run-id)))
     ;;get-vars run-id to query metadata table to check if all completed. if all-test-launched = yes then only not-completed-cnt = 0 means everyting is completed if no entry found in the table do nothing 
     (debug:print 0 *default-log-port* "rollup run state/status")                      
     (rmt:set-state-status-and-roll-up-run  run-id current-state current-status)
     (runs:update-junit-test-reporter-xml run-id) 
     (cond 
       ((and all-test-launched (eq? not-completed-cnt 0) (equal? all-test-launched "yes" ))
           	(debug:print 0 *default-log-port* "look for  post hook.")
          	(runs:run-post-hook run-id))
        ((> running-cnt 3) 
        	  (debug:print 0 *default-log-port* "There are " running-cnt " tests running." ))
        ((> running-cnt 0)

Modified runs.scm from [6cea658ad9] to [d2d22e6ef3].

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
;; 
;;     You should have received a copy of the GNU General Public License
;;     along with Megatest.  If not, see <http://www.gnu.org/licenses/>.

;;  strftime('%m/%d/%Y %H:%M:%S','now','localtime')

(use (prefix sqlite3 sqlite3:) srfi-1 posix regex regex-case srfi-69 (srfi 18) 
     posix-extras directory-utils pathname-expand typed-records format)

(declare (unit runs))
(declare (uses db))
(declare (uses common))
(declare (uses items))
(declare (uses runconfig))
(declare (uses tests))







|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
;; 
;;     You should have received a copy of the GNU General Public License
;;     along with Megatest.  If not, see <http://www.gnu.org/licenses/>.

;;  strftime('%m/%d/%Y %H:%M:%S','now','localtime')

(use (prefix sqlite3 sqlite3:) srfi-1 posix regex regex-case srfi-69 (srfi 18) 
     posix-extras directory-utils pathname-expand typed-records format  sxml-serializer sxml-modifications)

(declare (unit runs))
(declare (uses db))
(declare (uses common))
(declare (uses items))
(declare (uses runconfig))
(declare (uses tests))
2675
2676
2677
2678
2679
2680
2681
























































2682
2683
2684
2685
2686
2687
2688
	    (sqlite3:execute 
	     db 
	     (conc "INSERT OR REPLACE INTO test_data (test_id,category,variable,value,expected,tol,units,comment) "
		   "SELECT " (db:test-get-id new-testdat) ",category,variable,value,expected,tol,units,comment FROM test_data WHERE test_id=?;")
	     (db:test-get-id testdat))))
	 ))
     prev-tests)))
























































	 
     
;; clean cache files
(define (runs:clean-cache target runname toppath)
  (if target
      (if runname
	  (let* ((linktree (common:get-linktree)) ;; (if toppath (configf:lookup *configdat* "setup" "linktree")))







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
	    (sqlite3:execute 
	     db 
	     (conc "INSERT OR REPLACE INTO test_data (test_id,category,variable,value,expected,tol,units,comment) "
		   "SELECT " (db:test-get-id new-testdat) ",category,variable,value,expected,tol,units,comment FROM test_data WHERE test_id=?;")
	     (db:test-get-id testdat))))
	 ))
     prev-tests)))

(define doc 
  '(*TOP*
    (*PI* xml "version='1.0'")
    (testsuite)))

(define (runs:update-junit-test-reporter-xml run-id)
	(let*	((junit-test-reporter	(configf:lookup *configdat* "runs" "junit-test-reporter-xml"))
		(xml-dir		(if (and junit-test-reporter (equal? junit-test-reporter "yes" ))
						(conc (getenv "MT_LINKTREE") "/" (getenv "MT_TARGET") "/" (getenv "MT_RUNNAME"))
						#f))
		(xml-path		(if xml-dir
						(conc xml-dir "/junit-test-reporter.xml")
						#f))
		(xml-ts-name		(if xml-dir
						(conc (string-translate (getenv "MT_TARGET") "/" ".") "." (getenv "MT_RUNNAME"))
						#f))
		(test-data		(if xml-dir
						(rmt:get-tests-for-run run-id "%" '() '() ;; run-id testpatt states statuses
                                                      #f #f ;; offset limit
                                                      #f ;; not-in
                                                      #f ;; sort-by
                                                      #f ;; sort-order
                                                      #f ;; get full data (not 'shortlist)
                                                      0 ;; (runs:gendat-inc-results-last-update *runs:general-data*) ;; last update time
                                                      #f)
						'()))
		(tests-count		(if xml-dir (length test-data) #f)))
		(if (and junit-test-reporter (equal? junit-test-reporter "yes" ))
			(begin
                      (debug:print 0 *default-log-port* (conc "*********************************************\n Running junit-test-reporter at " xml-path"\n *****************************************"))
				((sxml-modify!  `("testsuite" insert-into (@ (name ,xml-ts-name) (tests ,tests-count)))) doc)
				(map (lambda (test)
					(let*	((test-name	(vector-ref test 2))
						(test-itempath	(vector-ref test 11))
						(tc-name	(conc test-name  (if (and test-itempath (not (equal? test-itempath "")))  (conc "." (string-translate test-itempath "/" "." )) "")))
						(test-state	(vector-ref test 3))
						(test-status	(vector-ref test 4)))
                                       ;(print test)
                                      (cond 
					((member test-state (list "LAUNCHED" "REMOTEHOSTSTART" "RUNNING" ))
						((sxml-modify! `("testsuite" insert-into (testcase (@ (name ,tc-name)) (inProgress (@ (type "inProgress")))))) doc))
					((member test-status (list "PASS" "WARN" "WAIVED"))
						((sxml-modify! `("testsuite" insert-into (testcase (@ (name ,tc-name))))) doc))
					((member test-status (list "FAIL" "CHECK"))
						((sxml-modify! `("testsuite" insert-into (testcase (@ (name ,tc-name)) (failure (@ (message "what to use?") (type "failure")))))) doc))
					((member test-status (list "DEAD" "KILLED" "ABORT" "PREQ_FAIL" "PREQ_DISCARDED"))
						((sxml-modify! `("testsuite" insert-into (testcase (@ (name ,tc-name)) (failure (@ (message "what to use?") (type "error")))))) doc))
					((member test-state (list "SKIP"))
						((sxml-modify! `("testsuite" insert-into (testcase (@ (name ,tc-name)) (skipped (@ (type "skipped")))))) doc))
                                      (else 
                                       (debug:print 0 *default-log-port* (conc "What do I do with State " test-state " Status " test-status))))))
			test-data)
			(with-output-to-file xml-path      (lambda ()
				(print (sxml-serializer#serialize-sxml doc  ns-prefixes: (list (cons 'gnm "http://foo"))))))))))

	 
     
;; clean cache files
(define (runs:clean-cache target runname toppath)
  (if target
      (if runname
	  (let* ((linktree (common:get-linktree)) ;; (if toppath (configf:lookup *configdat* "setup" "linktree")))