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