#!/bin/sh
# lib-misc-tc.sh : test case for /var/lib/hwclock directory (optional)

# This is 1.1
#
# lib-hwclock-tc.sh,v
# Revision 1.1  10/17/2007 stewb
# Added 5.8.5.1 - Check if /var/lib/hwclock directory exists and 
# and if so, adjtime is here, not in /etc
#
#

tet_startup="startup"			# startup function
tet_cleanup="cleanup"			# cleanup function
iclist="ic1"
ic1="tp1"


tp1()
{
	tpstart "Reference 5.8.5.1"
	tet_infoline "/var/lib/hwclock : State directory for hwclock (optional)"
	tet_infoline "This directory contains the file /var/lib/hwclock/adjtime"
	tet_infoline "In FHS 2.1, this file was /etc/adjtime, but as hwclock updates it, that was obviously incorrect."
	if [ -d "/var/lib/hwclock" ];then
		lsb_test_file /var/lib/hwclock/adjtime >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
	elif [ -f "/etc/adjtime" ];then
		tet_infoline "Found /etc/adjtime, should be in /var/lib/hwclock"
		tpresult FAIL
	else
		tet_infoline "Found neither /etc/adjtime or /var/lib/hwclock"
		tet_result UNTESTED
	fi
}

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
