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 | |
---|
6 | temp=/tmp/test.out.$$ |
---|
7 | |
---|
8 | export AUTOUPDATE NEW_TESTING_RELEASE NEW_PRODUCTION_RELEASE UPDATE_TIME |
---|
9 | export VAR VAR1 VAR2 VAR3 VAR4 VAR5 |
---|
10 | UPDATE_TIME=0 |
---|
11 | |
---|
12 | # Test version resolution for AUTOUPDATE false. |
---|
13 | AUTOUPDATE=false |
---|
14 | VAR= |
---|
15 | NEW_TESTING_RELEASE= |
---|
16 | NEW_PRODUCTION_RELEASE= |
---|
17 | ./getcluster -b -d ignored 7.7P << EOM > $temp |
---|
18 | var value3 7.8 |
---|
19 | var value1 7.6 |
---|
20 | var value2 7.7 |
---|
21 | var value4 8.0 |
---|
22 | EOM |
---|
23 | . $temp |
---|
24 | if [ "$VAR" != value2 -o "$NEW_PRODUCTION_RELEASE" != 8.0 ]; then |
---|
25 | echo "Test 1 failed." |
---|
26 | rm -f $temp |
---|
27 | exit 1 |
---|
28 | fi |
---|
29 | echo "Test 1 passed." |
---|
30 | |
---|
31 | # Test version resolution for AUTOUPDATE true, no testing versions |
---|
32 | AUTOUPDATE=true |
---|
33 | VAR= |
---|
34 | NEW_TESTING_RELEASE= |
---|
35 | NEW_PRODUCTION_RELEASE= |
---|
36 | ./getcluster -b -d ignored 7.7P << EOM > $temp |
---|
37 | var value4 8.0 |
---|
38 | var value3 7.8 |
---|
39 | var value1 7.6 |
---|
40 | var value2 7.7 |
---|
41 | EOM |
---|
42 | . $temp |
---|
43 | if [ "$VAR" != value4 ]; then |
---|
44 | echo "Test 2 failed." |
---|
45 | rm -f $temp |
---|
46 | exit 1 |
---|
47 | fi |
---|
48 | echo "Test 2 passed." |
---|
49 | |
---|
50 | # Test version resolution for AUTOUPDATE true, testing versions |
---|
51 | AUTOUPDATE=true |
---|
52 | VAR= |
---|
53 | NEW_TESTING_RELEASE= |
---|
54 | NEW_PRODUCTION_RELEASE= |
---|
55 | ./getcluster -b -d ignored 7.7P << EOM > $temp |
---|
56 | var value4 8.0 t |
---|
57 | var value3 7.8 |
---|
58 | var value1 7.6 |
---|
59 | var value2 7.7 |
---|
60 | EOM |
---|
61 | . $temp |
---|
62 | if [ "$VAR" != value3 -o "$NEW_TESTING_RELEASE" != 8.0 ]; then |
---|
63 | echo "Test 3 failed." |
---|
64 | rm -f $temp |
---|
65 | exit 1 |
---|
66 | fi |
---|
67 | echo "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. |
---|
73 | AUTOUPDATE=true |
---|
74 | VAR1= |
---|
75 | VAR2= |
---|
76 | VAR3= |
---|
77 | VAR4= |
---|
78 | VAR5= |
---|
79 | NEW_TESTING_RELEASE= |
---|
80 | NEW_PRODUCTION_RELEASE= |
---|
81 | ./getcluster -b -d ignored 7.7P << EOM > $temp |
---|
82 | var3 var3value2 7.7 t |
---|
83 | var1 var1value1 8.0 t |
---|
84 | var3 var3value4 8.0 t |
---|
85 | var2 var2value1 |
---|
86 | var3 var3value3 7.6 |
---|
87 | var4 var4value2 7.7 |
---|
88 | var2 var2value3 7.8 t |
---|
89 | var5 var5value1 |
---|
90 | var1 var1value2 7.6 t |
---|
91 | var3 var3value1 |
---|
92 | var4 var4value1 7.6 |
---|
93 | var4 var4value3 8.0 |
---|
94 | var2 var2value2 8.0 t |
---|
95 | EOM |
---|
96 | . $temp |
---|
97 | if [ "$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 |
---|
102 | fi |
---|
103 | echo "Test 4 passed." |
---|
104 | |
---|
105 | rm -f $temp |
---|
Note: See
TracBrowser
for help on using the repository browser.