31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
(include "common_records.scm")
(define (db:dbdat-get-path dbdat)
(if (pair? dbdat)
(cdr dbdat)
#f))
(define (common:get-area-name alldat)
(let* ((configdat (alldat-mtconfig alldat))
(areapath (alldat-areapath alldat)))
(or (configf:lookup configdat "setup" "area-name") ;; megatest is a flexible tool, testsuite is too limiting a description.
(configf:lookup configdat "setup" "testsuite" )
(get-environment-variable "MT_TESTSUITE_NAME")
(if (string? areapath )
(pathname-file areapath)
#f)))) ;; (pathname-file (current-directory)))))
;; return first path that can be created or already exists and is writable
;;
(define (common:get-create-writeable-dir dirs)
|
|
|
>
>
|
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
(include "common_records.scm")
(define (db:dbdat-get-path dbdat)
(if (pair? dbdat)
(cdr dbdat)
#f))
(define (common:get-area-name alldat #!optional (areapath-in #f))
(let* ((configdat (alldat-mtconfig alldat))
(areapath (or (alldat-areapath alldat)
(get-environment-variable "MT_RUN_AREA_HOME")
areapath-in)))
(or (configf:lookup configdat "setup" "area-name") ;; megatest is a flexible tool, testsuite is too limiting a description.
(configf:lookup configdat "setup" "testsuite" )
(get-environment-variable "MT_TESTSUITENAME") ;; circulat?
(if (string? areapath )
(pathname-file areapath)
#f)))) ;; (pathname-file (current-directory)))))
;; return first path that can be created or already exists and is writable
;;
(define (common:get-create-writeable-dir dirs)
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
(log-port (alldat-log-port alldat)))
(if (alldat-tmppath alldat)
(alldat-tmppath alldat)
(if (alldat-areapath alldat) ;; common:get-create-writeable-dir
(handle-exceptions
exn
(begin
(debug:print-error 0 log-port "Couldn't create path to " dbdir)
(exit 1))
(let ((dbpath (common:get-create-writeable-dir
(list (conc "/tmp/" (current-user-name)
"/megatest_localdb/"
(common:get-area-name alldat) "/"
(string-translate (alldat-areapath alldat) "/" ".")))))) ;; #t))))
(set! dbdir dbpath)
(alldat-tmppath alldat dbpath)
dbpath))
#f))))
;; (define (debug:print . params) #f)
;; (define (debug:print-info . params) #f)
;;
;; (define (set-functions dbgp dbgpinfo)
;; (set! debug:print dbgp)
;; (set! debug:print-info dbgpinfo))
)
|
>
>
|
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
(log-port (alldat-log-port alldat)))
(if (alldat-tmppath alldat)
(alldat-tmppath alldat)
(if (alldat-areapath alldat) ;; common:get-create-writeable-dir
(handle-exceptions
exn
(begin
(print-call-chain)
(print ((condition-property-accessor 'exn 'message) exn))
(debug:print-error 0 log-port "Couldn't create path to " dbdir)
(exit 1))
(let ((dbpath (common:get-create-writeable-dir
(list (conc "/tmp/" (current-user-name)
"/megatest_localdb/"
(common:get-area-name alldat) "/"
(string-translate (alldat-areapath alldat) "/" ".")))))) ;; #t))))
(set! dbdir dbpath)
(alldat-tmppath-set! alldat dbpath)
dbpath))
#f))))
;; (define (debug:print . params) #f)
;; (define (debug:print-info . params) #f)
;;
;; (define (set-functions dbgp dbgpinfo)
;; (set! debug:print dbgp)
;; (set! debug:print-info dbgpinfo))
)
|