From 0d3ef482cf57852cc2dea2376e7eee547fe9df6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= Date: Wed, 7 Sep 2016 09:31:33 +0200 Subject: [PATCH] tests: add external process API suite --- src/tests/ecl-tests.asd | 3 ++- src/tests/ecl-tests.lisp | 4 +++- src/tests/features/external-process.lsp | 27 +++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 src/tests/features/external-process.lsp diff --git a/src/tests/ecl-tests.asd b/src/tests/ecl-tests.asd index 1738fd1cd..08b644427 100644 --- a/src/tests/ecl-tests.asd +++ b/src/tests/ecl-tests.asd @@ -22,7 +22,8 @@ :default-component-class asdf:cl-source-file.lsp :components ((:file "external-formats" :if-feature :unicode) - (:file "ieee-fp" :if-feature :ieee-floating-point))))) + (:file "ieee-fp" :if-feature :ieee-floating-point) + (:file "external-process"))))) (asdf:defsystem #:ecl-tests/stress :serial t diff --git a/src/tests/ecl-tests.lisp b/src/tests/ecl-tests.lisp index b5761d63b..46b78ce40 100644 --- a/src/tests/ecl-tests.lisp +++ b/src/tests/ecl-tests.lisp @@ -27,6 +27,7 @@ (suite 'make-check '(features/eformat features/ieee-fp + features/eprocess regressions/ansi+ regressions/mixed regressions/cmp @@ -47,7 +48,8 @@ (suite 'features '(features/eformat - features/ieee-fp)) + features/ieee-fp + features/eprocess)) ;;; Some syntactic sugar for 2am diff --git a/src/tests/features/external-process.lsp b/src/tests/features/external-process.lsp new file mode 100644 index 000000000..d65059ce6 --- /dev/null +++ b/src/tests/features/external-process.lsp @@ -0,0 +1,27 @@ +;;;; -*- Mode: Lisp; Syntax: Common-Lisp; indent-tabs-mode: nil -*- +;;;; vim: set filetype=lisp tabstop=8 shiftwidth=2 expandtab: + +;;;; Author: Daniel KochmaƄski +;;;; Created: 2016-09-07 +;;;; Contains: External process interaction API +;;;; + +(in-package :cl-test) + +(suite 'features/eprocess) + +(test external-process.0001.run-program/wait/terminate + (let ((p (nth-value 2 (ext:run-program #-windows "sleep" + #+windows "timeout" + (list "3") :wait nil)))) + (is (eql :running (ext:external-process-wait p nil)) + "process doesn't run") + (ext:terminate-process p) + (sleep 1) + (multiple-value-bind (status code) + (ext:external-process-wait p nil) + (is (eql :signaled status) + "status is ~s, should be ~s" status :signalled) + (is (eql ext:+sigterm+ code) + "signal code is ~s, should be ~s" code ext:+sigterm+)) + (finishes (ext:terminate-process p))))