lxc-test-lxc-attach revision 8d1ea537851718553358a4a9767274f893b40420
# lxc: linux Container library
# Authors:
# Christian Brauner <christian.brauner@mailbox.org>
#
# This is a test script for the lxc-attach program. It tests whether I/O
# redirection works correctly.
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
set -e
echo -n "Failed " >&2
echo "$*" >&2
exit 1
}
# Create a container, start it and wait for it to be in running state
# Test if simple attach is working
# - stdin --> attached to pty
# - stdout --> attached to pty
# - stderr --> attached to pty
if [ "$attach" != "busy" ]; then
FAIL " simple attach"
fi
# Test if we still receive output when stdin does not refer to a tty
# - stdout --> attached to pty
# - stderr --> attached to pty
if [ "$attach" != "busy" ]; then
fi
# Test if we are silent when stdout does not refer to a tty
# - stdin --> attached to pty
# - stderr --> attached to pty
if [ -n "$attach" ]; then
fi
# Test if we are silent when stdout and stdin do not refer to a tty
# - stderr --> attached to pty
if [ -n "$attach" ]; then
fi
# Test if we still receive output when stdin and stderr do not refer to a tty
# - stdout --> attached to pty
if [ "$attach" != "busy" ]; then
fi
# - produce output on stderr in container
# - output on host should be received on stderr
# - to capture the ouput on stderr on the host we redirect stderr on the host to
# stdout
# - stdin --> attached to pty
# - stderr --> attached to pty
if [ "$attach" != "busy" ]; then
fi
# - produce output on stderr in container
# - no output from container should be received on stderr on host
# - stdin --> attached to pty
# - stdout --> attached to pty
if [ -n "$attach" ]; then
fi
# Test file redirection
# - stdin --> attached to pty
outcontent=$(cat $out)
errcontent=$(cat $err)
fi
# Test stdin input
# - stdin --> $in
# - stdout --> attached to pty
# - stderr --> attached to pty
if [ "$attach" != "busy" ]; then
fi
exit 0