openenvutils/commandshell/shell/test/scripts/unziptest.sh
changeset 0 2e3d3ce01487
child 1 0fdb7f6b0309
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     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 total=0;
       
    19 	let pass=0;
       
    20 	let fail=0;
       
    21 
       
    22 	if [ ! -d c:\\ziptest ]
       
    23 	then
       
    24 		echo "Run minizip.sh before testing"
       
    25 		exit
       
    26 	else
       
    27 		cd c:\\ziptest
       
    28 	fi
       
    29 	if [ -d .\\unziptest ]
       
    30 	then
       
    31 		rm -r .\\unziptest	
       
    32 	fi
       
    33 	mkdir .\\unziptest
       
    34 	cd .\\unziptest
       
    35 	mkdir .\dir2
       
    36 	mkdir .\dir3
       
    37 	mkdir .\dir
       
    38 	mkdir .\dir1
       
    39 	cd 
       
    40 }
       
    41 
       
    42 test_unzip1()
       
    43 {
       
    44     let total+=1;
       
    45     echo "test_unzip1:unzip -d dir2-x ../pqr3.zip "
       
    46     #echo "test_unzip1:unzip -d dir2 -x ../pqr3.zip " >>unziplog.txt
       
    47     unzip  -o -d c:\\ziptest\\unziptest\\dir2  c:\\ziptest\\pqr3.zip 
       
    48     ret=$?
       
    49 	if [ $ret -ne 0 ]
       
    50 	then
       
    51 		echo "FAIL : Return Value $ret"
       
    52 		let fail+=1;
       
    53 	else
       
    54 		echo "PASS";
       
    55 		let pass+=1;
       
    56 	fi
       
    57 }
       
    58 
       
    59 test_unzip2()
       
    60 {
       
    61     let total+=1;
       
    62     echo "test_unzip2:unzip -d dir3 -e ../pqr3.zip "
       
    63 
       
    64     #echo "test_unzip2:unzip -d dir3 -e ../pqr3.zip " >>unziplog.txt
       
    65     unzip  -o -d c:\\ziptest\\unziptest\\dir3  c:\\ziptest\\pqr3.zip 
       
    66     ret=$?
       
    67 	if [ $ret -ne 0 ]
       
    68 	then
       
    69 		echo "FAIL : Return Value $ret"
       
    70 		let fail+=1;
       
    71 	else
       
    72 		echo "PASS";
       
    73 		let pass+=1;
       
    74 	fi
       
    75 }
       
    76 test_unzip3()
       
    77 {
       
    78     let total+=1;
       
    79     echo "test_unzip3:unzip -l ../pqr10.zip "
       
    80 
       
    81     unzip -l c:\\ziptest\\pqr3.zip 
       
    82 	#unzip -l c:\\ziptest\\pqr3.zip > c:\\ziptest\\unziptest\\temp.txt
       
    83     ret=$?
       
    84 	if [ $ret -ne 0 ]
       
    85 	then
       
    86 		echo "FAIL : Return Value $ret"
       
    87 		let fail+=1;
       
    88 		return
       
    89 	else
       
    90 		echo "PASS";
       
    91 		let pass+=1
       
    92 	fi
       
    93 	
       
    94 }
       
    95 test_unzip4()
       
    96 {
       
    97     let total+=1;
       
    98     echo "test_unzip4:unzip -d dir ../pqr10.zip "
       
    99     #echo "test_unzip4:unzip -d dir ../pqr10.zip " >>unziplog.txt
       
   100     unzip  -o -d c:\\ziptest\\unziptest\\dir c:\\ziptest\\pqr3.zip #>> unziplog.txt 2>> unziplog.txt
       
   101     ret=$?
       
   102 	if [ $ret -ne 0 ]
       
   103 	then
       
   104 		echo "FAIL : Return Value $ret"
       
   105 		let fail+=1
       
   106 	else
       
   107 		echo "PASS";
       
   108 		let pass+=1;
       
   109 	fi
       
   110 }
       
   111 test_unzip5()
       
   112 {
       
   113     let total+=1;
       
   114     echo "test_unzip5:unzip -x -d dir1 ../pqr3.zip "
       
   115     #echo "test_unzip5:unzip -x -d dir1 ../pqr11.zip " >>unziplog.txt
       
   116     unzip -o -x -d c:\\ziptest\\unziptest\\dir1 c:\\ziptest\\pqr3.zip #>> unziplog.txt 2>> unziplog.txt
       
   117     ret=$?
       
   118 	if [ $ret -ne 0 ]
       
   119 	then
       
   120 		echo "FAIL : Return Value $ret"
       
   121 		let fail+=1;
       
   122 		return
       
   123 	else
       
   124 		echo "PASS";
       
   125 		let pass+=1;
       
   126 	fi
       
   127 }
       
   128 test_unzip6()
       
   129 {
       
   130     let total+=1;
       
   131     echo "test_unzip6:unzip -o ../pqr3.zip "
       
   132     #echo "test_unzip6:unzip -o ../pqr10.zip " >>unziplog.txt
       
   133     unzip -o c:\\ziptest\\pqr3.zip 
       
   134     ret=$?
       
   135 	if [ $ret -ne 0 ]
       
   136 	then
       
   137 		echo "FAIL : Return Value $ret"
       
   138 		let fail+=1;
       
   139 		return
       
   140 	else
       
   141 		echo "PASS";
       
   142 		let pass+=1;
       
   143 	fi
       
   144 }
       
   145 
       
   146 report()
       
   147 {
       
   148 	echo "Changing the directory back";
       
   149 	echo "--------------------unzip test results------------------------"
       
   150 	echo " TOTAL TESTS : $total"
       
   151 	echo " TOTAL PASS  : $pass"
       
   152 	echo " TOTAL FAIL  : $fail"
       
   153 	echo "------------------------------------------------------------"
       
   154 }
       
   155 
       
   156 #begin calls
       
   157 init
       
   158 test_unzip1
       
   159 test_unzip2
       
   160 test_unzip3
       
   161 test_unzip4
       
   162 test_unzip5
       
   163 test_unzip6
       
   164 report
       
   165 
       
   166 
       
   167 
       
   168 
       
   169 
       
   170