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

# This is 1.3
#
# log-tc.sh,v
# Revision 1.3  2000/04/16 08:30:27  cyeoh
# Updated reference numbers for FHS2.1
# Added 5.7-2 Check existence of /var/log/lastlog
# Added 5.7-3 Check existence of /var/log/messages
# Added 5.7-4 Check existence of /var/log/wtmp
#
# Revision 1.2  2000/04/09 07:15:52  cyeoh
# Added CVS header information
#
#

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


tp1()
{
	tpstart "Reference 5.10-1(A)"
	tet_infoline "The /var/log directory exists and is searchable"
	lsb_test_dir_searchable /var/log >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.10-2(C)"
	tet_infoline "If the subsystem is installed"
	tet_infoline "The /var/log/lastlog file exists"
	lsb_test_file /var/log/lastlog >out.stdout  2>out.stderr
	check_exit_value $? 0		# should be zero
	check_nostdout			# should be no stdout
	check_nostderr			# should be no stderr
	if [ $FAIL = Y ]
	then
		FAIL=N
		tet_infoline "This test result needs to be manually resolved, returning FIP result"
		tpresult FIP
		return
	fi
	tpresult			# set result code
}

tp3()
{
	tpstart "Reference 5.10-3(C)"
	tet_infoline "If the subsystem is installed"
	tet_infoline "The /var/log/messages file exists"
	lsb_test_file /var/log/messages >out.stdout  2>out.stderr
	check_exit_value $? 0		# should be zero
	check_nostdout			# should be no stdout
	check_nostderr			# should be no stderr
	if [ $FAIL = Y ]
	then
		FAIL=N
		tet_infoline "This test result needs to be manually resolved, returning FIP result"
		tpresult FIP
		return
	fi
	tpresult			# set result code
}

tp4()
{
	tpstart "Reference 5.10-4(C)"
	tet_infoline "If the subsystem is installed"
	tet_infoline "The /var/log/wtmp file exists"
	lsb_test_file /var/log/wtmp >out.stdout  2>out.stderr
	check_exit_value $? 0		# should be zero
	check_nostdout			# should be no stdout
	check_nostderr			# should be no stderr
	if [ $FAIL = Y ]
	then
		FAIL=N
		tet_infoline "This test result needs to be manually resolved, returning FIP result"
		tpresult FIP
		return
	fi
	tpresult			# set result code
}

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
