-
Notifications
You must be signed in to change notification settings - Fork 0
/
do_test_sticky.sh
executable file
·51 lines (39 loc) · 1.29 KB
/
do_test_sticky.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
tmpf=`mktemp -p .`
fail=0
testf=$1
nrpages=$2
[ ! "$tmpf" ] && echo "tmpf is void. dangerous operation!" && exit 1
rm -f tmp.* $testf
corrupted1=`grep -i corrupt /proc/meminfo | tr -s ' ' | cut -f2 -d' '`
sync ; sync
ruby -e 'puts "0"*8192' > $testf
./test $testf $nrpages read onerror
cat $testf > /dev/null # should fail
if [ $? -eq 0 ] ; then
echo "FAIL: error isolation does not work."
fail=$((fail+1))
else
echo "PASS: error isolation succeeded."
fi
page-types -b hwpoison -lN > /dev/null
# disturbing inode caches to remove inode of the target file
for i in `seq 1 1000` ; do echo 1 > ${tmpf}${i} ; done ; rm -f tmp.*
sync ; sync ; echo 3 > /proc/sys/vm/drop_caches
page-types -b hwpoison -lN > /dev/null
# retry checking AS_HWPOISON (expected not to be blocked)
cat $testf > /dev/null # should succeed
if [ $? -eq 0 ] ; then
echo "FAIL: AS_HWPOISON was cleared in inode drop."
fail=$((fail+1))
else
echo "PASS: AS_HWPOISON is sticky."
fi
page-types -b hwpoison -x -lN > /dev/null
rm -f tmp.* $testf
corrupted2=`grep -i corrupt /proc/meminfo | tr -s ' ' | cut -f2 -d' '`
if [ ! "$corrupted1" = "$corrupted2" ] ; then
echo "FAIL: \"HardwareCorrupted:\" does not match between before/after testing ($corrupted1, $corrupted2)"
fail=$[fail + 1]
fi
exit $fail