summaryrefslogtreecommitdiff
path: root/test-suite/standalone/test-system-cmds
blob: f5007297e5c2859d8e4badb0c34d5c4556fb9b8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
exec guile -q -s "$0" "$@"
!#

(define (test-system-cmd)
  (if (not (boolean? (system)))
      (begin
        (simple-format
         #t
         "test-system-cmds: (system) did not return a boolean\n")
        (exit 1)))
  
  (let ((rs (status:exit-val (system "guile -c '(exit 42)'"))))
    (if (not (= 42 rs))
        (begin
          (simple-format
           #t
           "test-system-cmds: system exit status was ~S rather than 42\n"
           rs)
          (exit 1)))))

(define (test-system*-cmd)
  (let ((rs (status:exit-val (system* "guile" "-c" "(exit 42)"))))
    (if (not (= 42 rs))
        (begin
          (simple-format
           #t
           "test-system-cmds: system* exit status was ~S rather than 42\n"
           rs)
          (exit 1)))))

(if (defined? 'system)
    (test-system-cmd))

(if (defined? 'system*)
    (test-system*-cmd))
     
(exit 0)

;; Local Variables:
;; mode: scheme
;; End: