#!/bin/sh
# share-tc.sh : test case for /usr/share 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/usr/share/share-tc.sh
#	AUTHOR:		Andrew Josey, The Open Group
#	DATE CREATED:	21 Dec 1998
##########################################################################

# This is $Revision: 1.6 $
#
# $Log: share-tc.sh,v $
# Revision 1.6  2004/02/13 13:32:44  ajosey
# change FIP to UNSUPPORTED for tp 3,6,8
#
# Revision 1.5  2001/08/15 07:03:08  ajosey
# update the assertion numbers for FHS2.2
#
# Revision 1.4  2001/07/20 11:02:18  ajosey
# update UNSUPPORTED to FIP result codes
#
# Revision 1.3  2001/07/19 10:09:20  ajosey
# align tp2 thru tp9 for FHS2.2
#
# Revision 1.2  2001/07/19 10:02:47  ajosey
# add header and cvs rev info
#
#
# --- old revision history below ---
#
# This is 1.4
#
# share-tc.sh,v
# Revision 1.4  2000/04/14 10:46:14  ajosey
# add 8 new tests for /usr/share subdirectories
#
# Revision 1.3  2000/04/14 10:39:17  ajosey
# renumber the assertions for FHS2.1
#
# Revision 1.2  2000/04/09 07:15:39  cyeoh
# Added CVS header information
#
#

tet_startup="startup"			# startup function
tet_cleanup="cleanup"			# cleanup function
iclist="ic1 ic2 ic3 ic4 ic5 ic6 ic7 ic8 ic9"
ic1="tp1"
ic2="tp2"
ic3="tp3"
ic4="tp4"
ic5="tp5"
ic6="tp6"
ic7="tp7"
ic8="tp8"
ic9="tp9"


tp1()
{
	tpstart "Reference 4.11-1(A)"
	tet_infoline "The /usr/share directory exists and is searchable"
	lsb_test_dir_searchable /usr/share >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 4.11-2(C)"
	tet_infoline "If the implementation supports the subsystem"
	tet_infoline "the /usr/share/doc directory exists and is searchable"
	lsb_test_dir_searchable /usr/share/doc >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 4.11-3(C)"
	tet_infoline "If the implementation supports the subsystem"
	tet_infoline "the /usr/share/games directory exists and is searchable"
	lsb_test_dir_searchable /usr/share/games >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
		tpresult UNSUPPORTED
		return
	fi
	tpresult			# set result code
}

tp4()
{
	tpstart "Reference 4.11-4(C)"
	tet_infoline "If the implementation supports the subsystem"
	tet_infoline "The /usr/share/info directory exists and is searchable"
	lsb_test_dir_searchable /usr/share/info >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
}

tp5()
{
	tpstart "Reference 4.11-5(C)"
	tet_infoline "If the implementation supports the subsystem"
	tet_infoline "the /usr/share/locale directory exists and is searchable"
	lsb_test_dir_searchable /usr/share/locale >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
}

tp6()
{
	tpstart "Reference 4.11-6(A)"
	tet_infoline "If the implementation supports the subsystem"
	tet_infoline "the /usr/share/nls directory exists and is searchable"
	lsb_test_dir_searchable /usr/share/nls >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
		tpresult UNSUPPORTED
		return
	fi
	tpresult			# set result code
}

tp7()
{
	tpstart "Reference 4.11-7(C)"
	tet_infoline "If the implementation supports the subsystem"
	tet_infoline "the /usr/share/terminfo directory exists and is searchable"
	lsb_test_dir_searchable /usr/share/terminfo >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
}

tp8()
{
	tpstart "Reference 4.11-8(C)"
	tet_infoline "If the implementation supports the subsystem"
	tet_infoline "the /usr/share/tmac directory exists and is searchable"
	lsb_test_dir_searchable /usr/share/tmac >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
		tpresult UNSUPPORTED
		return
	fi
	tpresult			# set result code
}

tp9()
{
	tpstart "Reference 4.11-9(C)"
	tet_infoline "If the implementation supports the subsystem"
	tet_infoline "the /usr/share/zoneinfo directory exists and is searchable"
	lsb_test_dir_searchable /usr/share/zoneinfo >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
