• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /bin/sh
2#
3# Copyright (c) International Business Machines  Corp., 2005
4#
5# This program is free software;  you can redistribute it and#or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13# for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program;  if not, write to the Free Software
17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18#
19
20setup()
21{
22	RC=0				# Return code from commands.
23
24	if [ -z "$LTPTMP" ] && [ -z "$TMPBASE" ]
25	then
26		LTPTMP="/tmp"
27	else
28		LTPTMP="$TMPBASE"
29	fi
30
31	export TPM_TMPFILE="$LTPTMP/tst_tpm.err"
32	rm -f $TPM_TMPFILE 2>&1
33
34	# Set known password values
35	if [ -z "$OWN_PWD" ]
36	then
37		export OWN_PWD="OWN PWD"
38	fi
39	if [ -z "$SRK_PWD" ]
40	then
41		export SRK_PWD="SRK PWD"
42	fi
43
44	tst_resm TINFO "INIT: Inititalizing tests."
45
46	which tpm_clear 1>$TPM_TMPFILE 2>&1 || RC=$?
47	if [ $RC -ne 0 ]
48	then
49		tst_brk TBROK $TPM_TMPFILE NULL \
50			"Setup: tpm_clear command does not exist. Reason:"
51		return $RC
52	fi
53
54	return $RC
55}
56
57test01()
58{
59	RC=0				# Return value from commands
60	export TCID=tpm_clear01		# Test ID
61	export TST_COUNT=1		# Test number
62
63	tpm_clear_tests_exp01.sh 1>$TPM_TMPFILE 2>&1 || RC=$?
64	if [ $RC -eq 0 ]
65	then
66		tst_resm TPASS "'tpm_clear' passed."
67		RC=0
68	else
69		tst_res TFAIL $TPM_TMPFILE "'tpm_clear' failed."
70		RC=1
71	fi
72	return $RC
73}
74
75cleanup()
76{
77	rm -f $TPM_TMPFILE 2>&1
78}
79
80# Function:	main
81#
82# Description:	- Execute all tests, report results.
83#
84# Exit:		- zero on success
85# 		- non-zero on failure.
86
87TFAILCNT=0			# Set TFAILCNT to 0, increment on failure.
88RC=0				# Return code from tests.
89
90export TCID=tpm_clear		# Test ID
91export TST_TOTAL=1		# Total numner of tests in this file.
92export TST_COUNT=0		# Initialize identifier
93
94setup || exit $RC		# Exit if initializing testcases fails.
95
96test01 || TFAILCNT=$(($TFAILCNT+1))
97
98cleanup
99
100exit $TFAILCNT
101