1#!/bin/sh 2 3rm -rf siks 4mkdir -p siks 5 6export GNUSORT_NUMERIC_COMPATIBILITY=x 7 8BSDSORT=../sort 9GNUSORT=~/coreutils/bin/sort 10#GNUSORT=sort 11 12FILECMP=cmp 13 14INPUT_FILE=si 15 16rm -rf test.log 17 18#ru_RU.ISO-8859-5 en_US.ISO8859-15 zh_HK.Big5HKSCS 19# 20# ru KOI-8 is an "irregular" locale with non-trivial ordering. 21# zh* is a 2-bytes locale 22 23for lang in ru_RU.KOI8-R C ru_RU.ISO-8859-5 en_US.ISO8859-15 zh_HK.Big5HKSCS 24do 25 26 export LANG=${lang} 27 28 for KEYS in -srh -sfrudb -Vs -sM -siz 29 do 30 31 echo ${LANG} ${KEYS} 32 33 ${BSDSORT} ${KEYS} ${INPUT_FILE} -o siks/sik1 34 ER=$? 35 if ! [ ${ER} -eq 0 ] ; then 36 echo ${LANG} ${KEYS} crash >> test.log 37 exit 38 fi 39 ${GNUSORT} ${KEYS} ${INPUT_FILE} -o siks/sik2 40 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.0.0 2>&1 ; then 41 echo ${LANG} ${KEYS} error >> test.log 42 fi 43 ${BSDSORT} -c ${KEYS} siks/sik1 44 ER=$? 45 if ! [ ${ER} -eq 0 ] ; then 46 echo ${LANG} ${KEYS} -c error >> test.log 47 fi 48 rm siks/res.0.0 49 50 ${BSDSORT} ${KEYS} -t " " ${INPUT_FILE} -o siks/sik1 51 ER=$? 52 if ! [ ${ER} -eq 0 ] ; then 53 echo ${LANG} ${KEYS} -t " " crash >> test.log 54 exit 55 fi 56 ${GNUSORT} ${KEYS} -t " " ${INPUT_FILE} -o siks/sik2 57 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.0.0 2>&1 ; then 58 echo ${LANG} ${KEYS} error -t " " >> test.log 59 fi 60 ${BSDSORT} -c -t " " ${KEYS} siks/sik1 61 ER=$? 62 if ! [ ${ER} -eq 0 ] ; then 63 echo $? ${LANG} ${KEYS} -t " " -c error >> test.log 64 fi 65 rm siks/res.0.0 66 67 ${BSDSORT} ${KEYS} -t "|" ${INPUT_FILE} -o siks/sik1 68 ER=$? 69 if ! [ ${ER} -eq 0 ] ; then 70 echo ${LANG} ${KEYS} -t "|" crash >> test.log 71 exit 72 fi 73 ${GNUSORT} ${KEYS} -t "|" ${INPUT_FILE} -o siks/sik2 74 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.0.0 2>&1 ; then 75 echo ${LANG} ${KEYS} error -t "|" >> test.log 76 fi 77 ${BSDSORT} -c -t "|" ${KEYS} siks/sik1 78 ER=$? 79 if ! [ ${ER} -eq 0 ] ; then 80 echo ${LANG} ${KEYS} -c -t "|" error >> test.log 81 fi 82 rm siks/res.0.0 83 84 ${BSDSORT} ${KEYS} -t '\0' ${INPUT_FILE} -o siks/sik1 85 ER=$? 86 if ! [ ${ER} -eq 0 ] ; then 87 echo ${LANG} ${KEYS} -t 0 crash >> test.log 88 exit 89 fi 90 ${GNUSORT} ${KEYS} -t '\0' ${INPUT_FILE} -o siks/sik2 91 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.0.0 2>&1 ; then 92 echo ${LANG} ${KEYS} error -t '\0' >> test.log 93 fi 94 ${BSDSORT} -c -t '\0' ${KEYS} siks/sik1 95 ER=$? 96 if ! [ ${ER} -eq 0 ] ; then 97 echo ${LANG} ${KEYS} -c -t '\0' error >> test.log 98 fi 99 rm siks/res.0.0 100 101 for f1 in 1 2 3 4 5 6 7 8 9 102 do 103 for c1 in 1 2 3 4 5 10 15 20 25 30 104 do 105 echo ${LANG} ${KEYS} ${f1} ${c1} 106 107 ${BSDSORT} ${KEYS} +${f1}.${c1} ${INPUT_FILE} -o siks/sik1 108 ER=$? 109 if ! [ ${ER} -eq 0 ] ; then 110 echo ${LANG} ${KEYS} +${f1}.${c1} crash +- >> test.log 111 exit 112 fi 113 ${GNUSORT} ${KEYS} +${f1}.${c1} ${INPUT_FILE} -o siks/sik2 114 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1} 2>&1 ; then 115 echo ${LANG} ${KEYS} +${f1}.${c1} error +- >> test.log 116 fi 117 ${BSDSORT} -c ${KEYS} +${f1}.${c1} siks/sik1 118 ER=$? 119 if ! [ ${ER} -eq 0 ] ; then 120 echo ${LANG} ${KEYS} +${f1}.${c1} -c error +- >> test.log 121 fi 122 rm siks/res.${f1}.${c1} 123 124 ${BSDSORT} ${KEYS} -k${f1}.${c1} ${INPUT_FILE} -o siks/sik1 125 ER=$? 126 if ! [ ${ER} -eq 0 ] ; then 127 echo ${LANG} ${KEYS} -k${f1}.${c1} crash >> test.log 128 exit 129 fi 130 ${GNUSORT} ${KEYS} -k${f1}.${c1} ${INPUT_FILE} -o siks/sik2 131 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1} 2>&1 ; then 132 echo ${LANG} ${KEYS} -k${f1}.${c1} error >> test.log 133 fi 134 ${BSDSORT} -c ${KEYS} -k${f1}.${c1} siks/sik1 135 ER=$? 136 if ! [ ${ER} -eq 0 ] ; then 137 echo ${LANG} ${KEYS} -k${f1}.${c1} -c error >> test.log 138 fi 139 rm siks/res.${f1}.${c1} 140 141 ${BSDSORT} ${KEYS} -k${f1}.${c1}b ${INPUT_FILE} -o siks/sik1 142 ER=$? 143 if ! [ ${ER} -eq 0 ] ; then 144 echo ${LANG} ${KEYS} -k${f1}.${c1}b crash >> test.log 145 exit 146 fi 147 ${GNUSORT} ${KEYS} -k${f1}.${c1}b ${INPUT_FILE} -o siks/sik2 148 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1} 2>&1 ; then 149 echo ${LANG} ${KEYS} -k${f1}.${c1}b error >> test.log 150 fi 151 ${BSDSORT} -c ${KEYS} -k${f1}.${c1}b siks/sik1 152 ER=$? 153 if ! [ ${ER} -eq 0 ] ; then 154 echo ${LANG} ${KEYS} -k${f1}.${c1}b -c error >> test.log 155 fi 156 rm siks/res.${f1}.${c1} 157 158 ${BSDSORT} ${KEYS} -t " " -k${f1}.${c1} ${INPUT_FILE} -o siks/sik1 159 ER=$? 160 if ! [ ${ER} -eq 0 ] ; then 161 echo ${LANG} ${KEYS} -t -k${f1}.${c1} crash >> test.log 162 exit 163 fi 164 ${GNUSORT} ${KEYS} -t " " -k${f1}.${c1} ${INPUT_FILE} -o siks/sik2 165 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1} 2>&1 ; then 166 echo ${LANG} ${KEYS} -k${f1}.${c1} error -t " " >> test.log 167 fi 168 ${BSDSORT} -c -t " " ${KEYS} -k${f1}.${c1} siks/sik1 169 ER=$? 170 if ! [ ${ER} -eq 0 ] ; then 171 echo ${LANG} ${KEYS} -k${f1}.${c1} -t " " -c error >> test.log 172 fi 173 rm siks/res.${f1}.${c1} 174 175 ${BSDSORT} ${KEYS} -t " " -k${f1}.${c1}n ${INPUT_FILE} -o siks/sik1 176 ER=$? 177 if ! [ ${ER} -eq 0 ] ; then 178 echo ${LANG} ${KEYS} -k${f1}.${c1}n crash >> test.log 179 exit 180 fi 181 ${GNUSORT} ${KEYS} -t " " -k${f1}.${c1}n ${INPUT_FILE} -o siks/sik2 182 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1} 2>&1 ; then 183 echo ${LANG} ${KEYS} -k${f1}.${c1} error -t " " n >> test.log 184 fi 185 ${BSDSORT} -c -t " " ${KEYS} -k${f1}.${c1}n siks/sik1 186 ER=$? 187 if ! [ ${ER} -eq 0 ] ; then 188 echo ${LANG} ${KEYS} -k${f1}.${c1} -c -t " " n error >> test.log 189 fi 190 rm siks/res.${f1}.${c1} 191 192 ${BSDSORT} ${KEYS} -t "|" -k${f1}.${c1} ${INPUT_FILE} -o siks/sik1 193 ER=$? 194 if ! [ ${ER} -eq 0 ] ; then 195 echo ${LANG} ${KEYS} -t "|" -k${f1}.${c1} crash >> test.log 196 exit 197 fi 198 ${GNUSORT} ${KEYS} -t "|" -k${f1}.${c1} ${INPUT_FILE} -o siks/sik2 199 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1} 2>&1 ; then 200 echo ${LANG} ${KEYS} -k${f1}.${c1} error -t "|" >> test.log 201 fi 202 ${BSDSORT} -c -t "|" ${KEYS} -k${f1}.${c1} siks/sik1 203 ER=$? 204 if ! [ ${ER} -eq 0 ] ; then 205 echo ${LANG} ${KEYS} -k${f1}.${c1} -c -t "|" error >> test.log 206 fi 207 rm siks/res.${f1}.${c1} 208 209 for f2 in 1 2 3 4 5 6 7 8 9 10 210 do 211 for c2 in 0 1 2 3 4 5 10 15 20 25 30 212 do 213 echo ${LANG} ${KEYS} ${f1} ${c1} ${f2} ${c2} 214 215 ${BSDSORT} ${KEYS} +${f1}.${c1} -${f2}.${c2} ${INPUT_FILE} -o siks/sik1 216 ER=$? 217 if ! [ ${ER} -eq 0 ] ; then 218 echo ${LANG} ${KEYS} +${f1}.${c1} -${f2}.${c2} crash >> test.log 219 exit 220 fi 221 ${GNUSORT} ${KEYS} +${f1}.${c1} -${f2}.${c2} ${INPUT_FILE} -o siks/sik2 222 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2>&1 ; then 223 echo ${LANG} ${KEYS} +${f1}.${c1} -${f2}.${c2} error +- >> test.log 224 fi 225 ${BSDSORT} -c ${KEYS} +${f1}.${c1} -${f2}.${c2} siks/sik1 226 ER=$? 227 if ! [ ${ER} -eq 0 ] ; then 228 echo ${LANG} ${KEYS} +${f1}.${c1} -${f2}.${c2} -c error +- >> test.log 229 fi 230 rm siks/res.${f1}.${c1}.${f2}.${c2} 231 232 ${BSDSORT} ${KEYS} -k${f1}.${c1},${f2}.${c2} ${INPUT_FILE} -o siks/sik1 233 ER=$? 234 if ! [ ${ER} -eq 0 ] ; then 235 echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} crash >> test.log 236 exit 237 fi 238 ${GNUSORT} ${KEYS} -k${f1}.${c1},${f2}.${c2} ${INPUT_FILE} -o siks/sik2 239 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2>&1 ; then 240 echo ${LANG} ${KEYS} -k${f1}.${c1}.${f2}.${c2} error >> test.log 241 fi 242 ${BSDSORT} -c ${KEYS} -k${f1}.${c1},${f2}.${c2} siks/sik1 243 ER=$? 244 if ! [ ${ER} -eq 0 ] ; then 245 echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} -c error >> test.log 246 fi 247 rm siks/res.${f1}.${c1}.${f2}.${c2} 248 249 ${BSDSORT} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} ${INPUT_FILE} -o siks/sik1 250 ER=$? 251 if ! [ ${ER} -eq 0 ] ; then 252 echo ${LANG} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} crash >> test.log 253 exit 254 fi 255 ${GNUSORT} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} ${INPUT_FILE} -o siks/sik2 256 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2>&1 ; then 257 echo ${LANG} ${KEYS} -k${f1}.${c1}.b.${f2}.${c2} error >> test.log 258 fi 259 ${BSDSORT} -c ${KEYS} -k${f1}.${c1}b,${f2}.${c2} siks/sik1 260 ER=$? 261 if ! [ ${ER} -eq 0 ] ; then 262 echo ${LANG} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} -c error >> test.log 263 fi 264 rm siks/res.${f1}.${c1}.${f2}.${c2} 265 266 ${BSDSORT} ${KEYS} -t " " -k${f1}.${c1},${f2}.${c2} ${INPUT_FILE} -o siks/sik1 267 ER=$? 268 if ! [ ${ER} -eq 0 ] ; then 269 echo ${LANG} ${KEYS} -t " " -k${f1}.${c1},${f2}.${c2} crash >> test.log 270 exit 271 fi 272 ${GNUSORT} ${KEYS} -t " " -k${f1}.${c1},${f2}.${c2} ${INPUT_FILE} -o siks/sik2 273 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2>&1 ; then 274 echo ${LANG} ${KEYS} -k${f1}.${c1}.${f2}.${c2} error -t " " >> test.log 275 fi 276 ${BSDSORT} -c -t " " ${KEYS} -k${f1}.${c1},${f2}.${c2} siks/sik1 277 ER=$? 278 if ! [ ${ER} -eq 0 ] ; then 279 echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} -c -t " " error >> test.log 280 fi 281 rm siks/res.${f1}.${c1}.${f2}.${c2} 282 283 ${BSDSORT} ${KEYS} -t " " -k${f1}.${c1}n,${f2}.${c2} ${INPUT_FILE} -o siks/sik1 284 ER=$? 285 if ! [ ${ER} -eq 0 ] ; then 286 echo ${LANG} ${KEYS} -t " " -k${f1}.${c1}n,${f2}.${c2} crash >> test.log 287 exit 288 fi 289 ${GNUSORT} ${KEYS} -t " " -k${f1}.${c1}n,${f2}.${c2} ${INPUT_FILE} -o siks/sik2 290 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2>&1 ; then 291 echo ${LANG} ${KEYS} -t " " -k${f1}.${c1}.${f2}.${c2} error n >> test.log 292 fi 293 ${BSDSORT} -c -t " " ${KEYS} -k${f1}.${c1}n,${f2}.${c2} siks/sik1 294 ER=$? 295 if ! [ ${ER} -eq 0 ] ; then 296 echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} -c -t " " n error >> test.log 297 fi 298 rm siks/res.${f1}.${c1}.${f2}.${c2} 299 300 ${BSDSORT} ${KEYS} -t '\0' -k${f1}.${c1}n,${f2}.${c2} ${INPUT_FILE} -o siks/sik1 301 ER=$? 302 if ! [ ${ER} -eq 0 ] ; then 303 echo ${LANG} ${KEYS} -t '\0' -k${f1}.${c1}n,${f2}.${c2} crash >> test.log 304 exit 305 fi 306 ${GNUSORT} ${KEYS} -t '\0' -k${f1}.${c1}n,${f2}.${c2} ${INPUT_FILE} -o siks/sik2 307 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2>&1 ; then 308 echo ${LANG} ${KEYS} -k${f1}.${c1}.${f2}.${c2} error -t '\0' n >> test.log 309 fi 310 ${BSDSORT} -c -t '\0' ${KEYS} -k${f1}.${c1}n,${f2}.${c2} siks/sik1 311 ER=$? 312 if ! [ ${ER} -eq 0 ] ; then 313 echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} -c -t '\0' n error >> test.log 314 fi 315 rm siks/res.${f1}.${c1}.${f2}.${c2} 316 317 ${BSDSORT} ${KEYS} -t "|" -k${f1}.${c1},${f2}.${c2} ${INPUT_FILE} -o siks/sik1 318 ER=$? 319 if ! [ ${ER} -eq 0 ] ; then 320 echo ${LANG} ${KEYS} -t "|" -k${f1}.${c1},${f2}.${c2} crash >> test.log 321 exit 322 fi 323 ${GNUSORT} ${KEYS} -t "|" -k${f1}.${c1},${f2}.${c2} ${INPUT_FILE} -o siks/sik2 324 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2>&1 ; then 325 echo ${LANG} ${KEYS} -k${f1}.${c1}.${f2}.${c2} error -t "|" >> test.log 326 fi 327 ${BSDSORT} -c -t "|" ${KEYS} -k${f1}.${c1},${f2}.${c2} siks/sik1 328 ER=$? 329 if ! [ ${ER} -eq 0 ] ; then 330 echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} -c -t "|" error >> test.log 331 fi 332 rm siks/res.${f1}.${c1}.${f2}.${c2} 333 334 ${BSDSORT} ${KEYS} -t "|" -k${f1}.${c1},${f2}.${c2} -k${f2}.${c1},${f1}.${c2} ${INPUT_FILE} -o siks/sik1 335 ER=$? 336 if ! [ ${ER} -eq 0 ] ; then 337 echo ${LANG} ${KEYS} -t "|" -k${f1}.${c1},${f2}.${c2} -k${f2}.${c1},${f1}.${c2} crash >> test.log 338 exit 339 fi 340 ${GNUSORT} ${KEYS} -t "|" -k${f1}.${c1},${f2}.${c2} -k${f2}.${c1},${f1}.${c2} ${INPUT_FILE} -o siks/sik2 341 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2>&1 ; then 342 echo ${LANG} ${KEYS} -k${f1}.${c1}.${f2}.${c2} error -t "|" 2k >> test.log 343 fi 344 ${BSDSORT} -c -t "|" ${KEYS} -k${f1}.${c1},${f2}.${c2} -k${f2}.${c1},${f1}.${c2} siks/sik1 345 ER=$? 346 if ! [ ${ER} -eq 0 ] ; then 347 echo ${LANG} ${KEYS} -k${f1}.${c1},${f2}.${c2} -c -t "|" 2k error >> test.log 348 fi 349 rm siks/res.${f1}.${c1}.${f2}.${c2} 350 351 ${BSDSORT} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} -k${f2}.${c1},${f1}.${c2} ${INPUT_FILE} -o siks/sik1 352 ER=$? 353 if ! [ ${ER} -eq 0 ] ; then 354 echo ${LANG} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} -k${f2}.${c1},${f1}.${c2} crash >> test.log 355 exit 356 fi 357 ${GNUSORT} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} -k${f2}.${c1},${f1}.${c2} ${INPUT_FILE} -o siks/sik2 358 if ! ${FILECMP} siks/sik1 siks/sik2 >siks/res.${f1}.${c1}.${f2}.${c2} 2>&1 ; then 359 echo ${LANG} ${KEYS} -k${f1}.${c1}.b.${f2}.${c2} error 2k >> test.log 360 fi 361 ${BSDSORT} -c ${KEYS} -k${f1}.${c1}b,${f2}.${c2} -k${f2}.${c1},${f1}.${c2} siks/sik1 362 ER=$? 363 if ! [ ${ER} -eq 0 ] ; then 364 echo ${LANG} ${KEYS} -k${f1}.${c1}b,${f2}.${c2} -c 2k error >> test.log 365 fi 366 rm siks/res.${f1}.${c1}.${f2}.${c2} 367 368 done 369 done 370 done 371 done 372 done 373done 374 375