source: trunk/athena/bin/getcluster/tests.sh @ 12159

Revision 12159, 2.3 KB checked in by ghudson, 26 years ago (diff)
Autoconfiscate.
Line 
1#!/bin/sh
2# Test getcluster's ability to do proper version resolution.
3# $Id: tests.sh,v 1.3 1998-11-30 15:24:27 ghudson Exp $
4# $Source: /afs/dev.mit.edu/source/repository/athena/bin/getcluster/tests.sh,v $
5
6temp=/tmp/test.out.$$
7
8export AUTOUPDATE NEW_TESTING_RELEASE NEW_PRODUCTION_RELEASE UPDATE_TIME
9export VAR VAR1 VAR2 VAR3 VAR4 VAR5
10UPDATE_TIME=0
11
12# Test version resolution for AUTOUPDATE false.
13AUTOUPDATE=false
14VAR=
15NEW_TESTING_RELEASE=
16NEW_PRODUCTION_RELEASE=
17./getcluster -b -d ignored 7.7P << EOM > $temp
18var value3 7.8
19var value1 7.6
20var value2 7.7
21var value4 8.0
22EOM
23. $temp
24if [ "$VAR" != value2 -o "$NEW_PRODUCTION_RELEASE" != 8.0 ]; then
25        echo "Test 1 failed."
26        rm -f $temp
27        exit 1
28fi
29echo "Test 1 passed."
30
31# Test version resolution for AUTOUPDATE true, no testing versions
32AUTOUPDATE=true
33VAR=
34NEW_TESTING_RELEASE=
35NEW_PRODUCTION_RELEASE=
36./getcluster -b -d ignored 7.7P << EOM > $temp
37var value4 8.0
38var value3 7.8
39var value1 7.6
40var value2 7.7
41EOM
42. $temp
43if [ "$VAR" != value4 ]; then
44        echo "Test 2 failed."
45        rm -f $temp
46        exit 1
47fi
48echo "Test 2 passed."
49
50# Test version resolution for AUTOUPDATE true, testing versions
51AUTOUPDATE=true
52VAR=
53NEW_TESTING_RELEASE=
54NEW_PRODUCTION_RELEASE=
55./getcluster -b -d ignored 7.7P << EOM > $temp
56var value4 8.0 t
57var value3 7.8
58var value1 7.6
59var value2 7.7
60EOM
61. $temp
62if [ "$VAR" != value3 -o "$NEW_TESTING_RELEASE" != 8.0 ]; then
63        echo "Test 3 failed."
64        rm -f $temp
65        exit 1
66fi
67echo "Test 3 passed."
68
69# Test multiple variables and defaults.  Variable 1 should get no value,
70# variable 2 should get the default value, variables 3 and 4 should get
71# a value determined by the version, and variable 5 should get the default
72# value.
73AUTOUPDATE=true
74VAR1=
75VAR2=
76VAR3=
77VAR4=
78VAR5=
79NEW_TESTING_RELEASE=
80NEW_PRODUCTION_RELEASE=
81./getcluster -b -d ignored 7.7P << EOM > $temp
82var3 var3value2 7.7 t
83var1 var1value1 8.0 t
84var3 var3value4 8.0 t
85var2 var2value1
86var3 var3value3 7.6
87var4 var4value2 7.7
88var2 var2value3 7.8 t
89var5 var5value1
90var1 var1value2 7.6 t
91var3 var3value1
92var4 var4value1 7.6
93var4 var4value3 8.0
94var2 var2value2 8.0 t
95EOM
96. $temp
97if [ "$VAR2" != var2value1 -o "$VAR3" != var3value2 -o "$VAR4" != var4value3 \
98     -o "$VAR5" != var5value1 -o "$NEW_TESTING_RELEASE" != 8.0 ]; then
99        echo "Test 4 failed."
100        rm -f $temp
101        exit 1
102fi
103echo "Test 4 passed."
104
105rm -f $temp
Note: See TracBrowser for help on using the repository browser.