xref: /freebsd/sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/sensitive_formd_delete.ksh (revision 61145dc2b94f12f6a47344fb9aac702321880e43)
1#!/bin/ksh -p
2# SPDX-License-Identifier: CDDL-1.0
3#
4#
5# This file and its contents are supplied under the terms of the
6# Common Development and Distribution License ("CDDL"), version 1.0.
7# You may only use this file in accordance with the terms of version
8# 1.0 of the CDDL.
9#
10# A full copy of the text of the CDDL should have accompanied this
11# source.  A copy of the CDDL is also available via the Internet at
12# http://www.illumos.org/license/CDDL.
13#
14
15#
16# Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
17#
18
19. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
20
21# DESCRIPTION:
22# For the filesystem with casesensitivity=sensitive, normalization=formD,
23# check that delete succeeds if (case=same).
24#
25# STRATEGY:
26# For each c/n name form:
27# 1. Create file with given c/n name form.
28# 2. Check that delete succeeds if (case=same).
29# 3. Check that file is no longer accessible using any name form.
30# 4. Check that delete fails for all other name forms.
31
32verify_runnable "global"
33
34function cleanup
35{
36	destroy_testfs
37}
38
39log_onexit cleanup
40log_assert "CS-UN FS: delete succeeds if (case=same)"
41
42create_testfs "-o casesensitivity=sensitive -o normalization=formD"
43
44for name1 in $NAMES_ALL ; do
45	typeset -n namen=NAME_$(switch_norm $name1)_$(get_case $name1)
46	for name2 in $NAMES_ALL ; do
47		log_must create_file $name1
48		if [[ $name2 == $namen || $name2 == $name1 ]] ; then
49			log_must delete_file $name2
50			log_mustnot lookup_any
51		else
52			log_mustnot delete_file $name2
53		fi
54		delete_file $name1
55	done
56done
57
58destroy_testfs
59
60log_pass "CS-UN FS: delete succeeds if (case=same)"
61