Changeset 5064 in project


Ignore:
Timestamp:
07/15/07 22:49:54 (13 years ago)
Author:
Kon Lovett
Message:

Changed to chicken-setup tests directory structure.

Location:
binary-tree
Files:
3 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • binary-tree/setup-header.scm

    r4036 r5064  
    88(define REPOSITORY-DIRECTORY (repository-path))
    99
     10(define *version* (if (file-exists? "version") (string-chomp (read-all "version") "\n") "trunk"))
     11
    1012;; These must be kept in synch w/ testbase-results.scm!
    1113
    1214(define TESTBASE-DIRECTORY (make-pathname REPOSITORY-DIRECTORY "testbase"))
    13 (define TESTBASE-TESTS-DIRECTORY (make-pathname TESTBASE-DIRECTORY "tests"))
    1415
    1516(define (->symbol obj)
     
    3031  (make-filename bn ##sys#load-dynamic-extension) )
    3132
     33(define (make-static-filename bn)
     34  (make-filename bn "o") )
     35
    3236(define (make-source-filename bn)
    3337  (make-filename bn "scm") )
     
    3640  (make-filename bn "exports") )
    3741
     42(define (make-program-filename bn)
     43  (make-filename bn (and (eq? 'windows (software-type)) ".exe")) )
     44
    3845(define (make-repository-pathname bn)
    3946  (make-pathname REPOSITORY-DIRECTORY bn) )
    4047
     48(define (make-program-pathname dn pn)
     49  (make-pathname dn (make-program-filename pn)) )
     50
     51;;
     52
     53#;
     54(define (installed-program-exists? bn)
     55  (or (file-exists? (make-program-pathname (program-path) bn))
     56      (file-exists? (make-program-pathname (installation-prefix) bn))) )
     57
    4158;; File Copy Operations
    4259
     60(define (*file-copy fn dn)
     61  (let ([fn (->string fn)])
     62    (copy-file fn (make-pathname dn fn)) ) )
     63
    4364(define (copy-to-repository fn)
    44   (copy-file (->string fn) REPOSITORY-DIRECTORY) )
     65  (*file-copy (->string fn) REPOSITORY-DIRECTORY) )
    4566
    4667(define (copy-to-shared fn)
    47   (copy-file (->string fn) (chicken-home)) )
    48 
    49 (define (copy-test-file-to-repository fn)
    50   (copy-file (->string fn) TESTBASE-TESTS-DIRECTORY) )
    51 
    52 ;; Install & Run Test(s)
    53 
    54 (define test-driver-arguments
    55   (make-parameter (if (setup-verbose-flag) "--indent 2 -v" "--indent 2")
    56     (lambda (x) (if (string? x) x (test-driver-arguments)))))
     68  (*file-copy (->string fn) (chicken-home)) )
     69
     70(define (copy-file-to-test-repository fn)
     71  (*file-copy (->string fn) TESTBASE-DIRECTORY) )
     72
     73(define (copy-testbase-file bn)
     74  (copy-file-to-test-repository (make-pathname "tests" (->string bn))) )
     75
     76;; Install TestBase related file(s)
    5777
    5878(define (install-test . flnms)
    59   (when (setup-verbose-flag)
    60     (newline)
    61     (print "* Installing test files in " TESTBASE-TESTS-DIRECTORY #\:) )
    62   (unless (file-exists? TESTBASE-TESTS-DIRECTORY)
    63     (create-directory TESTBASE-TESTS-DIRECTORY) )
    64   (let ([tsts
    65           (map
    66             (lambda (x)
    67               (if (list? x)
    68                 ;then has extra files (probably test data)
    69                 (begin
    70                   (for-each (cut copy-test-file-to-repository <>) x)
    71                   (car x))
    72                 ;else test is self contained
    73                 (begin
    74                   (copy-test-file-to-repository x)
    75                   x)))
    76             flnms)])
    77   (if (string>? "2.610" (chicken-version))
    78     (begin
    79       (newline)
    80       (print "* Chicken 2.610+ needed to perform testing.") )
    81     (if (or (file-exists? (make-pathname (program-path) "testbase-driver"))
    82             (file-exists? (make-pathname (installation-prefix) "testbase-driver")))
    83       (begin
    84         (when (setup-verbose-flag)
    85           (newline)
    86           (print "* Running test files" #\:) )
    87         (for-each
    88           (cute system* "testbase-driver ~A ~A" (test-driver-arguments) <>)
    89           tsts) )
    90       (begin
    91         (newline)
    92         (print "* TestBase is not installed. Cannot perform testing.") ) ) ) ) )
     79  (newline)
     80  (print "* Installing TestBase Test-Files in " TESTBASE-DIRECTORY #\:)
     81  (for-each
     82    (lambda (x)
     83      (if (list? x)
     84        ; then has extra files (probably test data)
     85        (for-each copy-testbase-file x)
     86        ; else test is self contained
     87        (copy-testbase-file x) ) )
     88    flnms) )
    9389
    9490;; Options Parsing
    9591
    96 (define (parse-optionals opt)
     92(define (parse-install-arguments ver opt)
     93  ;
     94  (set! ver
     95    (cond
     96      [(string? ver)  ver]
     97      [(symbol? ver)  (eval ver)]
     98      [(number? ver)  (number->string ver)]
     99      [else           (error "invalid install version argument" ver)]))
     100  ;
    97101  (let ([cmp-args '()] [rqr@run '()] [opt-args '()])
    98102    (let loop ([lst opt])
    99103      (if (null? lst)
    100         (values (reverse cmp-args) rqr@run opt-args)
     104        (values ver (reverse cmp-args) rqr@run opt-args)
    101105        (let ([itm (car lst)])
    102106          (cond
     
    121125;;; Operation Macros
    122126
    123 ;; Note that these can accept quasi- stuff in OPT
    124 
    125 (define-macro (compile-dynld DYN . OPT)
     127;; Note that these can accept quasi-stuff in OPT
     128
     129(define-macro (compile-dynld DYNFIL . OPT)
    126130  `(compile
    127131    -s
    128132    -O2 -d1
    129     ,(make-source-filename DYN)
    130     -o ,(make-dynld-filename DYN)
    131     -check-imports -emit-exports ,(make-exports-filename DYN)
    132     ,@OPT) )
    133 
    134 (define-macro (compile-dynld/rename SDYN ODYN . OPT)
     133    ,(make-source-filename DYNFIL)
     134    -o ,(make-dynld-filename DYNFIL)
     135    -check-imports -emit-exports ,(make-exports-filename DYNFIL)
     136    ,@OPT) )
     137
     138(define-macro (compile-dynld/rename SRCDYNFIL OUTDYNFIL . OPT)
    135139  `(compile
    136140    -s
    137141    -O2 -d1
    138     ,(make-source-filename SDYN)
    139     -o ,(make-dynld-filename ODYN)
    140     -check-imports -emit-exports ,(make-exports-filename ODYN)
     142    ,(make-source-filename SRCDYNFIL)
     143    -o ,(make-dynld-filename OUTDYNFIL)
     144    -check-imports -emit-exports ,(make-exports-filename OUTDYNFIL)
     145    ,@OPT) )
     146
     147(define-macro (compile-static SRCSTAFIL . OPT)
     148  `(compile
     149    -c
     150    -O2 -d1
     151    ,(make-source-filename SRCSTAFIL)
     152    -unit ,SRCSTAFIL
     153    -o ,(make-static-filename SRCSTAFIL)
     154    -check-imports -emit-exports ,(make-exports-filename SRCSTAFIL)
     155    ,@OPT) )
     156
     157(define-macro (compile-static/rename SRCSTAFIL OUTSTAFIL . OPT)
     158  `(compile
     159    -c
     160    -O2 -d1
     161    ,(make-source-filename SRCSTAFIL)
     162    -unit ,OUTSTAFIL
     163    -o ,(make-static-filename OUTSTAFIL)
     164    -check-imports -emit-exports ,(make-exports-filename OUTSTAFIL)
    141165    ,@OPT) )
    142166
    143167;; Note that these cannot accept quasi-stuff in OPT
    144168
    145 (define-macro (install-dynld DYN VER . OPT)
    146   (let-values (([CMP-ARGS RQR@RUN OPT-ARGS] (parse-optionals OPT)))
    147     `(begin
    148       (compile-dynld ,DYN ,@CMP-ARGS)
    149       (install-extension ',(->symbol DYN)
    150         '(,(make-dynld-filename DYN) )
    151         '(,@OPT-ARGS
    152           ,@(if (null? RQR@RUN) '() `((require-at-runtime ,@RQR@RUN)))
    153           (version ,VER)
    154           (exports ,(make-exports-filename DYN)) ) ) ) ) )
    155 
    156 (define-macro (install-dynld+docu DYN VER . OPT)
    157   (let-values (([CMP-ARGS RQR@RUN OPT-ARGS] (parse-optionals OPT)))
    158     `(begin
    159       (compile-dynld ,DYN ,@CMP-ARGS)
    160       (install-extension ',(->symbol DYN)
    161         '(,(make-dynld-filename DYN)
    162           ,(make-docu-filename DYN) )
    163         '(,@OPT-ARGS
    164           ,@(if (null? RQR@RUN) '() `((require-at-runtime ,@RQR@RUN)))
    165           (documentation ,(make-docu-filename DYN))
    166           (version ,VER)
    167           (exports ,(make-exports-filename DYN)) ) ) ) ) )
    168 
    169 (define-macro (install-syntax SYN VER . OPT)
    170   (let-values (([CMP-ARGS RQR@RUN OPT-ARGS] (parse-optionals OPT)))
    171     `(install-extension ',(->symbol SYN)
    172       '(,(make-source-filename SYN) )
     169(define-macro (install-dynld DYNFIL VER . OPT)
     170  (let-values (([VERSTR CMP-ARGS RQR@RUN OPT-ARGS] (parse-install-arguments VER OPT)))
     171    `(begin
     172      (compile-dynld ,DYNFIL ,@CMP-ARGS)
     173      (install-extension ',(->symbol DYNFIL)
     174        '(,(make-dynld-filename DYNFIL) )
     175        '(,@OPT-ARGS
     176          ,@(if (null? RQR@RUN) '() `((require-at-runtime ,@RQR@RUN)))
     177          (version ,VERSTR)
     178          (exports ,(make-exports-filename DYNFIL)) ) ) ) ) )
     179
     180(define-macro (install-dynld+docu DYNFIL VER . OPT)
     181  (let-values (([VERSTR CMP-ARGS RQR@RUN OPT-ARGS] (parse-install-arguments VER OPT)))
     182    `(begin
     183      (compile-dynld ,DYNFIL ,@CMP-ARGS)
     184      (install-extension ',(->symbol DYNFIL)
     185        '(,(make-dynld-filename DYNFIL)
     186          ,(make-docu-filename DYNFIL) )
     187        '(,@OPT-ARGS
     188          ,@(if (null? RQR@RUN) '() `((require-at-runtime ,@RQR@RUN)))
     189          (documentation ,(make-docu-filename DYNFIL))
     190          (version ,VERSTR)
     191          (exports ,(make-exports-filename DYNFIL)) ) ) ) ) )
     192
     193(define-macro (install-dynld+source DYNFIL VER . OPT)
     194  (let-values (([VERSTR CMP-ARGS RQR@RUN OPT-ARGS] (parse-install-arguments VER OPT)))
     195    `(begin
     196      (compile-dynld ,DYNFIL ,@CMP-ARGS)
     197      (install-extension ',(->symbol DYNFIL)
     198        '(,(make-dynld-filename DYNFIL)
     199          ,(make-source-filename DYNFIL) )
     200        '(,@OPT-ARGS
     201          ,@(if (null? RQR@RUN) '() `((require-at-runtime ,@RQR@RUN)))
     202          (version ,VERSTR)
     203          (exports ,(make-exports-filename DYNFIL)) ) ) ) ) )
     204
     205(define-macro (install-dynld+source+docu DYNFIL VER . OPT)
     206  (let-values (([VERSTR CMP-ARGS RQR@RUN OPT-ARGS] (parse-install-arguments VER OPT)))
     207    `(begin
     208      (compile-dynld ,DYNFIL ,@CMP-ARGS)
     209      (install-extension ',(->symbol DYNFIL)
     210        '(,(make-dynld-filename DYNFIL)
     211          ,(make-source-filename DYNFIL)
     212          ,(make-docu-filename DYNFIL) )
     213        '(,@OPT-ARGS
     214          ,@(if (null? RQR@RUN) '() `((require-at-runtime ,@RQR@RUN)))
     215          (documentation ,(make-docu-filename DYNFIL))
     216          (version ,VERSTR)
     217          (exports ,(make-exports-filename DYNFIL)) ) ) ) ) )
     218
     219(define-macro (install-syntax SYNFIL VER . OPT)
     220  (let-values (([VERSTR CMP-ARGS RQR@RUN OPT-ARGS] (parse-install-arguments VER OPT)))
     221    `(install-extension ',(->symbol SYNFIL)
     222      '(,(make-source-filename SYNFIL) )
    173223      '(,@OPT-ARGS
    174224        ,@(if (null? RQR@RUN) '() `((require-at-runtime ,@RQR@RUN)))
    175         (version ,VER)
     225        (version ,VERSTR)
    176226        (syntax) ) ) ) )
    177227
    178 (define-macro (install-syntax+docu SYN VER . OPT)
    179   (let-values (([CMP-ARGS RQR@RUN OPT-ARGS] (parse-optionals OPT)))
    180     `(install-extension ',(->symbol SYN)
    181       '(,(make-source-filename SYN)
    182         ,(make-docu-filename SYN) )
     228(define-macro (install-syntax+docu SYNFIL VER . OPT)
     229  (let-values (([VERSTR CMP-ARGS RQR@RUN OPT-ARGS] (parse-install-arguments VER OPT)))
     230    `(install-extension ',(->symbol SYNFIL)
     231      '(,(make-source-filename SYNFIL)
     232        ,(make-docu-filename SYNFIL) )
    183233      '(,@OPT-ARGS
    184234        ,@(if (null? RQR@RUN) '() `((require-at-runtime ,@RQR@RUN)))
    185         (version ,VER)
    186         (documentation ,(make-docu-filename SYN))
     235        (version ,VERSTR)
     236        (documentation ,(make-docu-filename SYNFIL))
    187237        (syntax) ) ) ) )
    188238
    189 (define-macro (install-dynld+syntax SYN DYN VER . OPT)
    190   (let-values (([CMP-ARGS RQR@RUN OPT-ARGS] (parse-optionals OPT)))
    191     `(begin
    192       (compile-dynld ,DYN ,@CMP-ARGS)
    193       (install-extension ',(->symbol SYN)
    194         '(,(make-source-filename SYN)
    195           ,(make-dynld-filename DYN) )
     239(define-macro (install-dynld+syntax SYNFIL DYNFIL VER . OPT)
     240  (let-values (([VERSTR CMP-ARGS RQR@RUN OPT-ARGS] (parse-install-arguments VER OPT)))
     241    `(begin
     242      (compile-dynld ,DYNFIL ,@CMP-ARGS)
     243      (install-extension ',(->symbol SYNFIL)
     244        '(,(make-source-filename SYNFIL)
     245          ,(make-dynld-filename DYNFIL) )
    196246        '(,@OPT-ARGS
    197247          (syntax)
    198           (require-at-runtime ,(->symbol DYN) ,@RQR@RUN)
    199           (version ,VER)
    200           (exports ,(make-exports-filename DYN)) ) ) ) ) )
    201 
    202 (define-macro (install-dynld+syntax+docu SYN DYN VER . OPT)
    203   (let-values (([CMP-ARGS RQR@RUN OPT-ARGS] (parse-optionals OPT)))
    204     `(begin
    205       (compile-dynld ,DYN ,@CMP-ARGS)
    206       (install-extension ',(->symbol SYN)
    207         '(,(make-docu-filename SYN)
    208           ,(make-source-filename SYN)
    209           ,(make-dynld-filename DYN) )
    210         '(,@OPT-ARGS
    211           (documentation ,(make-docu-filename SYN))
     248          (require-at-runtime ,(->symbol DYNFIL) ,@RQR@RUN)
     249          (version ,VERSTR)
     250          (exports ,(make-exports-filename DYNFIL)) ) ) ) ) )
     251
     252(define-macro (install-dynld+syntax+docu SYNFIL DYNFIL VER . OPT)
     253  (let-values (([VERSTR CMP-ARGS RQR@RUN OPT-ARGS] (parse-install-arguments VER OPT)))
     254    `(begin
     255      (compile-dynld ,DYNFIL ,@CMP-ARGS)
     256      (install-extension ',(->symbol SYNFIL)
     257        '(,(make-docu-filename SYNFIL)
     258          ,(make-source-filename SYNFIL)
     259          ,(make-dynld-filename DYNFIL) )
     260        '(,@OPT-ARGS
     261          (documentation ,(make-docu-filename SYNFIL))
    212262          (syntax)
    213           (require-at-runtime ,(->symbol DYN) ,@RQR@RUN)
    214           (version ,VER)
    215           (exports ,(make-exports-filename DYN)) ) ) ) ) )
     263          (require-at-runtime ,(->symbol DYNFIL) ,@RQR@RUN)
     264          (version ,VERSTR)
     265          (exports ,(make-exports-filename DYNFIL)) ) ) ) ) )
Note: See TracChangeset for help on using the changeset viewer.