xref: /freebsd/tests/sys/geom/class/uzip/1_test.sh (revision a0b9e2e854027e6ff61fb075a1309dbc71c42b54)
1#!/bin/sh
2# $FreeBSD$
3
4testsdir=$(dirname $0)
5. $testsdir/conf.sh
6
7# Check host endianness
8ret=$(echo I | tr -d "[:space:]" | od -to2 | head -n1 | awk '{print $2}' | cut -c6)
9if [ "$ret" = "1" ]; then
10	# Little endian
11	UUE=$testsdir/1_endian_little.img.uzip.uue
12elif [ "$ret" = "0" ]; then
13	# Big endian
14	UUE=$testsdir/1_endian_big.img.uzip.uue
15else
16	echo "Couldn't detect host endianness"
17	exit 2
18fi
19
20echo "1..1"
21
22uudecode $UUE
23us0=$(attach_md -f $(basename $UUE .uue)) || exit 1
24sleep 1
25
26mount -o ro /dev/${us0}.uzip "${mntpoint}" || exit 1
27
28#cat "${mntpoint}/etalon.txt"
29diff -I '\$FreeBSD.*\$' -u $testsdir/etalon/etalon.txt "${mntpoint}/etalon.txt"
30if [ $? -eq 0 ]; then
31	echo "ok 1"
32else
33	echo "not ok 1"
34fi
35