New regression test updates for rename, etc.
Obtained from: NetBSD Approved by: re (tmpfs blanket)
This commit is contained in:
parent
db3f838d97
commit
d73f7c1723
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=171801
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: h_tools.c,v 1.7 2006/11/09 16:20:06 jmmv Exp $ */
|
||||
/* $NetBSD: h_tools.c,v 1.8 2007/07/23 15:05:43 jmmv Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
|
||||
@ -192,7 +192,12 @@ rename_main(int argc, char **argv)
|
||||
if (argc < 3)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
return rename(argv[1], argv[2]);
|
||||
if (rename(argv[1], argv[2]) == -1) {
|
||||
perror("rename");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: t_mount,v 1.7 2006/11/09 16:20:06 jmmv Exp $
|
||||
# $NetBSD: t_mount,v 1.8 2007/07/24 11:29:16 jmmv Exp $
|
||||
#
|
||||
# Copyright (c) 2005, 2006, 2006 The NetBSD Foundation, Inc.
|
||||
# Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to The NetBSD Foundation
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: t_rename,v 1.5 2006/11/09 16:20:06 jmmv Exp $
|
||||
# $NetBSD: t_rename,v 1.7 2007/07/23 15:05:43 jmmv Exp $
|
||||
#
|
||||
# Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
@ -56,7 +56,7 @@ test_run() {
|
||||
|
||||
test_name "Cross device renames do not work"
|
||||
mkdir a || die
|
||||
${Src_Dir}/h_tools rename a /var/tmp/a && die
|
||||
${Src_Dir}/h_tools rename a /var/tmp/a >/dev/null 2>&1 && die
|
||||
rmdir a || die
|
||||
|
||||
test_name "Directories can be renamed"
|
||||
@ -107,6 +107,53 @@ test_run() {
|
||||
test -f b || die
|
||||
rm b
|
||||
|
||||
test_name "Rename a directory to a override an empty directory works"
|
||||
mkdir a || die
|
||||
touch a/c || die
|
||||
mkdir b || die
|
||||
${Src_Dir}/h_tools rename a b >/dev/null 2>&1 || die
|
||||
test -e a && die
|
||||
test -d b || die
|
||||
test -f b/c || die
|
||||
rm b/c
|
||||
rmdir b
|
||||
|
||||
test_name "Rename a directory to a override a non-empty directory fails"
|
||||
mkdir a || die
|
||||
touch a/c || die
|
||||
mkdir b || die
|
||||
touch b/d || die
|
||||
err=$(${Src_Dir}/h_tools rename a b 2>&1) && die
|
||||
echo ${err} | grep 'Directory not empty' >/dev/null || die
|
||||
test -d a || die
|
||||
test -f a/c || die
|
||||
test -d b || die
|
||||
test -f b/d || die
|
||||
rm a/c
|
||||
rm b/d
|
||||
rmdir a
|
||||
rmdir b
|
||||
|
||||
test_name "Rename a directory to a override a file fails"
|
||||
mkdir a || die
|
||||
touch b || die
|
||||
err=$(${Src_Dir}/h_tools rename a b 2>&1) && die
|
||||
echo ${err} | grep 'Not a directory' >/dev/null || die
|
||||
test -d a || die
|
||||
test -f b || die
|
||||
rmdir a
|
||||
rm b
|
||||
|
||||
test_name "Rename a file to a override a directory fails"
|
||||
touch a || die
|
||||
mkdir b || die
|
||||
err=$(${Src_Dir}/h_tools rename a b 2>&1) && die
|
||||
echo ${err} | grep 'Is a directory' >/dev/null || die
|
||||
test -f a || die
|
||||
test -d b || die
|
||||
rm a
|
||||
rmdir b
|
||||
|
||||
mkdir dir || die
|
||||
touch dir/a
|
||||
echo 'mv dir/a dir/b' | kqueue_monitor 2 dir dir/a || die
|
||||
|
Loading…
Reference in New Issue
Block a user