Megatest

Check-in [5eb5a9cc5d]
Login
Overview
Comment:added logs link
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.64
Files: files | file ages | folders
SHA1: 5eb5a9cc5ddf39f49e541ea31fe1dc73f1277351
User & Date: pjhatwal on 2017-03-06 19:19:59
Other Links: branch diff | manifest | tags
Context
2017-03-06
21:49
cron triggered sync now working check-in: ab5a0b4fb9 user: matt tags: v1.64
19:19
added logs link check-in: 5eb5a9cc5d user: pjhatwal tags: v1.64
11:35
Added 0/5 type syntax to cron specification check-in: 73a7b5099f user: matt tags: v1.64
Changes

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

199
200
201
202
203
204
205
206
207
208





209
210
211
212
213
214
215
	 ))
     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








|


>
>
>
>
>







199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
	 ))
     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, t.id, t.rundir, t.final_logf FROM runs as r INNER JOIN tests AS t ON t.run_id=r.id  
                          WHERE t.state='COMPLETED' AND r.target like ?;" targets)
)

(define (pgdb:get-test-by-id dbh id)
  (dbi:get-rows dbh "SELECT t.test_name, t.item_path, t.rundir, t.final_logf FROM runs as r INNER JOIN tests AS t ON t.run_id=r.id  
                          WHERE t.id = ?;" id)
)

;;======================================================================
;;  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

Added cgisetup/pages/log.scm version [b0387f7c38].































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
;;======================================================================
;; 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.
;;======================================================================

(load "models/pgdb.scm")
(include "pages/log_ctrl.scm")
(include "pages/log_view.scm")

Added cgisetup/pages/log_ctrl.scm version [ff6468589f].







































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
;;======================================================================
;; 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.
;;======================================================================

;; a function <pagename>-action is called on POST

(define (log-action action)
  (case (string->symbol action)
    ((dosomething)
     (dosomething))))


Added cgisetup/pages/log_view.scm version [cead0218d5].













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
;;======================================================================
;; 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 (readlines filename)
  (call-with-input-file filename
    (lambda (p)
      (let loop ((line (read-line p))
                 (result '()))
        (if (eof-object? line)
            (reverse result)
            (loop (read-line p) (cons line result)))))))

(define (pages:log session db shared)
  (let* ((dbh         (s:db))
	 (id      (s:get-param 'testid))
         (tests (pgdb:get-test-by-id dbh id)))
     
    (if (eq? (length tests) 1)
    (begin
    (s:div 'class "col_12"
	   (s:fieldset
	   (conc "Show a runs for Target: " )
             (let* ((test (car tests))
		   (html-path (conc (vector-ref test 2) "/" (vector-ref test 3)))
                    (html-data (readlines html-path)))
                  (s:p html-data)))))
      (begin 
         (s:div 'class "col_12"
    "Log not found")))
))
		      

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

34
35
36
37
38
39
40

41
42
43
44
45
46
47
48
49
50
		      (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)))))))
		      







>




|





34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
		      (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))
                                             (test-id (vector-ref val 4))
                                            (bg (if (equal? result "PASS")
                                                      "green"
                                                      "red")))
				       (s:td 'style (conc "background: " bg )
					     (s:a 'href (s:link-to "log" 'testid test-id)
						  result)))
				     (s:td ""))))
			     a-keys)))
		    b-keys)))))))