[lxc-devel] [lxc/master] add minimal test whether pty logging works

brauner on Github lxc-bot at linuxcontainers.org
Fri Apr 8 20:46:02 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/20160408/b14a5c81/attachment.bin>
-------------- next part --------------
From 56c3620da66ddde283c753461c5755030fc33b77 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 | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/tests/lxc-test-lxc-attach b/src/tests/lxc-test-lxc-attach
index 664b028..b13d5db 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
@@ -175,6 +175,14 @@ if [ "$outcontent" != "busy" ] || [ -z "$errcontent" ]; then
         FAIL " echo 'hostname; rm' | lxc-attach -n busy > $out 2> $err"
 fi
 
+# 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
+logcontent=$(cat /tmp/ptylog)
+if [ -e "$logcontent" ] && [ -z "$logcontent" ]; then
+        FAIL " lxc-attach -n busy -L /tmp/ptylog -- hostname"
+fi
+
 lxc-destroy -n busy -f
 
 exit 0


More information about the lxc-devel mailing list