All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check
@ 2016-08-30  8:01 Guangwen Feng
  2016-10-25  7:24 ` Guangwen Feng
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Guangwen Feng @ 2016-08-30  8:01 UTC (permalink / raw)
  To: ltp

Sysfs is not mount namespace aware until applying following kernel
patches in mainline kernel v2.6.35:

a1b3f59 net: Expose all network devices in a namespaces in sysfs
417daa1 hotplug: netns aware uevent_helper
d6523dd net/sysfs: Fix the bitrot in network device kobject namespace support
608b4b9 netns: Teach network device kobjects which namespace they are in

Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
Tested-by: Matus Marhefka <mmarhefk@redhat.com>
---
 testcases/kernel/containers/netns/netns_sysfs.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/testcases/kernel/containers/netns/netns_sysfs.sh b/testcases/kernel/containers/netns/netns_sysfs.sh
index 290cef8..b3a87ed 100644
--- a/testcases/kernel/containers/netns/netns_sysfs.sh
+++ b/testcases/kernel/containers/netns/netns_sysfs.sh
@@ -29,6 +29,11 @@ DUMMYDEV_HOST="dummy_test0"
 DUMMYDEV="dummy_test1"
 . test.sh
 
+tst_kvercmp 2 6 35
+if [ $? -eq 0 ]; then
+	tst_brkm TCONF "sysfs is not mount namespace aware for kernels older than 2.6.35"
+fi
+
 setns_check
 if [ $? -eq 32 ]; then
 	tst_brkm TCONF "setns not supported"
-- 
1.8.4.2




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check
  2016-08-30  8:01 [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check Guangwen Feng
@ 2016-10-25  7:24 ` Guangwen Feng
  2016-10-26 18:17 ` Jiri Jaburek
  2016-10-31  9:31 ` Cyril Hrubis
  2 siblings, 0 replies; 9+ messages in thread
From: Guangwen Feng @ 2016-10-25  7:24 UTC (permalink / raw)
  To: ltp

Hi!

Ping, thanks!

Regards,
Guangwen Feng

On 08/30/2016 04:01 PM, Guangwen Feng wrote:
> Sysfs is not mount namespace aware until applying following kernel
> patches in mainline kernel v2.6.35:
> 
> a1b3f59 net: Expose all network devices in a namespaces in sysfs
> 417daa1 hotplug: netns aware uevent_helper
> d6523dd net/sysfs: Fix the bitrot in network device kobject namespace support
> 608b4b9 netns: Teach network device kobjects which namespace they are in
> 
> Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
> Tested-by: Matus Marhefka <mmarhefk@redhat.com>
> ---
>  testcases/kernel/containers/netns/netns_sysfs.sh | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/testcases/kernel/containers/netns/netns_sysfs.sh b/testcases/kernel/containers/netns/netns_sysfs.sh
> index 290cef8..b3a87ed 100644
> --- a/testcases/kernel/containers/netns/netns_sysfs.sh
> +++ b/testcases/kernel/containers/netns/netns_sysfs.sh
> @@ -29,6 +29,11 @@ DUMMYDEV_HOST="dummy_test0"
>  DUMMYDEV="dummy_test1"
>  . test.sh
>  
> +tst_kvercmp 2 6 35
> +if [ $? -eq 0 ]; then
> +	tst_brkm TCONF "sysfs is not mount namespace aware for kernels older than 2.6.35"
> +fi
> +
>  setns_check
>  if [ $? -eq 32 ]; then
>  	tst_brkm TCONF "setns not supported"
> 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check
  2016-08-30  8:01 [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check Guangwen Feng
  2016-10-25  7:24 ` Guangwen Feng
@ 2016-10-26 18:17 ` Jiri Jaburek
  2016-10-27  7:55   ` Guangwen Feng
  2016-10-31  9:28   ` Cyril Hrubis
  2016-10-31  9:31 ` Cyril Hrubis
  2 siblings, 2 replies; 9+ messages in thread
From: Jiri Jaburek @ 2016-10-26 18:17 UTC (permalink / raw)
  To: ltp

On 08/30/16 10:01, Guangwen Feng wrote:
> Sysfs is not mount namespace aware until applying following kernel
> patches in mainline kernel v2.6.35:
> 
> a1b3f59 net: Expose all network devices in a namespaces in sysfs
> 417daa1 hotplug: netns aware uevent_helper
> d6523dd net/sysfs: Fix the bitrot in network device kobject namespace support
> 608b4b9 netns: Teach network device kobjects which namespace they are in
> 
> Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
> Tested-by: Matus Marhefka <mmarhefk@redhat.com>
> ---
>  testcases/kernel/containers/netns/netns_sysfs.sh | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/testcases/kernel/containers/netns/netns_sysfs.sh b/testcases/kernel/containers/netns/netns_sysfs.sh
> index 290cef8..b3a87ed 100644
> --- a/testcases/kernel/containers/netns/netns_sysfs.sh
> +++ b/testcases/kernel/containers/netns/netns_sysfs.sh
> @@ -29,6 +29,11 @@ DUMMYDEV_HOST="dummy_test0"
>  DUMMYDEV="dummy_test1"
>  . test.sh
>  
> +tst_kvercmp 2 6 35
> +if [ $? -eq 0 ]; then

Just out of curiosity - I see this used on more places, but can't
understand why would you use this instead of simply

  if tst_kvercmp 2 6 35; then

Any reason behind that? Am I missing a test writing rule?

Thanks.

> +	tst_brkm TCONF "sysfs is not mount namespace aware for kernels older than 2.6.35"
> +fi
> +
>  setns_check
>  if [ $? -eq 32 ]; then
>  	tst_brkm TCONF "setns not supported"
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check
  2016-10-26 18:17 ` Jiri Jaburek
@ 2016-10-27  7:55   ` Guangwen Feng
  2016-10-31  9:28   ` Cyril Hrubis
  1 sibling, 0 replies; 9+ messages in thread
From: Guangwen Feng @ 2016-10-27  7:55 UTC (permalink / raw)
  To: ltp

Hi!

On 10/27/2016 02:17 AM, Jiri Jaburek wrote:
> On 08/30/16 10:01, Guangwen Feng wrote:
>> Sysfs is not mount namespace aware until applying following kernel
>> patches in mainline kernel v2.6.35:
>>
>> a1b3f59 net: Expose all network devices in a namespaces in sysfs
>> 417daa1 hotplug: netns aware uevent_helper
>> d6523dd net/sysfs: Fix the bitrot in network device kobject namespace support
>> 608b4b9 netns: Teach network device kobjects which namespace they are in
>>
>> Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
>> Tested-by: Matus Marhefka <mmarhefk@redhat.com>
>> ---
>>  testcases/kernel/containers/netns/netns_sysfs.sh | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/testcases/kernel/containers/netns/netns_sysfs.sh b/testcases/kernel/containers/netns/netns_sysfs.sh
>> index 290cef8..b3a87ed 100644
>> --- a/testcases/kernel/containers/netns/netns_sysfs.sh
>> +++ b/testcases/kernel/containers/netns/netns_sysfs.sh
>> @@ -29,6 +29,11 @@ DUMMYDEV_HOST="dummy_test0"
>>  DUMMYDEV="dummy_test1"
>>  . test.sh
>>  
>> +tst_kvercmp 2 6 35
>> +if [ $? -eq 0 ]; then
> 
> Just out of curiosity - I see this used on more places, but can't
> understand why would you use this instead of simply
> 
>   if tst_kvercmp 2 6 35; then

Sure, this is simpler.
Thanks for reminding.

> 
> Any reason behind that? Am I missing a test writing rule?

There is no reason to me, I am just used to this.
Sorry, I am not sure whether there is a test writing rule about it either.

Best Regards,
Guangwen Feng

> 
> Thanks.
> 
>> +	tst_brkm TCONF "sysfs is not mount namespace aware for kernels older than 2.6.35"
>> +fi
>> +
>>  setns_check
>>  if [ $? -eq 32 ]; then
>>  	tst_brkm TCONF "setns not supported"
>>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check
  2016-10-26 18:17 ` Jiri Jaburek
  2016-10-27  7:55   ` Guangwen Feng
@ 2016-10-31  9:28   ` Cyril Hrubis
  2016-10-31 14:05     ` Jiri Jaburek
  1 sibling, 1 reply; 9+ messages in thread
From: Cyril Hrubis @ 2016-10-31  9:28 UTC (permalink / raw)
  To: ltp

Hi!
> > +tst_kvercmp 2 6 35
> > +if [ $? -eq 0 ]; then
> 
> Just out of curiosity - I see this used on more places, but can't
> understand why would you use this instead of simply
> 
>   if tst_kvercmp 2 6 35; then
> 
> Any reason behind that? Am I missing a test writing rule?

The most probable reason would be that the tst_kvercmp actually returns
ternary result (older than, equal or newer is mapped to 0, 1, 2) so if
you want to anything else than "kernel is older" check you have to
examine the $?.

Maybe I sould write a new tst_kvercmp for the new shell library that
would work similar to the test shell buildin so that we can do something
as:

if tst_kvercmp -nq "2.6.35" -o "3.8"; then
	...
fi

where the modifiers would stand for:

n  newer
nq newer or equal
o  older
oq older or equal

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check
  2016-08-30  8:01 [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check Guangwen Feng
  2016-10-25  7:24 ` Guangwen Feng
  2016-10-26 18:17 ` Jiri Jaburek
@ 2016-10-31  9:31 ` Cyril Hrubis
  2 siblings, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2016-10-31  9:31 UTC (permalink / raw)
  To: ltp

Hi!
Pushed, thanks.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check
  2016-10-31  9:28   ` Cyril Hrubis
@ 2016-10-31 14:05     ` Jiri Jaburek
  2016-10-31 14:36       ` Cyril Hrubis
  2016-11-01 14:30       ` Cyril Hrubis
  0 siblings, 2 replies; 9+ messages in thread
From: Jiri Jaburek @ 2016-10-31 14:05 UTC (permalink / raw)
  To: ltp

On 10/31/16 10:28, Cyril Hrubis wrote:
> Hi!
>>> +tst_kvercmp 2 6 35
>>> +if [ $? -eq 0 ]; then
>>
>> Just out of curiosity - I see this used on more places, but can't
>> understand why would you use this instead of simply
>>
>>   if tst_kvercmp 2 6 35; then
>>
>> Any reason behind that? Am I missing a test writing rule?
> 
> The most probable reason would be that the tst_kvercmp actually returns
> ternary result (older than, equal or newer is mapped to 0, 1, 2) so if
> you want to anything else than "kernel is older" check you have to
> examine the $?.
> 
> Maybe I sould write a new tst_kvercmp for the new shell library that
> would work similar to the test shell buildin so that we can do something
> as:
> 
> if tst_kvercmp -nq "2.6.35" -o "3.8"; then
> 	...
> fi
> 
> where the modifiers would stand for:
> 
> n  newer
> nq newer or equal
> o  older
> oq older or equal

If you're going to use letters for this, I suggest re-using what the
'test' a.k.a. '[' command has: -eq, -lt, -ge, -ne, etc.

If multiple options (like in your example) are supported, re-using the
logic from 'test' could also be a good idea: -a (and), -o (or), although
shell-based && or || might be more obvious.

if tst_kvercmp -ge "2.6.35" -a -lt "3.8"; then ...

if tst_kvercmp -ge "2.6.35" && tst_kvercmp -lt "3.8"; then ...

> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check
  2016-10-31 14:05     ` Jiri Jaburek
@ 2016-10-31 14:36       ` Cyril Hrubis
  2016-11-01 14:30       ` Cyril Hrubis
  1 sibling, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2016-10-31 14:36 UTC (permalink / raw)
  To: ltp

Hi!
> > where the modifiers would stand for:
> > 
> > n  newer
> > nq newer or equal
> > o  older
> > oq older or equal
> 
> If you're going to use letters for this, I suggest re-using what the
> 'test' a.k.a. '[' command has: -eq, -lt, -ge, -ne, etc.
> 
> If multiple options (like in your example) are supported, re-using the
> logic from 'test' could also be a good idea: -a (and), -o (or), although
> shell-based && or || might be more obvious.
> 
> if tst_kvercmp -ge "2.6.35" -a -lt "3.8"; then ...
> 
> if tst_kvercmp -ge "2.6.35" && tst_kvercmp -lt "3.8"; then ...

Sounds good. I will look into this.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check
  2016-10-31 14:05     ` Jiri Jaburek
  2016-10-31 14:36       ` Cyril Hrubis
@ 2016-11-01 14:30       ` Cyril Hrubis
  1 sibling, 0 replies; 9+ messages in thread
From: Cyril Hrubis @ 2016-11-01 14:30 UTC (permalink / raw)
  To: ltp

Hi!
> If you're going to use letters for this, I suggest re-using what the
> 'test' a.k.a. '[' command has: -eq, -lt, -ge, -ne, etc.
> 
> If multiple options (like in your example) are supported, re-using the
> logic from 'test' could also be a good idea: -a (and), -o (or), although
> shell-based && or || might be more obvious.
> 
> if tst_kvercmp -ge "2.6.35" -a -lt "3.8"; then ...
> 
> if tst_kvercmp -ge "2.6.35" && tst_kvercmp -lt "3.8"; then ...

FYI:

https://github.com/metan-ucw/ltp/commit/f18331dd1e2ff0772c71abf4c444de6487dbce87

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-11-01 14:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-30  8:01 [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check Guangwen Feng
2016-10-25  7:24 ` Guangwen Feng
2016-10-26 18:17 ` Jiri Jaburek
2016-10-27  7:55   ` Guangwen Feng
2016-10-31  9:28   ` Cyril Hrubis
2016-10-31 14:05     ` Jiri Jaburek
2016-10-31 14:36       ` Cyril Hrubis
2016-11-01 14:30       ` Cyril Hrubis
2016-10-31  9:31 ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.