1#!/bin/sh 2################################################################################ 3## ## 4## Copyright (c) International Business Machines Corp., 2001 ## 5## Author: Manoj Iyer, manjo@mail.utexas.edu ## 6## ## 7## This program is free software; you can redistribute it and#or modify ## 8## it under the terms of the GNU General Public License as published by ## 9## the Free Software Foundation; either version 2 of the License, or ## 10## (at your option) any later version. ## 11## ## 12## This program is distributed in the hope that it will be useful, but ## 13## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ## 14## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ## 15## for more details. ## 16## ## 17## You should have received a copy of the GNU General Public License ## 18## along with this program; if not, write to the Free Software Foundation, ## 19## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## 20## ## 21################################################################################ 22# 23# Basic mkdir tests 24# 25TST_ID="mkdir01" 26TST_CNT=3 27TST_SETUP=setup 28TST_TESTFUNC=test 29TST_NEEDS_TMPDIR=1 30. tst_test.sh 31 32setup() 33{ 34 ROD mkdir "dir" 35 LONG_PATH="some/long/path/of/several/directories" 36} 37 38test1() 39{ 40 EXPECT_FAIL mkdir "dir" 2\> mkdir.out 41 42 if grep -q "dir.*File exists" mkdir.out; then 43 tst_res TPASS "Got correct error message" 44 else 45 tst_res TFAIL "Got wrong error message" 46 cat mkdir.out 47 fi 48} 49 50test2() 51{ 52 EXPECT_FAIL mkdir "$LONG_PATH" 2\> mkdir.out 53 54 if grep -q "$LONG_PATH.*No such file or directory" mkdir.out; then 55 tst_res TPASS "Got correct error message" 56 else 57 tst_res TFAIL "Got wrong error message" 58 cat mkdir.out 59 fi 60 61 ROD rm -rf "$LONG_PATH" 62} 63 64test3() 65{ 66 EXPECT_PASS mkdir -p "$LONG_PATH" 67 68 ROD rm -rf "$LONG_PATH" 69} 70 71tst_run 72