#!/bin/sh
# tmp-tc.sh : test case for /tmp directory

##########################################################################
# (C) Copyright 1998-2001 The Open Group
#
# All rights reserved.  No part of this source code may be reproduced,
# stored in a retrieval system, or transmitted, in any form or by any
# means, electronic, mechanical, photocopying, recording or otherwise,
# except as stated in the end-user licence agreement, without the prior
# permission of the copyright owners.
#
# X/Open and the 'X' symbol are trademarks of X/Open Company Limited in
# the UK and other countries.
#
#	PROJECT:	LSB-FHS
#	PRODUCT:	LSB.fhs/root/tmp/tmp-tc.sh
#	AUTHOR:		Andrew Josey, The Open Group
#	DATE CREATED:	21 Dec 1998
##########################################################################

# This is $Revision: 1.4 $
#
# $Log: tmp-tc.sh,v $
# Revision 1.4  2004/02/12 14:15:43  ajosey
# renumber assertions for LSB2.0/FHS2.3
#
# Revision 1.3  2001/08/14 14:35:44  ajosey
# update the assertion numbers for FHS2.2
#
# Revision 1.2  2001/07/18 15:35:25  ajosey
# add header and cvs info, review for FHS2.2, no changes needed
#
#
# -- original cvs log --
# This is 1.3
#
# tmp-tc.sh,v
# Revision 1.3  2000/04/09 07:15:33  cyeoh
# Added CVS header information
#
#

# tp3 is updated to be a may be cleared rather than shall be
# cleared as per FHS 2.1

tet_startup="startup"			# startup function
tet_cleanup="cleanup"			# cleanup function
iclist="ic1 ic2 ic3"
ic1="tp1"
ic2="tp2"
ic3="tp3"


tp1()
{
	tpstart "Reference 3.17-1(A)"
	tet_infoline "The /tmp directory exists and is searchable"
	lsb_test_dir_searchable /tmp >out.stdout  2>out.stderr
	check_exit_value $? 0		# should be zero
	check_nostdout			# should be stdout
	check_nostderr			# should be no stderr
	tpresult				# set result code
}

tp2()
{
	tpstart "Reference 3.17-2(A)"
	tet_infoline "The /tmp directory exists and supports creation of files"
	if ! test -e /tmp
	then
		tet_infoline "/tmp does not exist"
		tpresult UNRESOLVED
		return
	fi
	tfile=tfile$$

	rm -f /tmp/$tfile >/dev/null 2>&1
	if test -e /tmp/$tfile
	then
		tet_infoline "test setup failed: /tmp/$tfile exists"
		tpresult UNRESOLVED
		return
	fi
	
	touch /tmp/$tfile
	if ! test -e /tmp/$tfile
	then
		tet_infoline "failed to create a file in /tmp:  /tmp/$tfile"
		FAIL=Y
		tpresult
		return
	fi
	rm  -f /tmp/$tfile >/dev/null 2>&1
	tpresult				# set result code
}

tp3()
{
	tpstart "Reference 3.17-3(D)"
	tet_infoline "Files present in the /tmp directory may be removed when the system is booted"
	tet_infoline "Reason for omission: 1"
	tpresult UNTESTED
}


startup() # startup function
{
     rm -f out.stdout out.stderr out.experr >/dev/null 2>&1
}


cleanup() # clean-up function
{
     rm -f out.stdout out.stderr out.experr >/dev/null 2>&1
}

# source common shell functions

. $TET_EXECUTE/LIB/shfuncs.sh
. $TET_EXECUTE/LIB/lsbfuncs.sh

# execute shell test case manager - must be last line
. $TET_ROOT/lib/xpg3sh/tcm.sh
