Debian Codegraph @

src/tests/normal-tests/executable-cli.lsp

raw
1 ;;;; -*- Mode: Lisp; Syntax: Common-Lisp; indent-tabs-mode: nil -*-
2 ;;;; vim: set filetype=lisp tabstop=8 shiftwidth=2 expandtab:
3
4 ;;;; Author: Daniel Kochmański
5 ;;;; Created: 2016-11-19
6 ;;;; Contains: Calling ECL binary tests
7
8 (in-package :cl-test)
9
10 (suite 'executable)
11
12 (defvar *test-image*
13 (or (ext:getenv "TEST_IMAGE")
14 "/data/Warsztat/Repozytoria/ecl/otp/bin/ecl"))
15
16 (defun simple-run (input-string &optional output error)
17 (when (null *test-image*)
18 (return-from simple-run))
19
20 (with-temporary-file (input-file input-string)
21 (ext:run-program *test-image* '("-norc")
22 :input input-file
23 :output output
24 :error error
25 :if-output-exists :append
26 :if-error-exists :append)))
27
28
29 ;;; Bug #43: Infinite loop when writing to stderr fails
30 ;;;
31 ;;; Reported: 2015-05-06 (Dmitri Pasechnik)
32 ;;; Fixed: 2016-11-19 (Daniel Kochmański)
33 ;;;
34 ;;; Description: If `*error-output*' print causes infinite recursion
35 ;;; this test will fail (ECL will segfault with exit code 11). If
36 ;;; nothing extraordinary happens (even if we have debugger invoked),
37 ;;; then EOF is encountered and ECL returns with 0 exit code.
38
39 #+linux ; Windows and OSX don't have /dev/...
40 (test executable.1.infinite-loop
41 (is-eql 0 (nth-value 1 (simple-run "(print 'hi *error-output*"
42 "/dev/null"
43 "/dev/full"))))