[Tarantool-patches] [PATCH 1/2] test: add libisatty to test local console
Olga Arkhangelskaia
arkholga at tarantool.org
Wed Jun 10 12:43:53 MSK 2020
From: Olga <arkholga at tarantool.org>
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)
More information about the Tarantool-patches
mailing list