Changeset View
Changeset View
Standalone View
Standalone View
dev/raidframe/t_raid.sh
Property | Old Value | New Value |
---|---|---|
File Mode | 100755 | 100644 |
#! /usr/bin/atf-sh | #! /usr/bin/atf-sh | ||||
# $NetBSD: t_raid.sh,v 1.12 2013/02/19 21:08:24 joerg Exp $ | # $NetBSD: t_raid.sh,v 1.15 2020/11/30 05:33:32 msaitoh Exp $ | ||||
# | # | ||||
# Copyright (c) 2010 The NetBSD Foundation, Inc. | # Copyright (c) 2010 The NetBSD Foundation, Inc. | ||||
# All rights reserved. | # All rights reserved. | ||||
# | # | ||||
# Redistribution and use in source and binary forms, with or without | # Redistribution and use in source and binary forms, with or without | ||||
# modification, are permitted provided that the following conditions | # modification, are permitted provided that the following conditions | ||||
# are met: | # are met: | ||||
# 1. Redistributions of source code must retain the above copyright | # 1. Redistributions of source code must retain the above copyright | ||||
Show All 19 Lines | |||||
rawraid=/dev/rraid0${rawpart} | rawraid=/dev/rraid0${rawpart} | ||||
raidserver="rump_server -lrumpvfs -lrumpdev -lrumpdev_disk -lrumpdev_raidframe" | raidserver="rump_server -lrumpvfs -lrumpdev -lrumpdev_disk -lrumpdev_raidframe" | ||||
makecfg() | makecfg() | ||||
{ | { | ||||
level=${1} | level=${1} | ||||
ncol=${2} | ncol=${2} | ||||
printf "START array\n${ncol} 0\nSTART disks\n" > raid.conf | |||||
diskn=0 | |||||
while [ ${ncol} -gt ${diskn} ] ; do | |||||
echo "/disk${diskn}" >> raid.conf | |||||
diskn=$((diskn+1)) | |||||
done | |||||
printf "START layout\n32 1 1 ${level}\nSTART queue\nfifo 100\n" \ | |||||
>> raid.conf | |||||
} | |||||
makecfg_old() | |||||
{ | |||||
level=${1} | |||||
ncol=${2} | |||||
printf "START array\n1 ${ncol} 0\nSTART disks\n" > raid.conf | printf "START array\n1 ${ncol} 0\nSTART disks\n" > raid.conf | ||||
diskn=0 | diskn=0 | ||||
while [ ${ncol} -gt ${diskn} ] ; do | while [ ${ncol} -gt ${diskn} ] ; do | ||||
echo "/disk${diskn}" >> raid.conf | echo "/disk${diskn}" >> raid.conf | ||||
diskn=$((diskn+1)) | diskn=$((diskn+1)) | ||||
done | done | ||||
printf "START layout\n32 1 1 ${level}\nSTART queue\nfifo 100\n" \ | printf "START layout\n32 1 1 ${level}\nSTART queue\nfifo 100\n" \ | ||||
>> raid.conf | >> raid.conf | ||||
} | } | ||||
atf_test_case smalldisk cleanup | atf_test_case smalldisk cleanup | ||||
smalldisk_head() | smalldisk_head() | ||||
{ | { | ||||
atf_set "descr" "Checks the raidframe works on small disks " \ | atf_set "descr" "Checks the raidframe works on small disks " \ | ||||
"(PR kern/44239)" | "(PR kern/44239)" | ||||
atf_set "require.progs" "rump_server" | atf_set "require.progs" "rump_server" | ||||
} | } | ||||
smalldisk_body() | smalldisk_body_backend() | ||||
{ | { | ||||
makecfg 1 2 | |||||
export RUMP_SERVER=unix://sock | export RUMP_SERVER=unix://sock | ||||
atf_check -s exit:0 ${raidserver} \ | atf_check -s exit:0 ${raidserver} \ | ||||
-d key=/disk0,hostpath=disk0.img,size=1m \ | -d key=/disk0,hostpath=disk0.img,size=1m \ | ||||
-d key=/disk1,hostpath=disk1.img,size=1m \ | -d key=/disk1,hostpath=disk1.img,size=1m \ | ||||
${RUMP_SERVER} | ${RUMP_SERVER} | ||||
atf_check -s exit:0 rump.raidctl -C raid.conf raid0 | atf_check -s exit:0 rump.raidctl -C raid.conf raid0 | ||||
} | } | ||||
smalldisk_body() | |||||
{ | |||||
makecfg 1 2 | |||||
smalldisk_body_backend | |||||
} | |||||
smalldisk_cleanup() | smalldisk_cleanup() | ||||
{ | { | ||||
export RUMP_SERVER=unix://sock | export RUMP_SERVER=unix://sock | ||||
rump.halt | rump.halt | ||||
} | } | ||||
# The old configuration test case uses the smalldisk backend | |||||
atf_test_case old_numrows_config cleanup | |||||
old_numrows_config_head() | |||||
{ | |||||
atf_set "descr" "Checks the old numRows configuration works" | |||||
atf_set "require.progs" "rump_server" | |||||
} | |||||
# make this smaller once 44239 is fixed | old_numrows_config_body() | ||||
export RAID_MEDIASIZE=32m | { | ||||
makecfg_old 1 2 | |||||
smalldisk_body_backend | |||||
} | |||||
old_numrows_config_cleanup() | |||||
{ | |||||
export RUMP_SERVER=unix://sock | |||||
rump.halt | |||||
} | |||||
export RAID_MEDIASIZE=4m | |||||
atf_test_case raid1_compfail cleanup | atf_test_case raid1_compfail cleanup | ||||
raid1_compfail_head() | raid1_compfail_head() | ||||
{ | { | ||||
atf_set "descr" "Checks that RAID1 works after component failure" | atf_set "descr" "Checks that RAID1 works after component failure" | ||||
atf_set "require.progs" "rump_server" | atf_set "require.progs" "rump_server" | ||||
} | } | ||||
raid1_compfail_body() | raid1_compfail_body() | ||||
Show All 20 Lines | raid1_compfail_body() | ||||
rm disk1.img # FAIL | rm disk1.img # FAIL | ||||
atf_check -s exit:0 ${raidserver} \ | atf_check -s exit:0 ${raidserver} \ | ||||
-d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \ | -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \ | ||||
-d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \ | -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \ | ||||
${RUMP_SERVER} | ${RUMP_SERVER} | ||||
atf_check -s exit:0 rump.raidctl -c raid.conf raid0 | atf_check -s exit:0 rump.raidctl -c raid.conf raid0 | ||||
# check if we we get what we wrote | # check if we get what we wrote | ||||
atf_check -s exit:0 -o file:testfile -e ignore \ | atf_check -s exit:0 -o file:testfile -e ignore \ | ||||
rump.dd if=${rawraid} count=4 | rump.dd if=${rawraid} count=4 | ||||
} | } | ||||
raid1_compfail_cleanup() | raid1_compfail_cleanup() | ||||
{ | { | ||||
export RUMP_SERVER=unix://sock | export RUMP_SERVER=unix://sock | ||||
rump.halt | rump.halt | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | export RUMP_SERVER=unix://sock | ||||
atf_check -s exit:0 ${raidserver} \ | atf_check -s exit:0 ${raidserver} \ | ||||
-d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \ | -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \ | ||||
-d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \ | -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \ | ||||
${RUMP_SERVER} | ${RUMP_SERVER} | ||||
atf_check -s exit:0 rump.raidctl -c raid.conf raid0 | atf_check -s exit:0 rump.raidctl -c raid.conf raid0 | ||||
# check if we we get what we wrote | # check if we get what we wrote | ||||
atf_check -s exit:0 -o file:testfile -e ignore \ | atf_check -s exit:0 -o file:testfile -e ignore \ | ||||
rump.dd if=${rawraid} count=4 | rump.dd if=${rawraid} count=4 | ||||
} | } | ||||
raid1_normal_cleanup() | raid1_normal_cleanup() | ||||
{ | { | ||||
export RUMP_SERVER=unix://sock | export RUMP_SERVER=unix://sock | ||||
Show All 34 Lines | raid5_compfail_body() | ||||
atf_check -s exit:0 ${raidserver} \ | atf_check -s exit:0 ${raidserver} \ | ||||
-d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \ | -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \ | ||||
-d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \ | -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \ | ||||
-d key=/disk2,hostpath=disk2.img,size=${RAID_MEDIASIZE} \ | -d key=/disk2,hostpath=disk2.img,size=${RAID_MEDIASIZE} \ | ||||
${RUMP_SERVER} | ${RUMP_SERVER} | ||||
atf_check -s exit:0 rump.raidctl -c raid.conf raid0 | atf_check -s exit:0 rump.raidctl -c raid.conf raid0 | ||||
# check if we we get what we wrote | # check if we get what we wrote | ||||
atf_check -s exit:0 -o file:testfile -e ignore \ | atf_check -s exit:0 -o file:testfile -e ignore \ | ||||
rump.dd if=${rawraid} count=4 | rump.dd if=${rawraid} count=4 | ||||
} | } | ||||
raid5_compfail_cleanup() | raid5_compfail_cleanup() | ||||
{ | { | ||||
export RUMP_SERVER=unix://sock | export RUMP_SERVER=unix://sock | ||||
rump.halt | rump.halt | ||||
Show All 33 Lines | raid5_normal_body() | ||||
atf_check -s exit:0 ${raidserver} \ | atf_check -s exit:0 ${raidserver} \ | ||||
-d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \ | -d key=/disk0,hostpath=disk0.img,size=${RAID_MEDIASIZE} \ | ||||
-d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \ | -d key=/disk1,hostpath=disk1.img,size=${RAID_MEDIASIZE} \ | ||||
-d key=/disk2,hostpath=disk2.img,size=${RAID_MEDIASIZE} \ | -d key=/disk2,hostpath=disk2.img,size=${RAID_MEDIASIZE} \ | ||||
${RUMP_SERVER} | ${RUMP_SERVER} | ||||
atf_check -s exit:0 rump.raidctl -c raid.conf raid0 | atf_check -s exit:0 rump.raidctl -c raid.conf raid0 | ||||
# check if we we get what we wrote | # check if we get what we wrote | ||||
atf_check -s exit:0 -o file:testfile -e ignore \ | atf_check -s exit:0 -o file:testfile -e ignore \ | ||||
rump.dd if=${rawraid} count=4 | rump.dd if=${rawraid} count=4 | ||||
} | } | ||||
raid5_normal_cleanup() | raid5_normal_cleanup() | ||||
{ | { | ||||
export RUMP_SERVER=unix://sock | export RUMP_SERVER=unix://sock | ||||
rump.halt | rump.halt | ||||
} | } | ||||
atf_init_test_cases() | atf_init_test_cases() | ||||
{ | { | ||||
atf_add_test_case smalldisk | atf_add_test_case smalldisk | ||||
atf_add_test_case old_numrows_config | |||||
atf_add_test_case raid1_normal | atf_add_test_case raid1_normal | ||||
atf_add_test_case raid1_comp0fail | atf_add_test_case raid1_comp0fail | ||||
atf_add_test_case raid1_compfail | atf_add_test_case raid1_compfail | ||||
atf_add_test_case raid5_normal | atf_add_test_case raid5_normal | ||||
atf_add_test_case raid5_compfail | atf_add_test_case raid5_compfail | ||||
} | } |