Path: blob/main/tests/sys/geom/class/concat/append1.sh
39638 views
#!/bin/sh12# A basic regression test for gconcat append using "gconcat create",3# i.e., manual mode.45gconcat_check_size()6{7local actual expected name89name=$110expected=$21112actual=$(diskinfo /dev/concat/${name} | awk '{print $3}')13if [ $actual -eq $expected ]; then14echo "ok - Size is ${actual}"15else16echo "not ok - Size is ${actual}"17fi18}1920. `dirname $0`/conf.sh2122echo '1..3'2324attach_md us0 -t malloc -s 1M || exit 125attach_md us1 -t malloc -s 1M || exit 126attach_md us2 -t malloc -s 1M || exit 12728gconcat create $name /dev/$us0 /dev/$us1 || exit 129devwait3031# We should have a 2MB device. Add another disk and verify that the32# reported size of the concat device grows accordingly.33gconcat_check_size "${name}" $((2 * 1024 * 1024))34gconcat append $name /dev/$us2 || exit 135gconcat_check_size "${name}" $((3 * 1024 * 1024))3637# Write some data and make sure that we can read it back.38tmpfile=$(mktemp) || exit 139dd if=/dev/random of=$tmpfile bs=1M count=3 || exit 140dd if=$tmpfile of=/dev/concat/${name} || exit 141if cmp -s $tmpfile /dev/concat/${name}; then42echo "ok - Data matches what was written"43else44echo "not ok - Data matches what was written"45fi464748