xref: /freebsd/sys/contrib/openzfs/tests/zfs-tests/tests/functional/casenorm/sensitive_formd_lookup.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 lookup only 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 lookup succeeds if (case=same).
29# 3. Check that lookup fails if (case=other).
30
31verify_runnable "global"
32
33function cleanup
34{
35	destroy_testfs
36}
37
38log_onexit cleanup
39log_assert "CS-UN FS: lookup succeeds if (case=same)"
40
41create_testfs "-o casesensitivity=sensitive -o normalization=formD"
42
43for name1 in $NAMES_ALL; do
44	log_must create_file $name1
45	for name2 in $NAMES_ALL; do
46		if [[ $(get_case $name2) == $(get_case $name1) ]]; then
47			log_must lookup_file $name2
48		else
49			log_mustnot lookup_file $name2
50		fi
51	done
52	delete_file $name1
53done
54
55destroy_testfs
56
57log_pass "CS-UN FS: lookup succeeds if (case=same)"
58