summaryrefslogtreecommitdiff
path: root/test-suite/standalone/test-system-cmds
diff options
context:
space:
mode:
Diffstat (limited to 'test-suite/standalone/test-system-cmds')
-rwxr-xr-xtest-suite/standalone/test-system-cmds44
1 files changed, 44 insertions, 0 deletions
diff --git a/test-suite/standalone/test-system-cmds b/test-suite/standalone/test-system-cmds
new file mode 100755
index 000000000..8c590835d
--- /dev/null
+++ b/test-suite/standalone/test-system-cmds
@@ -0,0 +1,44 @@
+#!/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)))
+
+ ;; Note: Use double quotes since simple quotes are not supported by
+ ;; `cmd.exe' on Windows.
+ (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: