[lxc-devel] [lxc/master] add minimal test whether pty logging works
brauner on Github
lxc-bot at linuxcontainers.org
Sat Apr 9 21:33:18 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160409/ea532632/attachment.bin>
-------------- next part --------------
From 7979293044164c7b3b12aff0ceab65e4be84255d Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at mailbox.org>
Date: Fri, 8 Apr 2016 22:43:51 +0200
Subject: [PATCH] add minimal test whether pty logging works
Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>
---
src/tests/lxc-test-lxc-attach | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/tests/lxc-test-lxc-attach b/src/tests/lxc-test-lxc-attach
index 664b028..2bd2205 100755
--- a/src/tests/lxc-test-lxc-attach
+++ b/src/tests/lxc-test-lxc-attach
@@ -60,7 +60,7 @@ lxc-wait -n busy -s RUNNING || FAIL "waiting for busybox container to run"
# stderr --> attached to pty
attach=$(lxc-attach -n busy -- hostname || FAIL " to allocate or setup pty")
if [ "$attach" != "busy" ]; then
- FAIL " simple attach"
+ FAIL " lxc-attach -n busy -- hostname"
fi
# stdin --> /dev/null
@@ -161,6 +161,8 @@ if [ "$outcontent" != "OUT" ] || [ "$errcontent" != "ERR" ]; then
FAIL " lxc-attach -n busy -- sh -c 'echo OUT; echo ERR >&2' > $out 2> $err"
fi
+rm -f $out $err
+
# stdin --> $in
# stdout --> $out
# stderr --> $err
@@ -175,6 +177,17 @@ if [ "$outcontent" != "busy" ] || [ -z "$errcontent" ]; then
FAIL " echo 'hostname; rm' | lxc-attach -n busy > $out 2> $err"
fi
+rm -f $out $err
+
+# Test whether logging pty output to a file works.
+trap "rm -f /tmp/ptylog" EXIT INT QUIT PIPE
+lxc-attach -n busy -L /tmp/ptylog -- hostname || FAIL " to allocate or setup pty"
+if [ ! -s /tmp/ptylog ]; then
+ FAIL " lxc-attach -n busy -L /tmp/ptylog -- hostname"
+fi
+
+rm -f /tmp/ptylog
+
lxc-destroy -n busy -f
exit 0
More information about the lxc-devel
mailing list