• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#******************************************************************************
3#
4#   Copyright (c) International Business Machines  Corp., 2001
5#
6#   This program is free software;  you can redistribute it and/or modify
7#   it under the terms of the GNU General Public License as published by
8#   the Free Software Foundation; either version 2 of the License, or
9#   (at your option) any later version.
10#
11#   This program is distributed in the hope that it will be useful,
12#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
13#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
14#   the GNU General Public License for more details.
15#
16#   You should have received a copy of the GNU General Public License
17#   along with this program;  if not, write to the Free Software
18#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19#
20#
21#
22#  FILE   : size01
23#
24#  PURPOSE: To test the basic functionality of `size`.
25#
26#  HISTORY:
27#    06/01 Robbie Williamson (robbiew@us.ibm.com)
28#      -Ported
29#
30#
31#-----------------------------------------------------------------------
32#Uncomment line below for debug output.
33#trace_logic=${trace_logic:-"set -x"}
34$trace_logic
35
36TCsrc=${TCsrc:-`pwd`}
37TCtmp=${TCtmp:-/tmp/size01-$$}
38
39do_setup()
40{
41  SIZE=/usr/bin/size
42  mkdir $TCtmp
43  $SIZE $TCsrc/test > $TCtmp/er_size
44  $SIZE -V $TCsrc/test > $TCtmp/er_size_V
45  $SIZE -o $TCsrc/test > $TCtmp/er_size_o
46  $SIZE -x $TCsrc/test > $TCtmp/er_size_x
47}
48
49
50do_test()
51{
52#ASSERTION POSIX NEXT_AVAILABLE C
53#
54#size
55#
56#CODE
57
58size $TCsrc/test > $TCtmp/ar_size
59
60diff -bw  $TCtmp/ar_size  $TCtmp/er_size
61
62if [ $? -eq 0 ]
63	then
64		echo  "size "
65	else
66		echo "FAIL - size "
67		exit 1
68fi
69
70rm -f $TCtmp/*r_size
71
72
73##ASSERTION POSIX NEXT_AVAILABLE C
74#
75#-V
76#
77#CODE
78
79size -V $TCsrc/test > $TCtmp/ar_size_V
80
81diff -bw  $TCtmp/ar_size_V $TCtmp/er_size_V
82
83if [ $? -eq 0 ]
84	then
85		echo  "size -V"
86	else
87		echo "FAIL - size -V"
88		exit 1
89fi
90
91rm -f $TCtmp/*r_size_V
92
93
94##ASSERTION POSIX NEXT_AVAILABLE C
95#
96#-o
97#
98#CODE
99
100size -o $TCsrc/test > $TCtmp/ar_size_o
101
102diff -bw  $TCtmp/ar_size_o $TCtmp/er_size_o
103
104if [ $? -eq 0 ]
105	then
106		echo  "size -o"
107	else
108		echo "FAIL - size -o"
109		PASS=0
110		exit 1
111fi
112
113rm -f $TCtmp/*r_size_o
114
115
116##ASSERTION POSIX NEXT_AVAILABLE C
117#
118#-x
119#
120#CODE
121
122size -x $TCsrc/test > $TCtmp/ar_size_x
123
124diff -bw  $TCtmp/ar_size_x $TCtmp/er_size_x
125
126if [ $? -eq 0 ]
127	then
128		echo  "size -x"
129	else
130		echo "FAIL - size -x"
131		exit 1
132fi
133
134rm -rf $TCtmp
135
136echo "Test Result: PASS"
137exit 0
138}
139
140do_setup
141do_test
142