#!/bin/sh
#
#   Copyright (c) International Business Machines  Corp., 2005
#
#   This program is free software;  you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program 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 General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this pronram;  if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#***********************************************************************
#
# File Name: stress3_test.sh
#
# Description: This file is used to create and su to another user with a
#              specific uid, then run the stress3_test.
#
# Prerequisite: export TMP=/tmp when running this test manually. $TMP
#                 is set up by runltp if it is used.
#               export LTPROOT= the path to but not including testcases if
#                 this test is run manually.
#
#               Be sure that "make" and "make install" have been executed
#                 in the LTP/ltp-full directory.
#
# Usage:  <for command-line>
#  stress3_test.sh
#
# History:
#
#   DATE     NAME                DESCRIPTION
#
# 04/21/05  krisw@us.ibm.com     Created this file
#
#*********************************************************************** 
   useradd -u 560 tester1
   if [ "$?" != "0" ]; then
     echo "useradd FAILED"
   else
# Make sure permissions allow non-root to run test.
     chmod 777 ./stress3_test
     echo "useradd succeeded; now run stress3_test"
# Su to the new non-root user and run the stress3_test
     /bin/su tester1 -c ./stress3_test
# Cleanup - remove the user created by this test.
     userdel -r tester1
   fi
