jdk/test/com/sun/jdi/JdbReadTwiceTest.sh
author ohair
Tue, 28 Dec 2010 15:53:50 -0800
changeset 7668 d4a77089c587
parent 5506 202f599c92aa
child 22580 6068d5e6c746
permissions -rw-r--r--
6962318: Update copyright year Reviewed-by: xdono
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#!/bin/sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     4
# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
# 
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
# published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
# 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
# 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
# 
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
# questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#  
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#  @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#  @bug 4981536
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#  @summary TTY: .jdbrc is read twice if jdb is run in the user's home dir
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#  @author jjh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#  @run shell JdbReadTwiceTest.sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#Set appropriate jdk 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
if [ ! -z "$TESTJAVA" ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
     jdk="$TESTJAVA"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
     echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
     exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
if [ -z "$TESTCLASSES" ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
     echo "--Error: TESTCLASSES must be defined."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
     exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
case `uname -s` in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    Linux)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
      # Need this to convert to the /.automount/... form which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
      # is what jdb will report when it reads an init file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
      echo TESTCLASSES=$TESTCLASSES
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
      TESTCLASSES=`(cd $TESTCLASSES; /bin/pwd)`
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
      echo TESTCLASSES=$TESTCLASSES
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
esac
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
# All output will go under this dir.  We define HOME to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
# be under here too, and pass it into jdb, to avoid problems
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
# with java choosing a value of HOME.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
baseDir="$TESTCLASSES/jdbRead$$"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
HOME="$baseDir/home"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
mkdir -p "$HOME"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
tmpResult="$baseDir/result"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
fred="$baseDir/fred"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
here="$baseDir"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
jdbFiles="$HOME/jdb.ini $HOME/.jdbrc $here/jdb.ini $here/.jdbrc $tmpResult $fred"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
cd $here
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
failed=
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
mkFiles()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    touch "$@"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
doit()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    echo quit | $TESTJAVA/bin/jdb -J-Duser.home=$HOME > $tmpResult 2>&1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
failIfNot()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    # $1 is the expected number of occurances of $2 in the jdb output.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    count=$1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    shift
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    if [ -r c:/ ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
       sed -e 's@\\@/@g' $tmpResult > $tmpResult.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
       mv $tmpResult.1 $tmpResult
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    xx=`fgrep -i "$*" $tmpResult | wc -l`
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    if [ $xx != $count ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        echo "Failed: Expected $count, got $xx: $*"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        echo "-----"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        cat $tmpResult
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        echo "-----"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        failed=1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        echo "Passed: Expected $count, got $xx: $*"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    fi        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
clean()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    rm -f $jdbFiles
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
# Note:  If jdb reads a file, it outputs a message containing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
#         from: filename
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
# If jdb can't read a file, it outputs a message containing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
#         open: filename
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
echo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
echo "+++++++++++++++++++++++++++++++++++"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
echo "Verify each individual file is read"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
mkFiles $HOME/jdb.ini
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    failIfNot 1 "from $HOME/jdb.ini"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
mkFiles $HOME/.jdbrc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    failIfNot 1 "from $HOME/.jdbrc"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
mkFiles $here/jdb.ini
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    failIfNot 1 "from $here/jdb.ini"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
mkFiles $here/.jdbrc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    failIfNot 1 "from $here/.jdbrc"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
cd $HOME
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
echo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
echo "+++++++++++++++++++++++++++++++++++"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
echo "Verify files are not read twice if cwd is ~"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
mkFiles $HOME/jdb.ini
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    failIfNot 1 "from $HOME/jdb.ini"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
mkFiles $HOME/.jdbrc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    failIfNot 1 "from $HOME/.jdbrc"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
cd $here
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
echo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
echo "+++++++++++++++++++++++++++++++++++"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
echo "If jdb.ini and both .jdbrc exist, don't read .jdbrc"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
mkFiles $HOME/jdb.ini $HOME/.jdbrc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    failIfNot 1  "from $HOME/jdb.ini" 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    failIfNot 0  "from $HOME/.jdbrc"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
echo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
echo "+++++++++++++++++++++++++++++++++++"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
echo "If files exist in both ~ and ., read both"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
mkFiles $HOME/jdb.ini $here/.jdbrc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    failIfNot 1  "from $HOME/jdb.ini" 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    failIfNot 1  "from $here/.jdbrc"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
mkFiles $HOME/.jdbrc $here/jdb.ini
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    failIfNot 1  "from $HOME/.jdbrc"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    failIfNot 1  "from $here/jdb.ini"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
if [ ! -r c:/ ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    # No symlinks on windows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    echo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    echo "+++++++++++++++++++++++++++++++++++"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    echo "Don't read a . file that is a symlink to a ~ file"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    mkFiles $HOME/jdb.ini
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    ln -s $HOME/jdb.ini $here/.jdbrc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    failIfNot 1  "from $HOME/jdb.ini"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    failIfNot 0  "from $here/.jdbrc"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
if [ ! -r c:/ ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    # No symlinks on windows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    echo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    echo "+++++++++++++++++++++++++++++++++++"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    echo "Don't read a . file that is a target symlink of a ~ file"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    mkFiles $here/jdb.ini
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    ln -s $here/jdbini $HOME/.jdbrc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    failIfNot 1  "from $here/jdb.ini"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    failIfNot 0  "from $HOME/.jdbrc"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
if [ ! -r c:/ ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    # Can't make a file unreadable under MKS.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    echo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    echo "+++++++++++++++++++++++++++++++++++"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    echo "Read an unreadable file - verify the read fails."
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    # If the file exists, we try to read it.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    # read will fail.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    mkFiles $HOME/jdb.ini
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        chmod a-r $HOME/jdb.ini
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        failIfNot 1 "open: $HOME/jdb.ini"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
echo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
echo "+++++++++++++++++++++++++++++++++++"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
echo "Read a directory - verify the read fails"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
# If the file (IE. directory) exists, we try to read it.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
# read will fail.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
mkdir $HOME/jdb.ini
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    failIfNot 1 "open: $HOME/jdb.ini"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    rmdir $HOME/jdb.ini
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
echo "read $fred" > $here/jdb.ini
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    echo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    echo "+++++++++++++++++++++++++++++++++++"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    echo "Verify the jdb read command still works"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    touch $fred
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    failIfNot 1 "from $fred"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    if [ ! -r c:/ ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        # Can't make a file unreadable under MKS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        chmod a-r $fred
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        failIfNot 1 "open: $fred"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    rm -f $fred
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    mkdir $fred
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    doit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    failIfNot 1 "open: $fred"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    rmdir $fred
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
clean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
if [ "$failed" = 1 ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    echo "One or more tests failed"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
echo "All tests passed"