split the C compiler's name from its options
SEX_CC="ccache cc" went looking for an executable of that whole name; it is read as make reads CC now.
This commit is contained in:
@@ -45,6 +45,14 @@
|
||||
(process-wait proc)
|
||||
(list (process-exit-status proc) out err))))
|
||||
|
||||
;;; (status) of PROGRAM run on its own
|
||||
(define (sexc-run-program program)
|
||||
(let ((proc (process* program (list))))
|
||||
(close-output-port (process-input-port proc))
|
||||
(read-string #f (process-output-port proc))
|
||||
(process-wait proc)
|
||||
(list (process-exit-status proc))))
|
||||
|
||||
;;; Whether sexc exits 0 when run with ARGS, saying nothing of it
|
||||
(define (sexc-succeeds? . args)
|
||||
(let ((proc (process* sexc args)))
|
||||
@@ -105,6 +113,17 @@
|
||||
(test "and the source is as it was" hello-source
|
||||
(call-with-input-file "victim.sex" (lambda (p) (read-string #f p))))
|
||||
|
||||
;;; A compiler is named with its own options, as make's CC is: SEX_CC
|
||||
;;; "cc -DCODE=7" went looking for an executable of that whole name
|
||||
(call-with-output-file "code.sex" (lambda (p) (display "(pub fn main () int (return CODE))" p)))
|
||||
(test "a compiler given with options takes them"
|
||||
7
|
||||
(begin
|
||||
(set-environment-variable! "SEX_CC" "cc -DCODE=7")
|
||||
(let ((built (sexc-succeeds? "code.sex" "-o" "code")))
|
||||
(unset-environment-variable! "SEX_CC")
|
||||
(and built (car (sexc-run-program "./code"))))))
|
||||
|
||||
;;; An error is its message: CHICKEN's call history after it is for
|
||||
;;; working on sexc itself, and asked for by SEXC_DEBUG
|
||||
(test-assert "a missing input says so"
|
||||
|
||||
Reference in New Issue
Block a user