Skip to content
Snippets Groups Projects
Commit 28ed7a58 authored by Yury Umanets's avatar Yury Umanets
Browse files

- improvements in sanity-gns.sh:

  - more smart way to check if fs is mounted
  - in test 2g checking GNS with recursive path where last dir is not suid bit marked - should fail to mount it
parent 8291fd75
No related merge requests found
...@@ -286,6 +286,22 @@ show_log() { ...@@ -286,6 +286,22 @@ show_log() {
} }
} }
check_mnt()
{
local OBJECT=$1
local mnt=""
local p=""
mnt="`cat /proc/mounts | grep $OBJECT | awk '{print \$2}'`"
test -z "$mnt" && return 1
for p in $mnt; do
test "x$p" = "x$OBJECT" || return 1
done
return 0
}
check_gns() { check_gns() {
local LOG="/tmp/gns-log" local LOG="/tmp/gns-log"
local UPCALL_PATH="" local UPCALL_PATH=""
...@@ -373,17 +389,14 @@ check_gns() { ...@@ -373,17 +389,14 @@ check_gns() {
return 1 return 1
esac esac
local ENTRY1="`basename $OBJECT1`" check_mnt $OBJECT1 || {
local ENTRY2="`basename $OBJECT2`"
cat /proc/mounts | grep -q "$ENTRY1" || {
echo "fail" echo "fail"
show_log $LOG show_log $LOG
return 1 return 1
} }
if test "x$MODE" = "xCONCUR2"; then if test "x$MODE" = "xCONCUR2"; then
cat /proc/mounts | grep -q "$ENTRY2" || { check_mnt $OBJECT2 || {
echo "fail" echo "fail"
show_log $LOG show_log $LOG
return 1 return 1
...@@ -396,14 +409,14 @@ check_gns() { ...@@ -396,14 +409,14 @@ check_gns() {
let sleep_time+=$TICK*2 let sleep_time+=$TICK*2
echo -n "waiting for umount ${sleep_time}s (timeout + tick*2): " echo -n "waiting for umount ${sleep_time}s (timeout + tick*2): "
sleep $sleep_time sleep $sleep_time
cat /proc/mounts | grep -q "$ENTRY1" && { check_mnt $OBJECT1 && {
echo "failed" echo "failed"
return 2 return 2
} }
if test "x$MODE" = "xCONCUR2"; then if test "x$MODE" = "xCONCUR2"; then
cat /proc/mounts | grep -q "$ENTRY2" && { check_mnt $OBJECT2 && {
echo "failed" echo "failed"
return 2 return 2
} }
...@@ -494,6 +507,7 @@ test_1a() { ...@@ -494,6 +507,7 @@ test_1a() {
echo "" echo ""
echo "testing GNS with GENERIC upcall 3 times on the row" echo "testing GNS with GENERIC upcall 3 times on the row"
for ((i=0;i<3;i++)); do for ((i=0;i<3;i++)); do
check_gns GENERIC $DIR/gns_test_1a $DIR/gns_test_1a $TIMOUT $TICK GENERIC || { check_gns GENERIC $DIR/gns_test_1a $DIR/gns_test_1a $TIMOUT $TICK GENERIC || {
disable_gns disable_gns
...@@ -537,6 +551,7 @@ test_1b() { ...@@ -537,6 +551,7 @@ test_1b() {
echo "" echo ""
echo "testing GNS with DEADLOCK upcall 3 times on the row" echo "testing GNS with DEADLOCK upcall 3 times on the row"
for ((i=0;i<3;i++)); do for ((i=0;i<3;i++)); do
check_gns DEADLOCK $DIR/gns_test_1b $DIR/gns_test_1b $TIMOUT $TICK GENERIC || { check_gns DEADLOCK $DIR/gns_test_1b $DIR/gns_test_1b $TIMOUT $TICK GENERIC || {
disable_gns disable_gns
...@@ -579,7 +594,7 @@ test_1c() { ...@@ -579,7 +594,7 @@ test_1c() {
enable_gns enable_gns
echo "" echo ""
echo "testing GNS with DEADLOCK upcall 4 times on the row" echo "testing GNS with GENERIC/DEADLOCK upcall 4 times on the row in GENERIC mode"
local i=0 local i=0
for ((;i<4;i++)); do for ((;i<4;i++)); do
...@@ -681,6 +696,7 @@ test_1e() { ...@@ -681,6 +696,7 @@ test_1e() {
echo "" echo ""
echo "testing GNS with GENERIC upcall in CONCUR2 mode" echo "testing GNS with GENERIC upcall in CONCUR2 mode"
check_gns GENERIC $DIR/gns_test_1e1 $DIR/gns_test_1e2 $TIMOUT $TICK CONCUR2 || { check_gns GENERIC $DIR/gns_test_1e1 $DIR/gns_test_1e2 $TIMOUT $TICK CONCUR2 || {
disable_gns disable_gns
cleanup_object $DIR/gns_test_1e1 cleanup_object $DIR/gns_test_1e1
...@@ -717,6 +733,7 @@ test_2a() { ...@@ -717,6 +733,7 @@ test_2a() {
echo "" echo ""
echo "testing GNS with GENERIC upcall" echo "testing GNS with GENERIC upcall"
check_gns GENERIC $DIR/gns_test_2a $DIR/gns_test_2a $TIMOUT $TICK GENERIC && { check_gns GENERIC $DIR/gns_test_2a $DIR/gns_test_2a $TIMOUT $TICK GENERIC && {
disable_gns disable_gns
chmod u-s $DIR/gns_test_2a chmod u-s $DIR/gns_test_2a
...@@ -749,6 +766,7 @@ test_2b() { ...@@ -749,6 +766,7 @@ test_2b() {
echo "" echo ""
echo "testing GNS with GENERIC upcall" echo "testing GNS with GENERIC upcall"
check_gns GENERIC $DIR/gns_test_2b $DIR/gns_test_2b $TIMOUT $TICK GENERIC && { check_gns GENERIC $DIR/gns_test_2b $DIR/gns_test_2b $TIMOUT $TICK GENERIC && {
disable_gns disable_gns
chmod u-s $DIR/gns_test_2b chmod u-s $DIR/gns_test_2b
...@@ -781,6 +799,7 @@ test_2c() { ...@@ -781,6 +799,7 @@ test_2c() {
echo "" echo ""
echo "testing GNS with GENERIC upcall" echo "testing GNS with GENERIC upcall"
check_gns GENERIC $DIR/gns_test_2c $DIR/gns_test_2c $TIMOUT $TICK GENERIC && { check_gns GENERIC $DIR/gns_test_2c $DIR/gns_test_2c $TIMOUT $TICK GENERIC && {
disable_gns disable_gns
chmod u-s -R $DIR/gns_test_2c chmod u-s -R $DIR/gns_test_2c
...@@ -813,6 +832,7 @@ test_2d() { ...@@ -813,6 +832,7 @@ test_2d() {
echo "" echo ""
echo "testing GNS with GENERIC upcall" echo "testing GNS with GENERIC upcall"
check_gns GENERIC $DIR/gns_test_2d $DIR/gns_test_2d $TIMOUT $TICK GENERIC && { check_gns GENERIC $DIR/gns_test_2d $DIR/gns_test_2d $TIMOUT $TICK GENERIC && {
disable_gns disable_gns
chmod u-s $DIR/gns_test_2d chmod u-s $DIR/gns_test_2d
...@@ -934,11 +954,25 @@ $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $TIMOUT $TICK GENERIC || { ...@@ -934,11 +954,25 @@ $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $TIMOUT $TICK GENERIC || {
disable_gns disable_gns
cleanup_object $DIR/gns_test_2g cleanup_object $DIR/gns_test_2g
cleanup_loop $LOOP_DEV $LOOP_FILE cleanup_loop $LOOP_DEV $LOOP_FILE
error error "recursive mount point does not work"
} }
disable_gns disable_gns
chmod u-s $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT
enable_gns
check_gns $MODE $DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT \
$DIR/gns_test_2g/$OBJECT/$OBJECT/$OBJECT $TIMOUT $TICK GENERIC && {
disable_gns
cleanup_object $DIR/gns_test_2g
cleanup_loop $LOOP_DEV $LOOP_FILE
error "GNS works whereas mount point is not SUID marked dir"
}
disable_gns
cleanup_object $DIR/gns_test_2g cleanup_object $DIR/gns_test_2g
cleanup_loop $LOOP_DEV $LOOP_FILE cleanup_loop $LOOP_DEV $LOOP_FILE
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment