Megatest

Check-in [775941d835]
Login
Overview
Comment:updated runs view to grab runs from pgsql
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.64
Files: files | file ages | folders
SHA1: 775941d83559e645177597167f8bb497ec54a5c1
User & Date: pjhatwal on 2017-03-03 18:11:27
Other Links: branch diff | manifest | tags
Context
2017-03-05
21:05
Migrated to slightly more complex syntax for areas, triggers, contours etc. to add some needed flexibility check-in: 8a9ac840a2 user: matt tags: v1.64
2017-03-03
18:11
updated runs view to grab runs from pgsql check-in: 775941d835 user: pjhatwal tags: v1.64
15:00
removed duplicate rows check-in: 667aa76ce0 user: pjhatwal tags: v1.64
Changes

Modified cgisetup/models/pgdb.scm from [4312bc0643] to [7172be12b3].

197
198
199
200
201
202
203





204
205
206
207
208
209
210
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215







+
+
+
+
+







		dbh
		"SELECT DISTINCT target FROM runs WHERE target LIKE ? AND ttype_id=?;" target-patt tt-id))
	 ))
     ttypes)))

(define (pgdb:get-targets-of-type dbh ttype-id target-patt)
  (dbi:get-rows dbh "SELECT DISTINCT target FROM runs WHERE target LIKE ? AND ttype_id=?;" target-patt ttype-id))

(define (pgdb:get-runs-by-target dbh targets)
   (dbi:get-rows dbh "SELECT r.run_name, t.test_name, t.status, t.item_path FROM runs as r INNER JOIN tests AS t ON t.run_id=r.id  
                          WHERE t.state='COMPLETED' AND r.target like ?;" targets)
)

;;======================================================================
;;  V A R I O U S   D A T A   M A S S A G E   R O U T I N E S
;;======================================================================

;; probably want to move these to a different model file

227
228
229
230
231
232
233














232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252







+
+
+
+
+
+
+
+
+
+
+
+
+
+
	      (coldat (hash-table-ref/default data first #f)))
	 (if (not coldat)(let ((newht (make-hash-table)))
			   (hash-table-set! data first newht)
			   (set! coldat newht)))
	 (hash-table-set! coldat rest run)))
     runs)
    data))

(define (pgdb:runs-to-hash runs )
  (let* ((data  (make-hash-table)))
    (for-each
     (lambda (run)
       (let* ((run-name (vector-ref run 0))
	      (test (conc (vector-ref run 1) ":" (vector-ref run 3)))
	      (coldat (hash-table-ref/default data run-name #f)))
	 (if (not coldat)(let ((newht (make-hash-table)))
			   (hash-table-set! data run-name newht)
			   (set! coldat newht)))
	 (hash-table-set! coldat test run)))
     runs)
    data))

Modified cgisetup/pages/home_view.scm from [258ad44e84] to [482e6a54de].

59
60
61
62
63
64
65



66
67
68
69
70
71

72
73
74
75
76
77
78
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

74
75
76
77
78
79
80
81







+
+
+





-
+







	     ;; 	      (map (lambda (target-var)
	     ;; 		     (s:div 'class "col_1" (s:input 'type "checkbox" 'name "row-or-col" 'value target-var
	     ;; 						    ;; this silly trick preserves the checkmark
	     ;; 						    (if (member target-var row-or-col) 'checked "")
	     ;; 						    "")))
	     ;; 		   all-parts))
	     ))
           (s:br) 
           (s:p "  Result Format:   total / pass / fail / other")

	   (s:fieldset
	    (conc "Runs data for " tfilter)
	    ;;
	    ;; A very basic display
	    ;;
	    (let* ((a-keys (sort (hash-table-keys ordered-data) string>=?))
            	    (let* ((a-keys (sort (hash-table-keys ordered-data) string>=?))
		   (b-keys (delete-duplicates(sort (apply
				  append
				  (map (lambda (sub-key)
					 (let ((subdat (hash-table-ref ordered-data sub-key)))
					   (hash-table-keys subdat)))
				       a-keys))
				 string>=?))))

Modified cgisetup/pages/run_view.scm from [c41e1c874c] to [eebc3b006f].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15




16
17
18
19






























20
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













-
-
+
+
+
+


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

;;======================================================================
;; Copyright 2017, 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.
;;======================================================================

(define (pages:run session db shared)
  (let* ((dbh         (s:db))
	 (target      (s:get-param 'target)))
    
	 (target      (string-substitute  "_x_"  "/" (s:get-param 'target) 'all))
         (runs (pgdb:get-runs-by-target dbh target))
         (ordered-runs (pgdb:runs-to-hash runs)))
   
    (s:div 'class "col_12"
	   (s:fieldset
	    "Show a run"
	    target))))
	   (conc "Show a runs for Target: " target)
             (let* ((a-keys (sort (hash-table-keys ordered-runs) string>=?))
		   (b-keys (delete-duplicates(sort (apply
				  append
				  (map (lambda (sub-key)
					 (let ((subdat (hash-table-ref ordered-runs sub-key)))
					   (hash-table-keys subdat)))
				       a-keys))
				 string>=?))))
  
              (s:table
		   (s:tr (s:td "")(map s:td a-keys))
		   (map
		    (lambda (row-key)
		      (s:tr (s:td row-key)
			    (map
			     (lambda (col-key)
			       (let ((val (let* ((ht  (hash-table-ref/default ordered-runs col-key #f)))
					    (if ht (hash-table-ref/default ht row-key #f)))))
				 (if val
				     (let* ((result (vector-ref val 2))
                                            (bg (if (equal? result "PASS")
                                                      "green"
                                                      "red")))
				       (s:td 'style (conc "background: " bg )
					     (s:a 'href (s:link-to "log" 'target result)
						  result)))
				     (s:td ""))))
			     a-keys)))
		    b-keys)))))))