1#! /usr/bin/ksh -p
2#
3#
4# This file and its contents are supplied under the terms of the
5# Common Development and Distribution License ("CDDL"), version 1.0.
6# You may only use this file in accordance with the terms of version
7# 1.0 of the CDDL.
8#
9# A full copy of the text of the CDDL should have accompanied this
10# source.  A copy of the CDDL is also available via the Internet at
11# http://www.illumos.org/license/CDDL.
12#
13
14#
15# Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
16#
17
18#
19# Copyright (c) 2016 by Delphix. All rights reserved.
20#
21
22. $STF_SUITE/tests/functional/casenorm/casenorm.kshlib
23
24# DESCRIPTION:
25# Check that we can create FS with all supported normalization forms.
26#
27# STRATEGY:
28# 1. Create FS with all supported normalization forms.
29# 2. Check that utf8only is set on except for normalization=none.
30# 3. Check that it's not possible to create FS with utf8only=off
31#    and normalization other than none.
32
33verify_runnable "global"
34
35function cleanup
36{
37	destroy_testfs
38}
39
40log_onexit cleanup
41log_assert "Can create FS with all supported normalization forms"
42
43for form in none formC formD formKC formKD; do
44	create_testfs "-o normalization=$form"
45	if [[ $form != "none" ]] ; then
46		utf8only=$(zfs get -H -o value utf8only $TESTPOOL/$TESTFS)
47		if [[ $utf8only != "on" ]]; then
48			log_fail "Turning on normalization didn't set " \
49			    "utf8only to on"
50		fi
51	fi
52	destroy_testfs
53done
54
55for form in formC formD formKC formKD; do
56	log_mustnot zfs create -o utf8only=off -o normalization=$form \
57	    $TESTPOOL/$TESTFS
58	destroy_testfs
59done
60
61log_pass "Can create FS with all supported normalization forms"
62