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

# This is 1.2
#
# tmp-tc.sh,v
# Revision 1.2  2000/04/09 07:16:00  cyeoh
# Added CVS header information
#
#

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


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


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

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

tp3()
{
	tpstart "Reference 5.15-3(D)"
	tet_infoline "Files present in the /var/tmp directory persist over a system reboot"
	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
