From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp54.i.mail.ru (smtp54.i.mail.ru [217.69.128.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id B2D1F469710 for ; Wed, 10 Jun 2020 12:44:09 +0300 (MSK) From: Olga Arkhangelskaia Date: Wed, 10 Jun 2020 12:43:53 +0300 Message-Id: <20200610094354.31831-2-arkholga@tarantool.org> In-Reply-To: <20200610094354.31831-1-arkholga@tarantool.org> References: <20200610094354.31831-1-arkholga@tarantool.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 1/2] test: add libisatty to test local console List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org Cc: alexander.turenko@tarantool.org From: Olga Local console is impossible to test within pipe, tatantool -i. isatty lib was added to overcome isatty check and test local console. Hack by Alexandr Turenko. --- test/CMakeLists.txt | 8 ++++++++ test/isatty.c | 5 +++++ 2 files changed, 13 insertions(+) create mode 100644 test/isatty.c diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9b5df7dc5..7894e1651 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -67,3 +67,11 @@ endif() # Disable connector_c for 1.6 #add_subdirectory(connector_c) + +# Build a library with isatty() that always returns 1. +# +# It is needed to test the local tarantool console. Consider an +# example: +# +# echo 42 | LD_PRELOAD=test/libisatty.so ./src/tarantool +add_library(isatty SHARED isatty.c) diff --git a/test/isatty.c b/test/isatty.c new file mode 100644 index 000000000..f716d2903 --- /dev/null +++ b/test/isatty.c @@ -0,0 +1,5 @@ +int +isatty(int fd) +{ + return 1; +} -- 2.20.1 (Apple Git-117)