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

# This is $Revision: 1.6 $
#
# $Log: etc-x11-tc.sh,v $
# Revision 1.6  2002/10/22 08:48:00  ajosey
# Update tp1 to allow unsupported for systems with no X Server, change result codes for tp2 and tp3 to UNSUPPORTED from FIP
#
# Revision 1.5  2002/04/26 15:10:36  ajosey
# update test 3 since TSD agreed by lsb-confcall on mar 7 2002, change test to return FIP if file not found
#
# Revision 1.4  2001/08/14 14:29:22  ajosey
# update the assertion numbers for FHS2.2
#
# Revision 1.3  2001/07/26 08:21:14  ajosey
# tp2 now optional as X server may not be installed
#
# Revision 1.2  2001/07/19 11:39:40  ajosey
# add header, cvs info, and update for FHS2.2
#
#
# -- old cvs log below --
# This is 1.2
#
# etc-x11-tc.sh,v
# Revision 1.2  2000/04/09 07:15:26  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 3.7.5-1(C)" 
	tet_infoline "If the X11 subsystem and an X Server is installed"
	tet_infoline "The /etc/X11 directory exists and is searchable"

	lsb_test_dir_searchable /etc/X11 >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
}

tp2() 
{
	tpstart "Reference 3.7.5-2(C)"
	tet_infoline "The implementation may provide the file /etc/X11/XConfig and/or /etc/X11/XF86Config"
	if test ! -e /etc/X11/XConfig -a ! -e /etc/X11/XF86Config 
	then
		FAIL=N
		tpresult UNSUPPORTED
		return
	fi
	tpresult			# set result code
}


tp3() 
{
	tpstart "Reference 3.7.5-3(C)"
	tet_infoline "The implementation may provide the file /etc/X11/Xmodmap"
	lsb_test_file /etc/X11/Xmodmap >out.stdout 2>out.stderr 
	check_exit_value $? 0
	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
}



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
