|
1 # Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 # All rights reserved. |
|
3 # This component and the accompanying materials are made available |
|
4 # under the terms of the License "Eclipse Public License v1.0" |
|
5 # which accompanies this distribution, and is available |
|
6 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 # |
|
8 # Initial Contributors: |
|
9 # Nokia Corporation - initial contribution. |
|
10 # |
|
11 # Contributors: |
|
12 # |
|
13 # Description: |
|
14 # |
|
15 |
|
16 init() |
|
17 { |
|
18 let totalno=0; |
|
19 let passno=0; |
|
20 let failno=0; |
|
21 } |
|
22 |
|
23 #pwd command with -r option print the absolute pathname of the current working directory with out symbolic links |
|
24 test_pwd2() |
|
25 { |
|
26 let totalno=totalno+1 |
|
27 echo "Test $totalno: pwd with -r argument to print path of current working dir without symbolic links" |
|
28 cwd=`pwd -r` |
|
29 ret=$? |
|
30 if [ $ret = 0 ] |
|
31 then |
|
32 if [ $PWD = $cwd ] |
|
33 then |
|
34 echo "PASS" |
|
35 let passno=passno+1 |
|
36 else |
|
37 echo "FAIL: Expected $PWD, returned $cwd" |
|
38 let failno=failno+1 |
|
39 fi |
|
40 else |
|
41 echo "FAIL: Expected return value 0, but returned $ret" |
|
42 let failno=failno+1 |
|
43 fi |
|
44 } |
|
45 |
|
46 #pwd command with -P option print the absolute pathname of the current working directory with out symbolic links |
|
47 test_pwd3() |
|
48 { |
|
49 let totalno=totalno+1 |
|
50 echo "Test $totalno: pwd with -P argument to print path of current working dir without symbolic links" |
|
51 cwd=`pwd -P` |
|
52 ret=$? |
|
53 if [ $ret = 0 ] |
|
54 then |
|
55 if [ $PWD = $cwd ] |
|
56 then |
|
57 echo "PASS" |
|
58 let passno=passno+1 |
|
59 else |
|
60 echo "FAIL: Expected $PWD, returned $cwd" |
|
61 let failno=failno+1 |
|
62 fi |
|
63 else |
|
64 echo "FAIL: Expected return value 0, but returned $ret" |
|
65 let failno=failno+1 |
|
66 fi |
|
67 } |
|
68 |
|
69 # pwd with -L option print the absolute pathname of the current working directory with out symbolic links |
|
70 test_pwd4() |
|
71 { |
|
72 let totalno=totalno+1 |
|
73 echo "Test $totalno: pwd with -P argument to print path of current working dir without symbolic links" |
|
74 cwd=`pwd -L` |
|
75 ret=$? |
|
76 if [ $ret = 0 ] |
|
77 then |
|
78 if [ $PWD = $cwd ] |
|
79 then |
|
80 echo "PASS" |
|
81 let passno=passno+1 |
|
82 else |
|
83 echo "FAIL: Expected $PWD, returned $cwd" |
|
84 let failno=failno+1 |
|
85 fi |
|
86 else |
|
87 echo "FAIL: Expected return value 0, but returned $ret" |
|
88 let failno=failno+1 |
|
89 fi |
|
90 } |
|
91 |
|
92 # pwd with no option, with CHASE_LINKS option set, print the absolute pathname of the current working directory with out symbolic links |
|
93 test_pwd5() |
|
94 { |
|
95 let totalno=totalno+1 |
|
96 echo "Test $totalno: pwd with no option, with CHASE_LINKS option set, to print path of current working dir without symbolic links" |
|
97 setopt CHASE_LINKS |
|
98 cwd=`pwd` |
|
99 ret=$? |
|
100 if [ $ret = 0 ] |
|
101 then |
|
102 if [ $PWD = $cwd ] |
|
103 then |
|
104 echo "PASS" |
|
105 let passno=passno+1 |
|
106 else |
|
107 echo "FAIL: Expected $PWD, returned $cwd" |
|
108 let failno=failno+1 |
|
109 fi |
|
110 else |
|
111 echo "FAIL: Expected return value 0, but returned $ret" |
|
112 let failno=failno+1 |
|
113 fi |
|
114 unsetopt CHASE_LINKS |
|
115 } |
|
116 |
|
117 report() |
|
118 { |
|
119 echo "#############################################################################" |
|
120 echo "Total tests : $totalno" |
|
121 echo "Passed : $passno" |
|
122 echo "Failed : $failno" |
|
123 echo "#############################################################################" |
|
124 } |
|
125 |
|
126 init |
|
127 test_pwd2 |
|
128 test_pwd3 |
|
129 test_pwd4 |
|
130 test_pwd5 |
|
131 report |