xref: /freebsd/tests/sys/geom/class/uzip/1_test.sh (revision 96950419f15510287080c557174e0d8409f06956)
109d98641SEnji Cooper#!/bin/sh
209d98641SEnji Cooper
309d98641SEnji Coopertestsdir=$(dirname $0)
409d98641SEnji Cooper. $testsdir/conf.sh
509d98641SEnji Cooper
6db636d72SRuslan Bukin# Check host endianness
7db636d72SRuslan Bukinret=$(echo I | tr -d "[:space:]" | od -to2 | head -n1 | awk '{print $2}' | cut -c6)
8db636d72SRuslan Bukinif [ "$ret" = "1" ]; then
9db636d72SRuslan Bukin	# Little endian
10db636d72SRuslan Bukin	UUE=$testsdir/1_endian_little.img.uzip.uue
11db636d72SRuslan Bukinelif [ "$ret" = "0" ]; then
12db636d72SRuslan Bukin	# Big endian
13db636d72SRuslan Bukin	UUE=$testsdir/1_endian_big.img.uzip.uue
14db636d72SRuslan Bukinelse
15db636d72SRuslan Bukin	echo "Couldn't detect host endianness"
16db636d72SRuslan Bukin	exit 2
17db636d72SRuslan Bukinfi
18db636d72SRuslan Bukin
1909d98641SEnji Cooperecho "1..1"
2009d98641SEnji Cooper
2109d98641SEnji Cooperuudecode $UUE
22*96950419SGleb Smirnoffattach_md us0 -f $(basename $UUE .uue) || exit 1
2309d98641SEnji Coopersleep 1
2409d98641SEnji Cooper
2509d98641SEnji Coopermount -o ro /dev/${us0}.uzip "${mntpoint}" || exit 1
2609d98641SEnji Cooper
2709d98641SEnji Cooper#cat "${mntpoint}/etalon.txt"
2809d98641SEnji Cooperdiff -I '\$FreeBSD.*\$' -u $testsdir/etalon/etalon.txt "${mntpoint}/etalon.txt"
2909d98641SEnji Cooperif [ $? -eq 0 ]; then
3009d98641SEnji Cooper	echo "ok 1"
3109d98641SEnji Cooperelse
3209d98641SEnji Cooper	echo "not ok 1"
3309d98641SEnji Cooperfi
34