1#!/bin/bash 2# Test for glob(3). 3# Copyright (C) 1997-2022 Free Software Foundation, Inc. 4# This file is part of the GNU C Library. 5 6# The GNU C Library is free software; you can redistribute it and/or 7# modify it under the terms of the GNU Lesser General Public 8# License as published by the Free Software Foundation; either 9# version 2.1 of the License, or (at your option) any later version. 10 11# The GNU C Library is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14# Lesser General Public License for more details. 15 16# You should have received a copy of the GNU Lesser General Public 17# License along with the GNU C Library; if not, see 18# <https://www.gnu.org/licenses/>. 19 20set -e 21 22common_objpfx=$1; shift 23test_via_rtld_prefix=$1; shift 24test_program_prefix=$1; shift 25test_wrapper_env=$1; shift 26logfile=$common_objpfx/posix/globtest.out 27 28#CMP=cmp 29CMP="diff -u" 30 31# We have to make the paths `common_objpfx' absolute. 32case "$common_objpfx" in 33 .*) 34 common_objpfx="`pwd`/$common_objpfx" 35 ;; 36 *) 37 ;; 38esac 39 40# Since we use `sort' we must make sure to use the same locale everywhere. 41LC_ALL=C 42export LC_ALL 43 44# Create the arena 45testdir=${common_objpfx}posix/globtest-dir 46testout=${common_objpfx}posix/globtest-out 47rm -rf $testdir $testout 48mkdir $testdir 49 50cleanup() { 51 chmod 777 $testdir/noread 52 rm -fr $testdir $testout 53} 54 55trap cleanup 0 HUP INT QUIT TERM 56 57echo 1 > $testdir/file1 58echo 2 > $testdir/file2 59echo 3 > $testdir/-file3 60echo 4 > $testdir/~file4 61echo 5 > $testdir/.file5 62echo 6 > $testdir/'*file6' 63echo 7 > $testdir/'{file7,}' 64echo 8 > $testdir/'\{file8\}' 65echo 9 > $testdir/'\{file9\,file9b\}' 66echo 9 > $testdir/'\file9b\' #' 67echo a > $testdir/'filea,' 68echo a > $testdir/'fileb}c' 69mkdir $testdir/dir1 70mkdir $testdir/dir2 71test -d $testdir/noread || mkdir $testdir/noread 72chmod a-r $testdir/noread 73echo 1_1 > $testdir/dir1/file1_1 74echo 1_2 > $testdir/dir1/file1_2 75ln -fs dir1 $testdir/link1 76 77# Run some tests. 78result=0 79rm -f $logfile 80 81# Normal test 82failed=0 83${test_program_prefix} \ 84${common_objpfx}posix/globtest "$testdir" "*" | 85sort > $testout 86cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 87`*file6' 88`-file3' 89`\file9b\' 90`\{file8\}' 91`\{file9\,file9b\}' 92`dir1' 93`dir2' 94`file1' 95`file2' 96`filea,' 97`fileb}c' 98`link1' 99`noread' 100`{file7,}' 101`~file4' 102EOF 103if test $failed -ne 0; then 104 echo "Normal test failed" >> $logfile 105 result=1 106fi 107 108# Don't let glob sort it 109failed=0 110${test_program_prefix} \ 111${common_objpfx}posix/globtest -s "$testdir" "*" | 112sort > $testout 113cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 114`*file6' 115`-file3' 116`\file9b\' 117`\{file8\}' 118`\{file9\,file9b\}' 119`dir1' 120`dir2' 121`file1' 122`file2' 123`filea,' 124`fileb}c' 125`link1' 126`noread' 127`{file7,}' 128`~file4' 129EOF 130if test $failed -ne 0; then 131 echo "No sort test failed" >> $logfile 132 result=1 133fi 134 135# Mark directories 136failed=0 137${test_program_prefix} \ 138${common_objpfx}posix/globtest -m "$testdir" "*" | 139sort > $testout 140cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 141`*file6' 142`-file3' 143`\file9b\' 144`\{file8\}' 145`\{file9\,file9b\}' 146`dir1/' 147`dir2/' 148`file1' 149`file2' 150`filea,' 151`fileb}c' 152`link1/' 153`noread/' 154`{file7,}' 155`~file4' 156EOF 157if test $failed -ne 0; then 158 echo "Mark directories test failed" >> $logfile 159 result=1 160fi 161 162# Find files starting with . 163failed=0 164${test_program_prefix} \ 165${common_objpfx}posix/globtest -p "$testdir" "*" | 166sort > $testout 167cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 168`*file6' 169`-file3' 170`.' 171`..' 172`.file5' 173`\file9b\' 174`\{file8\}' 175`\{file9\,file9b\}' 176`dir1' 177`dir2' 178`file1' 179`file2' 180`filea,' 181`fileb}c' 182`link1' 183`noread' 184`{file7,}' 185`~file4' 186EOF 187if test $failed -ne 0; then 188 echo "Leading period test failed" >> $logfile 189 result=1 190fi 191 192# Test braces 193failed=0 194${test_program_prefix} \ 195${common_objpfx}posix/globtest -b "$testdir" "file{1,2}" | 196sort > $testout 197cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 198`file1' 199`file2' 200EOF 201if test $failed -ne 0; then 202 echo "Braces test failed" >> $logfile 203 result=1 204fi 205 206failed=0 207${test_program_prefix} \ 208${common_objpfx}posix/globtest -b "$testdir" "{file{1,2},-file3}" | 209sort > $testout 210cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 211`-file3' 212`file1' 213`file2' 214EOF 215if test $failed -ne 0; then 216 echo "Braces test 2 failed" >> $logfile 217 result=1 218fi 219 220failed=0 221${test_program_prefix} \ 222${common_objpfx}posix/globtest -b "$testdir" "{" | 223sort > $testout 224cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 225GLOB_NOMATCH 226EOF 227if test $failed -ne 0; then 228 echo "Braces test 3 failed" >> $logfile 229 result=1 230fi 231 232# Test NOCHECK 233failed=0 234${test_program_prefix} \ 235${common_objpfx}posix/globtest -c "$testdir" "abc" | 236sort > $testout 237cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 238`abc' 239EOF 240if test $failed -ne 0; then 241 echo "No check test failed" >> $logfile 242 result=1 243fi 244 245# Test NOMAGIC without magic characters 246failed=0 247${test_program_prefix} \ 248${common_objpfx}posix/globtest -g "$testdir" "abc" | 249sort > $testout 250cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 251`abc' 252EOF 253if test $failed -ne 0; then 254 echo "No magic test failed" >> $logfile 255 result=1 256fi 257 258# Test NOMAGIC with magic characters 259failed=0 260${test_program_prefix} \ 261${common_objpfx}posix/globtest -g "$testdir" "abc*" | 262sort > $testout 263cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 264GLOB_NOMATCH 265EOF 266if test $failed -ne 0; then 267 echo "No magic w/ magic chars test failed" >> $logfile 268 result=1 269fi 270 271# Test NOMAGIC for subdirs 272failed=0 273${test_program_prefix} \ 274${common_objpfx}posix/globtest -g "$testdir" "*/does-not-exist" | 275sort > $testout 276cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 277GLOB_NOMATCH 278EOF 279if test $failed -ne 0; then 280 echo "No magic in subdir test failed" >> $logfile 281 result=1 282fi 283 284# Test subdirs correctly 285failed=0 286${test_program_prefix} \ 287${common_objpfx}posix/globtest "$testdir" "*/*" | 288sort > $testout 289cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 290`dir1/file1_1' 291`dir1/file1_2' 292`link1/file1_1' 293`link1/file1_2' 294EOF 295if test $failed -ne 0; then 296 echo "Subdirs test failed" >> $logfile 297 result=1 298fi 299 300# Test subdirs for invalid names 301failed=0 302${test_program_prefix} \ 303${common_objpfx}posix/globtest "$testdir" "*/1" | 304sort > $testout 305cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 306GLOB_NOMATCH 307EOF 308if test $failed -ne 0; then 309 echo "Invalid subdir test failed" >> $logfile 310 result=1 311fi 312 313# Test subdirs with wildcard 314failed=0 315${test_program_prefix} \ 316${common_objpfx}posix/globtest "$testdir" "*/*1_1" | 317sort > $testout 318cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 319`dir1/file1_1' 320`link1/file1_1' 321EOF 322if test $failed -ne 0; then 323 echo "Wildcard subdir test failed" >> $logfile 324 result=1 325fi 326 327# Test subdirs with ? 328failed=0 329${test_program_prefix} \ 330${common_objpfx}posix/globtest "$testdir" "*/*?_?" | 331sort > $testout 332cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 333`dir1/file1_1' 334`dir1/file1_2' 335`link1/file1_1' 336`link1/file1_2' 337EOF 338if test $failed -ne 0; then 339 echo "Wildcard2 subdir test failed" >> $logfile 340 result=1 341fi 342 343failed=0 344${test_program_prefix} \ 345${common_objpfx}posix/globtest "$testdir" "*/file1_1" | 346sort > $testout 347cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 348`dir1/file1_1' 349`link1/file1_1' 350EOF 351if test $failed -ne 0; then 352 echo "Wildcard3 subdir test failed" >> $logfile 353 result=1 354fi 355 356failed=0 357${test_program_prefix} \ 358${common_objpfx}posix/globtest "$testdir" "*-/*" | 359sort > $testout 360cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 361GLOB_NOMATCH 362EOF 363if test $failed -ne 0; then 364 echo "Wildcard4 subdir test failed" >> $logfile 365 result=1 366fi 367 368failed=0 369${test_program_prefix} \ 370${common_objpfx}posix/globtest "$testdir" "*-" | 371sort > $testout 372cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 373GLOB_NOMATCH 374EOF 375if test $failed -ne 0; then 376 echo "Wildcard5 subdir test failed" >> $logfile 377 result=1 378fi 379 380# Test subdirs with ? 381failed=0 382${test_program_prefix} \ 383${common_objpfx}posix/globtest "$testdir" "*/*?_?" | 384sort > $testout 385cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 386`dir1/file1_1' 387`dir1/file1_2' 388`link1/file1_1' 389`link1/file1_2' 390EOF 391if test $failed -ne 0; then 392 echo "Wildcard6 subdir test failed" >> $logfile 393 result=1 394fi 395 396# Test subdirs with [ .. ] 397failed=0 398${test_program_prefix} \ 399${common_objpfx}posix/globtest "$testdir" "*/file1_[12]" | 400sort > $testout 401cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 402`dir1/file1_1' 403`dir1/file1_2' 404`link1/file1_1' 405`link1/file1_2' 406EOF 407if test $failed -ne 0; then 408 echo "Brackets test failed" >> $logfile 409 result=1 410fi 411 412# Test ']' inside bracket expression 413failed=0 414${test_program_prefix} \ 415${common_objpfx}posix/globtest "$testdir" "dir1/file1_[]12]" | 416sort > $testout 417cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 418`dir1/file1_1' 419`dir1/file1_2' 420EOF 421if test $failed -ne 0; then 422 echo "Brackets2 test failed" >> $logfile 423 result=1 424fi 425 426# Test tilde expansion 427failed=0 428${test_program_prefix} \ 429${common_objpfx}posix/globtest -q -t "$testdir" "~" | 430sort >$testout 431echo ~ | $CMP - $testout >> $logfile || failed=1 432if test $failed -ne 0; then 433 if test -d ~; then 434 echo "Tilde test failed" >> $logfile 435 result=1 436 else 437 echo "Tilde test could not be run" >> $logfile 438 fi 439fi 440 441# Test tilde expansion with trailing slash 442failed=0 443${test_program_prefix} \ 444${common_objpfx}posix/globtest -q -t "$testdir" "~/" | 445sort > $testout 446# Some shell incorrectly(?) convert ~/ into // if ~ expands to /. 447if test ~/ = //; then 448 echo / | $CMP - $testout >> $logfile || failed=1 449else 450 echo ~/ | $CMP - $testout >> $logfile || failed=1 451fi 452if test $failed -ne 0; then 453 if test -d ~/; then 454 echo "Tilde2 test failed" >> $logfile 455 result=1 456 else 457 echo "Tilde2 test could not be run" >> $logfile 458 fi 459fi 460 461# Test tilde expansion with username 462failed=0 463${test_program_prefix} \ 464${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER | 465sort > $testout 466eval echo ~$USER | $CMP - $testout >> $logfile || failed=1 467if test $failed -ne 0; then 468 if eval test -d ~$USER; then 469 echo "Tilde3 test failed" >> $logfile 470 result=1 471 else 472 echo "Tilde3 test could not be run" >> $logfile 473 fi 474fi 475 476# Tilde expansion shouldn't match a file 477failed=0 478${test_program_prefix} \ 479${common_objpfx}posix/globtest -T "$testdir" "~file4" | 480sort > $testout 481cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 482GLOB_NOMATCH 483EOF 484if test $failed -ne 0; then 485 echo "Tilde4 test failed" >> $logfile 486 result=1 487fi 488 489# Matching \** should only find *file6 490failed=0 491${test_program_prefix} \ 492${common_objpfx}posix/globtest "$testdir" "\**" | 493sort > $testout 494cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 495`*file6' 496EOF 497if test $failed -ne 0; then 498 echo "Star test failed" >> $logfile 499 result=1 500fi 501 502# ... unless NOESCAPE is used, in which case it should entries with a 503# leading \. 504failed=0 505${test_program_prefix} \ 506${common_objpfx}posix/globtest -e "$testdir" "\**" | 507sort > $testout 508cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 509`\file9b\' 510`\{file8\}' 511`\{file9\,file9b\}' 512EOF 513if test $failed -ne 0; then 514 echo "Star2 test failed" >> $logfile 515 result=1 516fi 517 518# Matching \*file6 should find *file6 519failed=0 520${test_program_prefix} \ 521${common_objpfx}posix/globtest "$testdir" "\*file6" | 522sort > $testout 523cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 524`*file6' 525EOF 526if test $failed -ne 0; then 527 echo "Star3 test failed" >> $logfile 528 result=1 529fi 530 531# GLOB_BRACE alone 532failed=0 533${test_program_prefix} \ 534${common_objpfx}posix/globtest -b "$testdir" '\{file7\,\}' | 535sort > $testout 536cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 537`{file7,}' 538EOF 539if test $failed -ne 0; then 540 echo "Brace4 test failed" >> $logfile 541 result=1 542fi 543 544# GLOB_BRACE and GLOB_NOESCAPE 545failed=0 546${test_program_prefix} \ 547${common_objpfx}posix/globtest -b -e "$testdir" '\{file9\,file9b\}' | 548sort > $testout 549cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 550`\file9b\' 551EOF 552if test $failed -ne 0; then 553 echo "Brace5 test failed" >> $logfile 554 result=1 555fi 556 557# Escaped comma 558failed=0 559${test_program_prefix} \ 560${common_objpfx}posix/globtest -b "$testdir" '{filea\,}' | 561sort > $testout 562cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 563`filea,' 564EOF 565if test $failed -ne 0; then 566 echo "Brace6 test failed" >> $logfile 567 result=1 568fi 569 570# Escaped closing brace 571failed=0 572${test_program_prefix} \ 573${common_objpfx}posix/globtest -b "$testdir" '{fileb\}c}' | 574sort > $testout 575cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 576`fileb}c' 577EOF 578if test $failed -ne 0; then 579 echo "Brace7 test failed" >> $logfile 580 result=1 581fi 582 583# Try a recursive failed search 584failed=0 585${test_program_prefix} \ 586${common_objpfx}posix/globtest -e "$testdir" "a*/*" | 587sort > $testout 588cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 589GLOB_NOMATCH 590EOF 591if test $failed -ne 0; then 592 echo "Star4 test failed" >> $logfile 593 result=1 594fi 595 596# ... with GLOB_ERR 597failed=0 598${test_program_prefix} \ 599${common_objpfx}posix/globtest -E "$testdir" "a*/*" | 600sort > $testout 601cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 602GLOB_NOMATCH 603EOF 604if test $failed -ne 0; then 605 echo "Star5 test failed" >> $logfile 606 result=1 607fi 608 609# Try a recursive search in unreadable directory 610failed=0 611${test_program_prefix} \ 612${common_objpfx}posix/globtest "$testdir" "noread/*" | 613sort > $testout 614cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 615GLOB_NOMATCH 616EOF 617if test $failed -ne 0; then 618 echo "Star6 test failed" >> $logfile 619 result=1 620fi 621 622failed=0 623${test_program_prefix} \ 624${common_objpfx}posix/globtest "$testdir" "noread*/*" | 625sort > $testout 626cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 627GLOB_NOMATCH 628EOF 629if test $failed -ne 0; then 630 echo "Star6 test failed" >> $logfile 631 result=1 632fi 633 634# The following tests will fail if run as root. 635user=`id -un 2> /dev/null` 636if test -z "$user"; then 637 uid="$USER" 638fi 639if test "$user" != root; then 640 # ... with GLOB_ERR 641 ${test_program_prefix} \ 642 ${common_objpfx}posix/globtest -E "$testdir" "noread/*" | 643 sort > $testout 644 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 645GLOB_ABORTED 646EOF 647 648 ${test_program_prefix} \ 649 ${common_objpfx}posix/globtest -E "$testdir" "noread*/*" | 650 sort > $testout 651 cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 652GLOB_ABORTED 653EOF 654if test $failed -ne 0; then 655 echo "GLOB_ERR test failed" >> $logfile 656 result=1 657fi 658fi # not run as root 659 660# Try multiple patterns (GLOB_APPEND) 661failed=0 662${test_program_prefix} \ 663${common_objpfx}posix/globtest "$testdir" "file1" "*/*" | 664sort > $testout 665cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 666`dir1/file1_1' 667`dir1/file1_2' 668`file1' 669`link1/file1_1' 670`link1/file1_2' 671EOF 672if test $failed -ne 0; then 673 echo "GLOB_APPEND test failed" >> $logfile 674 result=1 675fi 676 677# Try multiple patterns (GLOB_APPEND) with offset (GLOB_DOOFFS) 678failed=0 679${test_program_prefix} \ 680${common_objpfx}posix/globtest -o "$testdir" "file1" "*/*" | 681sort > $testout 682cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 683`abc' 684`dir1/file1_1' 685`dir1/file1_2' 686`file1' 687`link1/file1_1' 688`link1/file1_2' 689EOF 690if test $failed -ne 0; then 691 echo "GLOB_APPEND2 test failed" >> $logfile 692 result=1 693fi 694 695# Test NOCHECK with non-existing file in subdir. 696failed=0 697${test_program_prefix} \ 698${common_objpfx}posix/globtest -c "$testdir" "*/blahblah" | 699sort > $testout 700cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 701`*/blahblah' 702EOF 703if test $failed -ne 0; then 704 echo "No check2 test failed" >> $logfile 705 result=1 706fi 707 708# Test [[:punct:]] not matching leading period. 709failed=0 710${test_program_prefix} \ 711${common_objpfx}posix/globtest -c "$testdir" "[[:punct:]]*" | 712sort > $testout 713cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 714`*file6' 715`-file3' 716`\file9b\' 717`\{file8\}' 718`\{file9\,file9b\}' 719`{file7,}' 720`~file4' 721EOF 722if test $failed -ne 0; then 723 echo "Punct test failed" >> $logfile 724 result=1 725fi 726 727mkdir $testdir/'dir3*' 728echo 1 > $testdir/'dir3*'/file1 729mkdir $testdir/'dir4[a' 730echo 2 > $testdir/'dir4[a'/file1 731echo 3 > $testdir/'dir4[a'/file2 732mkdir $testdir/'dir5[ab]' 733echo 4 > $testdir/'dir5[ab]'/file1 734echo 5 > $testdir/'dir5[ab]'/file2 735mkdir $testdir/dir6 736echo 6 > $testdir/dir6/'file1[a' 737echo 7 > $testdir/dir6/'file1[ab]' 738failed=0 739v=`${test_program_prefix} \ 740 ${common_objpfx}posix/globtest "$testdir" 'dir3\*/file2'` 741test "$v" != 'GLOB_NOMATCH' && echo "$v" >> $logfile && failed=1 742${test_program_prefix} \ 743${common_objpfx}posix/globtest -c "$testdir" \ 744'dir3\*/file1' 'dir3\*/file2' 'dir1/file\1_1' 'dir1/file\1_9' \ 745'dir2\/' 'nondir\/' 'dir4[a/fil*1' 'di*r4[a/file2' 'dir5[ab]/file[12]' \ 746'dir6/fil*[a' 'dir*6/file1[a' 'dir6/fi*l[ab]' 'dir*6/file1[ab]' \ 747'dir6/file1[[.a.]*' | 748sort > $testout 749cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 750`dir*6/file1[ab]' 751`dir1/file1_1' 752`dir1/file\1_9' 753`dir2/' 754`dir3*/file1' 755`dir3\*/file2' 756`dir4[a/file1' 757`dir4[a/file2' 758`dir5[ab]/file[12]' 759`dir6/fi*l[ab]' 760`dir6/file1[a' 761`dir6/file1[a' 762`dir6/file1[a' 763`dir6/file1[ab]' 764`nondir\/' 765EOF 766${test_wrapper_env} \ 767HOME="$testdir" \ 768${test_via_rtld_prefix} \ 769${common_objpfx}posix/globtest -ct "$testdir" \ 770'~/dir1/file1_1' '~/dir1/file1_9' '~/dir3\*/file1' '~/dir3\*/file2' \ 771'~\/dir1/file1_2' | 772sort > $testout 773cat <<EOF | $CMP - $testout >> $logfile || failed=1 774\`$testdir/dir1/file1_1' 775\`$testdir/dir1/file1_2' 776\`$testdir/dir3*/file1' 777\`~/dir1/file1_9' 778\`~/dir3\\*/file2' 779EOF 780if eval test -d ~"$USER"/; then 781 user=`echo "$USER" | sed -n -e 's/^\([^\\]\)\([^\\][^\\]*\)$/~\1\\\\\2/p'` 782 if test -n "$user"; then 783 ${test_program_prefix} \ 784 ${common_objpfx}posix/globtest -ctq "$testdir" "$user/" | 785 sort > $testout 786 eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1 787 ${test_program_prefix} \ 788 ${common_objpfx}posix/globtest -ctq "$testdir" "$user\\/" | 789 sort > $testout 790 eval echo ~$USER/ | $CMP - $testout >> $logfile || failed=1 791 ${test_program_prefix} \ 792 ${common_objpfx}posix/globtest -ctq "$testdir" "$user" | 793 sort > $testout 794 eval echo ~$USER | $CMP - $testout >> $logfile || failed=1 795 fi 796fi 797if test $failed -ne 0; then 798 echo "Escape tests failed" >> $logfile 799 result=1 800fi 801 802# Test GLOB_BRACE and GLIB_DOOFFS with malloc checking 803failed=0 804${test_wrapper_env} \ 805MALLOC_PERTURB_=65 \ 806${test_via_rtld_prefix} \ 807${common_objpfx}posix/globtest -b -o "$testdir" "file{1,2}" > $testout || failed=1 808cat <<"EOF" | $CMP - $testout >> $logfile || failed=1 809`abc' 810`file1' 811`file2' 812EOF 813if test $failed -ne 0; then 814 echo "GLOB_BRACE+GLOB_DOOFFS test failed" >> $logfile 815 result=1 816fi 817 818if test $result -eq 0; then 819 echo "All OK." > $logfile 820fi 821 822exit $result 823 824# Preserve executable bits for this shell script. 825Local Variables: 826eval:(defun frobme () (set-file-modes buffer-file-name file-mode)) 827eval:(make-local-variable 'file-mode) 828eval:(setq file-mode (file-modes (buffer-file-name))) 829eval:(make-local-variable 'after-save-hook) 830eval:(add-hook 'after-save-hook 'frobme) 831End: 832