Megatest

Artifact [6db943b518]
Login

Artifact 6db943b51858e0523720c800d690c7eb0e515f6a:


;;======================================================================
;; Copyright 2017, Matthew Welland.
;; 
;; This file is part of Megatest.
;; 
;;     Megatest is free software: you can redistribute it and/or modify
;;     it under the terms of the GNU General Public License as published by
;;     the Free Software Foundation, either version 3 of the License, or
;;     (at your option) any later version.
;; 
;;     Megatest is distributed in the hope that it will be useful,
;;     but WITHOUT ANY WARRANTY; without even the implied warranty of
;;     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;     GNU General Public License for more details.
;; 
;;     You should have received a copy of the GNU General Public License
;;     along with Megatest.  If not, see <http://www.gnu.org/licenses/>.

;;======================================================================
(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")))
))