Debian Codegraph @

test/standalone.scm

raw
1 ;; Check if build-standalone works.
2 ;;
3 ;; This test should be run against an _installed_ Gauche. So we don't
4 ;; include this in 'make -s check', but run in 'DIST self-host-test'.
5
6 (use gauche.test)
7 (use gauche.process)
8 (use gauche.config)
9 (use file.util)
10
11 (test-start "build-standalone (installed)")
12
13 (test-section "build-standalone")
14
15 (call-with-temporary-directory
16 (^[dir]
17 (define source (build-path dir "hello.scm"))
18 (define executable
19 (string-append (path-sans-extension source)
20 (gauche-config "--executable-suffix")))
21 (with-output-to-file source
22 (^[] (write '(define (main args)
23 (format #t "Hello, ~a\n" (cadr args))
24 0))))
25 (test* "Build" #t
26 (and (do-process `(gosh tools/build-standalone -o ,executable ,source))
27 (file-is-executable? executable)))
28 (test* "Run" "Hello, Gauche"
29 (process-output->string `(,executable "Gauche")))
30
31 ))
32
33 (test-section "compile-r7rs")
34
35 (call-with-temporary-directory
36 (^[dir]
37 (define source (build-path dir "hello.scm"))
38 (define executable
39 (string-append (path-sans-extension source)
40 (gauche-config "--executable-suffix")))
41 (with-output-to-file source
42 (^[]
43 (write '(import (scheme base) (scheme write) (scheme process-context)))
44 (write '(display "Hello, "))
45 (write '(display (cadr (command-line))))
46 (write '(newline))))
47 (test* "Build" #t
48 (and (do-process `(gauche-compile-r7rs -o ,executable ,source))
49 (file-is-executable? executable)))
50 (test* "Run" "Hello, Droit"
51 (process-output->string `(,executable "Droit")))
52 ))
53
54 (test-end)