-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuttest
More file actions
161 lines (119 loc) · 3.38 KB
/
uttest
File metadata and controls
161 lines (119 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#! /bin/csh -f
# uttest: UT layer test script
# This is the test script for the UT layer. If you are using the
# instructional Suns, then it shouldn't be necessary to make
# any changes to this script. If not, then read the descriptions of
# DATADIR and TESTSDIR (below) to see if you need to change it (you
# should only need to make changes to DATADIR and TESTSDIR).
#
#
# DATADIR: This is the directory where the data files are.
#
set DATADIR = ./uttestdata
#
# TESTSDIR: This is the directory where the files of test queries
# are.
#
set TESTSDIR = ./uttestqueries
#
# Don't change this, unless you want to go and change all of the
# queries in the test files.
#
set LOCALNAME = data
#
# The names of the 3 front-end utilities
#
set DBCREATE = ./dbcreate
set DBDESTROY = ./dbdestroy
set MINIREL = ./minirel
#
# Before doing anything else, we have to create a symbolic link to the
# data directory if one doesn't already exist. This is because the
# test queries expect to find the data files in a directory called
# `data'.
#
if ( -d data ) goto DATAOK
echo You need to have a directory called \`$LOCALNAME\' in order \
to run this script.
echo -n "Shall I create one? (y or n) "
if ( $< == n ) then
echo $0 aborted
exit 1
endif
echo ''
if ( ! -d $DATADIR ) then
echo I can not find a directory called $DATADIR. \
Please check the value of the DATADIR variable \
in the $0 script and try again. | fmt
exit 1
endif
if ( ! -r $DATADIR/soaps.data ) then
echo I can not find the necessary data files in $DATADIR. \
Please check the value of the DATADIR variable in \
the $0 script and try again. | fmt
exit 1
endif
ln -s $DATADIR $LOCALNAME >& /dev/null
if ( $status == 0 ) goto DATAOK
if ( ! -w . ) then
echo You do not have permission to create files in this \
'directory. Please fix the permissions and rerun \
this script. | fmt
exit 1
endif
echo I can not make the directory. If you have a file called \
\`$LOCALNAME\' in this directory, remove it and run this \
script again. If not, please send mail to cs564. | fmt
exit 1
DATAOK:
#
# Now that the data directory is set up, make sure that the TESTSDIR
# variable is set to something reasonable
#
if ( ! -d $TESTSDIR ) then
echo The TESTSDIR variable is currently set to \
$TESTSDIR, which is not a valid directory. \
Please read the instructions at the top of the \
$0 script, set 'TESTDIR' correctly, and rerun the \
script. | fmt
exit 1
endif
if ( `ls $TESTSDIR/ut.[0-9]* | wc -l` == 0 ) then
echo I can not find the UT test files in $TESTSDIR. \
Please read the instructions at the beginning \
of the $0 script, set TESTDIR correctly, and rerun \
the script | fmt
exit 1
endif
#
# This is the name of the data base we will be using for the tests.
#
set TESTDB = testdb
#
# Run the requested tests
#
#
# if no args given, then run all tests
#
if ( $#argv == 0 ) then
foreach queryfile ( `ls $TESTSDIR/ut.*` )
echo running test '#' $queryfile:e '****************'
$DBCREATE $TESTDB
$MINIREL $TESTDB < $queryfile
echo "y" | $DBDESTROY $TESTDB
end
#
# otherwise, run just the specified tests
#
else
foreach testnum ( $* )
if ( -r $TESTSDIR/ut.$testnum ) then
echo running test '#' $testnum '****************'
$DBCREATE $TESTDB
$MINIREL $TESTDB < $TESTSDIR/ut.$testnum
echo "y" | $DBDESTROY $TESTDB
else
echo I can not find a test number $testnum.
endif
end
endif