test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V2] disable ASLR for multi process test
@ 2016-12-26  3:11 xu,huilong
  2016-12-27  5:59 ` Xu, Qian Q
  0 siblings, 1 reply; 2+ messages in thread
From: xu,huilong @ 2016-12-26  3:11 UTC (permalink / raw)
  To: dts; +Cc: xu,huilong

Signed-off-by: xu,huilong <huilongx.xu@intel.com>
---
 tests/TestSuite_multiprocess.py   | 8 +++++++-
 tests/TestSuite_unit_tests_eal.py | 7 +++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/tests/TestSuite_multiprocess.py b/tests/TestSuite_multiprocess.py
index b305437..00e8e27 100644
--- a/tests/TestSuite_multiprocess.py
+++ b/tests/TestSuite_multiprocess.py
@@ -57,7 +57,12 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
 
         self.verify(len(self.dut.get_all_cores()) >= 4, "Not enough Cores")
         self.tester.extend_external_packet_generator(TestMultiprocess, self)
-
+        try:
+            self.aslr_flag = int(self.dut.send_expect("cat /proc/sys/kernel/randomize_va_space", "# "))
+            if self.aslr_flag:
+                self.dut.send_expect("echo 0 > /proc/sys/kernel/randomize_va_space", "# ")
+        except:
+            print "This machine not support disable ASLR, maybe multi process will failed" 
         out = self.dut.build_dpdk_apps("./examples/multi_process/")
         self.verify('Error' not in out, "Compilation failed")
 
@@ -274,6 +279,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
         Run after each test suite.
         """
         self.dut.kill_all()
+        self.dut.send_expect("echo %d > /proc/sys/kernel/randomize_va_space" % self.aslr_flag, "# ")
         self.dut.close_session(self.session_secondary)
 
         pass
diff --git a/tests/TestSuite_unit_tests_eal.py b/tests/TestSuite_unit_tests_eal.py
index d27ba39..e5c0384 100644
--- a/tests/TestSuite_unit_tests_eal.py
+++ b/tests/TestSuite_unit_tests_eal.py
@@ -332,11 +332,18 @@ class TestUnitTestsEal(TestCase):
         """
         Run multiprocess autotest.
         """
+        try:
+            aslr_flag = int(self.dut.send_expect("cat /proc/sys/kernel/randomize_va_space", "# "))
+            if aslr_flag:
+                self.dut.send_expect("echo 0 > /proc/sys/kernel/randomize_va_space", "# ")
+        except:
+            print "This machine not support disable ASLR, maybe multi process will failed"
 
         self.dut.send_expect(self.test_app_cmdline + ' -m 64', "R.*T.*E.*>.*>", self.start_test_time)
         out = self.dut.send_expect("multiprocess_autotest", "RTE>>", self.run_cmd_time)
         self.dut.send_expect("quit", "# ")
         self.verify("Test OK" in out, "Test failed")
+        self.dut.send_expect("echo %d > /proc/sys/kernel/randomize_va_space" % aslr_flag, "# ")
 
     def test_string(self):
         """
-- 
1.9.3

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

* Re: [dts] [PATCH V2] disable ASLR for multi process test
  2016-12-26  3:11 [dts] [PATCH V2] disable ASLR for multi process test xu,huilong
@ 2016-12-27  5:59 ` Xu, Qian Q
  0 siblings, 0 replies; 2+ messages in thread
From: Xu, Qian Q @ 2016-12-27  5:59 UTC (permalink / raw)
  To: Xu, HuilongX, dts, Liu, Yong, Liu, Yuanhan; +Cc: Xu, HuilongX, Xu, Qian Q

+ Yuanhan here for some comments on multi process test. 
When test the application of multiprocess, do we need to disable ASLR? I am not sure if it's a point that we need to handle well in multi-process case. 

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of xu,huilong
> Sent: Monday, December 26, 2016 11:12 AM
> To: dts@dpdk.org
> Cc: Xu, HuilongX <huilongx.xu@intel.com>
> Subject: [dts] [PATCH V2] disable ASLR for multi process test
> 
> Signed-off-by: xu,huilong <huilongx.xu@intel.com>
> ---
>  tests/TestSuite_multiprocess.py   | 8 +++++++-
>  tests/TestSuite_unit_tests_eal.py | 7 +++++++
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/TestSuite_multiprocess.py b/tests/TestSuite_multiprocess.py
> index b305437..00e8e27 100644
> --- a/tests/TestSuite_multiprocess.py
> +++ b/tests/TestSuite_multiprocess.py
> @@ -57,7 +57,12 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
> 
>          self.verify(len(self.dut.get_all_cores()) >= 4, "Not enough Cores")
>          self.tester.extend_external_packet_generator(TestMultiprocess, self)
> -
> +        try:
> +            self.aslr_flag = int(self.dut.send_expect("cat
> /proc/sys/kernel/randomize_va_space", "# "))
> +            if self.aslr_flag:
> +                self.dut.send_expect("echo 0 >
> /proc/sys/kernel/randomize_va_space", "# ")
> +        except:
> +            print "This machine not support disable ASLR, maybe multi process will
> failed"
>          out = self.dut.build_dpdk_apps("./examples/multi_process/")
>          self.verify('Error' not in out, "Compilation failed")
> 
> @@ -274,6 +279,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
>          Run after each test suite.
>          """
>          self.dut.kill_all()
> +        self.dut.send_expect("echo %d >
> + /proc/sys/kernel/randomize_va_space" % self.aslr_flag, "# ")
>          self.dut.close_session(self.session_secondary)
> 
>          pass
> diff --git a/tests/TestSuite_unit_tests_eal.py b/tests/TestSuite_unit_tests_eal.py
> index d27ba39..e5c0384 100644
> --- a/tests/TestSuite_unit_tests_eal.py
> +++ b/tests/TestSuite_unit_tests_eal.py
> @@ -332,11 +332,18 @@ class TestUnitTestsEal(TestCase):
>          """
>          Run multiprocess autotest.
>          """
> +        try:
> +            aslr_flag = int(self.dut.send_expect("cat
> /proc/sys/kernel/randomize_va_space", "# "))
> +            if aslr_flag:
> +                self.dut.send_expect("echo 0 >
> /proc/sys/kernel/randomize_va_space", "# ")
> +        except:
> +            print "This machine not support disable ASLR, maybe multi process will
> failed"
> 
>          self.dut.send_expect(self.test_app_cmdline + ' -m 64', "R.*T.*E.*>.*>",
> self.start_test_time)
>          out = self.dut.send_expect("multiprocess_autotest", "RTE>>",
> self.run_cmd_time)
>          self.dut.send_expect("quit", "# ")
>          self.verify("Test OK" in out, "Test failed")
> +        self.dut.send_expect("echo %d >
> + /proc/sys/kernel/randomize_va_space" % aslr_flag, "# ")
> 
>      def test_string(self):
>          """
> --
> 1.9.3

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

end of thread, other threads:[~2016-12-27  5:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-26  3:11 [dts] [PATCH V2] disable ASLR for multi process test xu,huilong
2016-12-27  5:59 ` Xu, Qian Q

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).