From 804bd6e32fe59e94314d84c22eb53ec22f03992d Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 13 Apr 2016 15:41:58 +0200 Subject: [PATCH] only execute last test when we are a pty Signed-off-by: Christian Brauner --- src/tests/lxc-test-lxc-attach | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/tests/lxc-test-lxc-attach b/src/tests/lxc-test-lxc-attach index 27062e3e9..380a6db30 100755 --- a/src/tests/lxc-test-lxc-attach +++ b/src/tests/lxc-test-lxc-attach @@ -190,14 +190,16 @@ 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 [ $allocate_pty == "pty" ] && [ ! -s /tmp/ptylog ]; then - FAIL "lxc-attach -n busy -L /tmp/ptylog -- hostname" -fi +if [ $allocate_pty = "pty" ]; then + # 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 + rm -f /tmp/ptylog +fi lxc-destroy -n busy -f