• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CNT=3
26TST_SETUP=setup
27TST_TESTFUNC=test
28TST_NEEDS_TMPDIR=1
29. tst_test.sh
30
31setup()
32{
33	ROD mkdir "dir"
34	LONG_PATH="some/long/path/of/several/directories"
35}
36
37test1()
38{
39	EXPECT_FAIL mkdir "dir" 2\> mkdir.out
40
41	if grep -q "dir.*File exists" mkdir.out; then
42		tst_res TPASS "Got correct error message"
43	else
44		tst_res TFAIL "Got wrong error message"
45		cat mkdir.out
46	fi
47}
48
49test2()
50{
51	EXPECT_FAIL mkdir "$LONG_PATH" 2\> mkdir.out
52
53	if grep -q "$LONG_PATH.*No such file or directory" mkdir.out; then
54		tst_res TPASS "Got correct error message"
55	else
56		tst_res TFAIL "Got wrong error message"
57		cat mkdir.out
58	fi
59
60	ROD rm -rf "$LONG_PATH"
61}
62
63test3()
64{
65	EXPECT_PASS mkdir -p "$LONG_PATH"
66
67	ROD rm -rf "$LONG_PATH"
68}
69
70tst_run
71