diff mbox series

[1/2] network/busy_poll: Fix tests in namespaced env

Message ID 20210531135314.5067-1-mdoucha@suse.cz
State Accepted
Headers show
Series [1/2] network/busy_poll: Fix tests in namespaced env | expand

Commit Message

Martin Doucha May 31, 2021, 1:53 p.m. UTC
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/network/busy_poll/busy_poll01.sh | 15 ++++++---------
 testcases/network/busy_poll/busy_poll02.sh |  7 +++----
 testcases/network/busy_poll/busy_poll03.sh |  7 +++----
 3 files changed, 12 insertions(+), 17 deletions(-)

Comments

Alexey Kodanev June 1, 2021, 8:48 a.m. UTC | #1
On 31.05.2021 16:53, Martin Doucha wrote:
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
>  testcases/network/busy_poll/busy_poll01.sh | 15 ++++++---------
>  testcases/network/busy_poll/busy_poll02.sh |  7 +++----
>  testcases/network/busy_poll/busy_poll03.sh |  7 +++----
>  3 files changed, 12 insertions(+), 17 deletions(-)
> 
> diff --git a/testcases/network/busy_poll/busy_poll01.sh b/testcases/network/busy_poll/busy_poll01.sh
> 

Hi Martin,

...
>  setup()
>  {
>  	busy_poll_check_config
>  
> -	busy_poll_old="$(cat /proc/sys/net/core/busy_poll)"
> -	rbusy_poll_old=$(tst_rhost_run -c 'cat /proc/sys/net/core/busy_poll')
> +	busy_poll_old="$(sysctl -n /proc/sys/net/core/busy_poll)"
> +	rbusy_poll_old=$(tst_rhost_run -c 'sysctl -ne /proc/sys/net/core/busy_poll')
>  }

Here should be net.core.busy_poll, not the path.
Otherwise looks good.
Petr Vorel June 1, 2021, 9 a.m. UTC | #2
> On 31.05.2021 16:53, Martin Doucha wrote:
> > Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> > ---
> >  testcases/network/busy_poll/busy_poll01.sh | 15 ++++++---------
> >  testcases/network/busy_poll/busy_poll02.sh |  7 +++----
> >  testcases/network/busy_poll/busy_poll03.sh |  7 +++----
> >  3 files changed, 12 insertions(+), 17 deletions(-)

> > diff --git a/testcases/network/busy_poll/busy_poll01.sh b/testcases/network/busy_poll/busy_poll01.sh


> Hi Martin,

> ...
> >  setup()
> >  {
> >  	busy_poll_check_config

> > -	busy_poll_old="$(cat /proc/sys/net/core/busy_poll)"
> > -	rbusy_poll_old=$(tst_rhost_run -c 'cat /proc/sys/net/core/busy_poll')
> > +	busy_poll_old="$(sysctl -n /proc/sys/net/core/busy_poll)"
> > +	rbusy_poll_old=$(tst_rhost_run -c 'sysctl -ne /proc/sys/net/core/busy_poll')
> >  }

> Here should be net.core.busy_poll, not the path.
Hi Alexey, Martin,

Yep, I was just going to report it as well.

Merging both patches with this fix, thanks both for your time!

Kind regards,
Petr

> Otherwise looks good.
Martin Doucha June 1, 2021, 9:03 a.m. UTC | #3
On 01. 06. 21 11:00, Petr Vorel wrote:
>> Here should be net.core.busy_poll, not the path.
> Hi Alexey, Martin,
> 
> Yep, I was just going to report it as well.
> 
> Merging both patches with this fix, thanks both for your time!

Sorry about that and thanks for the fix.
diff mbox series

Patch

diff --git a/testcases/network/busy_poll/busy_poll01.sh b/testcases/network/busy_poll/busy_poll01.sh
index d306d1be8..0be4c5f96 100755
--- a/testcases/network/busy_poll/busy_poll01.sh
+++ b/testcases/network/busy_poll/busy_poll01.sh
@@ -21,22 +21,19 @@  cleanup()
 set_busy_poll()
 {
 	local value=${1:-"0"}
-	ROD_SILENT sysctl -q -w net.core.busy_read=$value
-	ROD_SILENT sysctl -q -w net.core.busy_poll=$value
-
-	tst_rhost_run -s -c "sysctl -q -w net.core.busy_read=$value"
-	tst_rhost_run -s -c "sysctl -q -w net.core.busy_poll=$value"
+	tst_set_sysctl net.core.busy_read $value safe
+	tst_set_sysctl net.core.busy_poll $value safe
 }
 
 setup()
 {
 	busy_poll_check_config
 
-	busy_read_old="$(cat /proc/sys/net/core/busy_read)"
-	busy_poll_old="$(cat /proc/sys/net/core/busy_poll)"
+	busy_read_old="$(sysctl -n net.core.busy_read)"
+	busy_poll_old="$(sysctl -n net.core.busy_poll)"
 
-	rbusy_read_old=$(tst_rhost_run -c 'cat /proc/sys/net/core/busy_read')
-	rbusy_poll_old=$(tst_rhost_run -c 'cat /proc/sys/net/core/busy_poll')
+	rbusy_read_old=$(tst_rhost_run -c 'sysctl -ne net.core.busy_read')
+	rbusy_poll_old=$(tst_rhost_run -c 'sysctl -ne net.core.busy_poll')
 }
 
 test()
diff --git a/testcases/network/busy_poll/busy_poll02.sh b/testcases/network/busy_poll/busy_poll02.sh
index d02aa7342..ec275bec9 100755
--- a/testcases/network/busy_poll/busy_poll02.sh
+++ b/testcases/network/busy_poll/busy_poll02.sh
@@ -17,16 +17,15 @@  cleanup()
 set_busy_poll()
 {
 	local value=${1:-"0"}
-	ROD_SILENT sysctl -q -w net.core.busy_poll=$value
-	tst_rhost_run -s -c "sysctl -q -w net.core.busy_poll=$value"
+	tst_set_sysctl net.core.busy_poll $value safe
 }
 
 setup()
 {
 	busy_poll_check_config
 
-	busy_poll_old="$(cat /proc/sys/net/core/busy_poll)"
-	rbusy_poll_old=$(tst_rhost_run -c 'cat /proc/sys/net/core/busy_poll')
+	busy_poll_old="$(sysctl -n net.core.busy_poll)"
+	rbusy_poll_old=$(tst_rhost_run -c 'sysctl -ne net.core.busy_poll')
 }
 
 test()
diff --git a/testcases/network/busy_poll/busy_poll03.sh b/testcases/network/busy_poll/busy_poll03.sh
index f6f1ac134..ccdb8308a 100755
--- a/testcases/network/busy_poll/busy_poll03.sh
+++ b/testcases/network/busy_poll/busy_poll03.sh
@@ -19,16 +19,15 @@  cleanup()
 set_busy_poll()
 {
 	local value=${1:-"0"}
-	ROD_SILENT sysctl -q -w net.core.busy_poll=$value
-	tst_rhost_run -s -c "sysctl -q -w net.core.busy_poll=$value"
+	tst_set_sysctl net.core.busy_poll $value safe
 }
 
 setup()
 {
 	busy_poll_check_config
 
-	busy_poll_old="$(cat /proc/sys/net/core/busy_poll)"
-	rbusy_poll_old=$(tst_rhost_run -c 'cat /proc/sys/net/core/busy_poll')
+	busy_poll_old="$(sysctl -n /proc/sys/net/core/busy_poll)"
+	rbusy_poll_old=$(tst_rhost_run -c 'sysctl -ne /proc/sys/net/core/busy_poll')
 }
 
 test()