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