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