xref: /freebsd/tools/regression/msdosfs/msdosfstest-5.sh (revision 734e82fe33aa764367791a7d603b383996c6b40b)
1#!/bin/sh
2# A really simple script to create a swap-backed msdosfs filesystem, then
3# test to see if msdosfs_conv.c rev 1.45[2] works properly.
4# Note that this is a requisite condition but far away from sufficient condition.
5# You must check file system by "dir /x" on MS Windows.
6
7mkdir /tmp/msdosfstest
8mdconfig -a -t swap -s 128m -u 10
9bsdlabel -w md10 auto
10newfs_msdos -F 16 -b 8192 /dev/md10a
11mount_msdosfs -L ja_JP.eucJP -D CP932 -l /dev/md10a /tmp/msdosfstest
12# The comment is UTF-8, the actual command uses the eucJP representation.
13# touch /tmp/msdosfstest/ア (HALFWIDTH KATAKANA LETTER A)
14touch /tmp/msdosfstest/$'\216\261'
15if [ $? -eq 0 ]; then
16	umount /tmp/msdosfstest
17	mount_msdosfs -L ja_JP.eucJP -D CP932 -s /dev/md10a /tmp/msdosfstest
18	ls /tmp/msdosfstest/$'\216\261'
19	if [ $? -eq 0 ]; then
20		echo "ok 5 (pass stage 1/2)"
21		umount /tmp/msdosfstest
22		mount_msdosfs -L uk_UA.KOI8-U -D CP866 -l /dev/md10a /tmp/msdosfstest
23		# The comment is UTF-8, the actual command uses the KOI8-U representation.
24		# ls /tmp/msdosfstest/▒ (MEDIUM SHADE)
25		ls /tmp/msdosfstest/$'\221'
26		if [ $? -ne 0 ]; then
27			# assume that U+FF71 was recorded with long name
28			echo "ok 5 (pass stage 2/2)"
29		else
30			# only 0xb1 was found (doesn't have long name)
31			echo "not ok 5"
32		fi
33	else
34		echo "not ok 5"
35	fi
36else
37	echo "not ok 5"
38fi
39umount /tmp/msdosfstest
40mdconfig -d -u 10
41rmdir /tmp/msdosfstest
42