Hi, --- "Serge E. Hallyn" <[EMAIL PROTECTED]> wrote:
> Quoting CAI Qian ([EMAIL PROTECTED]): > > Hi, > > > > --- Veerendra <[EMAIL PROTECTED]> wrote: > > > > > This patch addresses the comments if any, on the below files > > > > > > child_propogate.sh - Propagates the contents of the child sysfs > to > > > parentNS. > > > parent_share.sh - Creates a sharable volume of the sysfs for > child to > > > access. > > > parent_view.sh - Parent NS verifies the contents of the child > sysfs. > > > sysfsview.c - Basic program to create namespaces for sysfs > checking > > > > > > > > > > > > > > > > > > > Signed off by Veerendra C <[EMAIL PROTECTED]> > > > ACKed by Serge Hallyn <[EMAIL PROTECTED]> > > > > > > > > > Renamed the file to child_propagate.sh to address the spelling > change > > > ! > > > --- containers.old/netns/child_propogate.sh 2008-09-08 > > > 17:18:28.000000000 +0530 > > > +++ containers/netns/child_propogate.sh 1970-01-01 > 05:30:00.000000000 > > > +0530 > > > @@ -1,47 +0,0 @@ > > > -#!/bin/bash > > > -# This script propogates the child sysfs contents to be visible > for > > > parent > > > -# Also it will check the parent sysfs contents are visible. > > > -#Propogate child sys directory > > > - > > > -# The test case ID, the test case count and the total number of > test > > > case > > > -TCID=${TCID:-child_propogate.sh} > > > -TST_TOTAL=1 > > > -TST_COUNT=1 > > > -#set -x > > > -export TCID > > > -export TST_COUNT > > > -export TST_TOTAL > > > - > > > - ret=0 > > > - PROPOGATE=`cat /tmp/FIFO4` > > > - debug "INFO: CHILD propopagated.." > > > - mount -t sysfs none /sys || ret=1 > > > - mkdir -p /tmp/mnt/sys || ret=1 > > > - mount --bind /sys /tmp/mnt/sys > /dev/null || ret=1 > > > - > > > - if [ $ret -ne 0 ]; then > > > - status=1 > > > - tst_resm TFAIL "error while doing bind mount" > > > - exit $status > > > - fi > > > - #Capture childs sysfs contents > > > - ls /sys/class/net > /tmp/child_sysfs > > > - echo propogated > /tmp/FIFO5 > > > - > > > - #Capture parent sysfs in child > > > - ls /tmp/par_sysfs/class/net > /tmp/parent_sysfs_in_child > > > - diff /tmp/parent_sysfs_in_child /tmp/parent_sysfs > > /dev/null > > > 2>&1 > > > - if [ $? -eq 0 ] > > > - then > > > - tst_resm TINFO "Pass:Child is able to view parent sysfs" > > > - status=0 > > > - else > > > - tst_resm TFAIL "Fail:Child view of sysfs is not same as > > > parent sysfs" > > > - status=1 > > > - fi > > > - > > > - echo $status > /tmp/FIFO6 > > > - > > > - #cleanup > > > - rm -f /tmp/parent_sysfs_in_child /tmp/parent_sysfs > > > - umount /tmp/mnt/sys > > > --- containers.old/netns/child_propagate.sh 1970-01-01 > > > 05:30:00.000000000 +0530 > > > +++ containers/netns/child_propagate.sh 2008-09-10 > 01:06:42.000000000 > > > +0530 > > > @@ -0,0 +1,46 @@ > > > +#!/bin/bash > > > +# This script propagates the child sysfs contents to be visible > for > > > parent > > > +# Also it will check the parent sysfs contents are visible. > > > +#Propagate child sys directory > > > + > > > +# The test case ID, the test case count and the total number of > test > > > case > > > +TCID=${TCID:-child_propagate.sh} > > > +TST_TOTAL=1 > > > +TST_COUNT=1 > > > +#set -x > > > +export TCID > > > +export TST_COUNT > > > +export TST_TOTAL > > > + > > > + ret=0 > > > + PROPAGATE=`cat /tmp/FIFO4` > > > + debug "INFO: CHILD propagated.." > > > + mount -t sysfs none /sys || ret=1 > > > > The test will fail if sysfs has been mounted by default in test > > systems. > > IIUC this will be the first task in the child network namespace. So > sys needs to be remounted. The fact that it has been mounted on the > host is not a problem. It will choose a new super-block and mount > that. The mount shouldn't fail, else something was actually wrong. > OK. > > Moreover, users will also see the confusing error message > > "error while doing bind mount" later. > > What do you mean, could you elaborate? > mount -t sysfs none /sys || ret=1 When it failed, "ret" become 1. Then, it propagated to the error handling, if [ $ret -ne 0 ]; then status=1 tst_resm TFAIL "error while doing bind mount" exit $status fi The error messages do not exactly match the failure. Cai Qian > > Cai Qian > > > > > + mkdir -p /tmp/mnt/sys || ret=1 > > > + mount --bind /sys /tmp/mnt/sys > /dev/null || ret=1 > > > + > > > + if [ $ret -ne 0 ]; then > > > + status=1 > > > + tst_resm TFAIL "error while doing bind mount" > > > + exit $status > > > + fi > > > + #Capture childs sysfs contents > > > + ls /sys/class/net > /tmp/child_sysfs > > > + echo propagated > /tmp/FIFO5 > > > + > > > + #Capture parent sysfs in child > > > + ls /tmp/par_sysfs/class/net > /tmp/parent_sysfs_in_child > > > + diff /tmp/parent_sysfs_in_child /tmp/parent_sysfs > > /dev/null > > > 2>&1 > > > + if [ $? -eq 0 ] > > > + then > > > + tst_resm TINFO "Pass:Child is able to view parent sysfs" > > > + status=0 > > > + else > > > + tst_resm TFAIL "Fail:Child view of sysfs is not same as > > > parent sysfs" > > > + status=1 > > > + fi > > > + > > > + #cleanup > > > + rm -f /tmp/parent_sysfs_in_child /tmp/parent_sysfs > > > + umount /tmp/mnt/sys > > > + rm -rf /tmp/mnt > /dev/null 2>&1 || true > > > Addressing the spelling error and also removed the redundant > entry > > > of passing status value. > > > --- containers.old/netns/parent_view.sh 2008-09-08 > 17:18:28.000000000 > > > +0530 > > > +++ containers/netns/parent_view.sh 2008-09-10 01:06:42.000000000 > > > +0530 > > > @@ -13,9 +13,9 @@ export TST_TOTAL > > > > > > debug "INFO: Parent SYSFS view" > > > ls /sys/class/net > /tmp/parent_sysfs > > > - echo PROPOGATE > /tmp/FIFO4 > > > + echo PROPAGATE > /tmp/FIFO4 > > > > > > - PROPOGATED=`cat /tmp/FIFO5` > > > + PROPAGATED=`cat /tmp/FIFO5` > > > ls /tmp/mnt/sys/class/net > /tmp/child_sysfs_in_parent > > > diff /tmp/child_sysfs_in_parent /tmp/child_sysfs > > > if [ $? -eq 0 ] > > > @@ -27,14 +27,11 @@ export TST_TOTAL > > > status=-1 > > > fi > > > > > > - stat=`cat /tmp/FIFO6` > > > - if [ $stat != 0 ] ; then > > > - status=$stat > > > - fi > > > - > > > #cleanup temp files > > > + > > > rm -f /tmp/child_sysfs_in_parent /tmp/child_sysfs > > > umount /tmp/par_sysfs > > > umount /tmp/mnt > > > sleep 1 > > > rm -rf /tmp/par_sysfs /tmp/mnt > /dev/null 2>&1 || true > > > + cleanup $sshpid $vnet0 > === message truncated === ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list