Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | From 0077532b07e268347cb8557be6d70148d5f0e840 Mon Sep 17 00:00:00 2001 |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 2 | From: Ting Liu <b28495@freescale.com> |
| 3 | Date: Wed, 21 Aug 2013 15:44:57 +0800 |
| 4 | Subject: [PATCH] run_test.py: not use hard coded path ../obj/hugeadm |
| 5 | |
| 6 | Hard coded path makes the script impossible to run out of source tree. |
| 7 | After 'make install', we can use hugeadm utility under DESTDIR. |
| 8 | |
| 9 | Upstream-Status: Submitted |
| 10 | |
| 11 | Signed-off-by: Ting Liu <b28495@freescale.com> |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 12 | |
Brad Bishop | 868407c | 2019-11-04 13:24:47 -0500 | [diff] [blame] | 13 | Update for 2.22. |
| 14 | Signed-off-by: Zheng Ruoqin <zhengrq.fnst@cn.fujitsu.com> |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 15 | --- |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 16 | tests/run_tests.py | 12 +++++++++++- |
| 17 | 1 file changed, 11 insertions(+), 1 deletion(-) |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 18 | |
| 19 | diff --git a/tests/run_tests.py b/tests/run_tests.py |
Brad Bishop | 868407c | 2019-11-04 13:24:47 -0500 | [diff] [blame] | 20 | index 018264d..0aabcd1 100755 |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 21 | --- a/tests/run_tests.py |
| 22 | +++ b/tests/run_tests.py |
Brad Bishop | 868407c | 2019-11-04 13:24:47 -0500 | [diff] [blame] | 23 | @@ -245,9 +245,19 @@ def get_pagesizes(): |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 24 | Use libhugetlbfs' hugeadm utility to get a list of page sizes that have |
| 25 | active mount points and at least one huge page allocated to the pool. |
| 26 | """ |
| 27 | + local_env = os.environ.copy() |
| 28 | + local_env["PATH"] = "../obj:%s" % local_env.get("PATH", "") |
| 29 | sizes = set() |
| 30 | out = "" |
| 31 | - (rc, out) = bash("../obj/hugeadm --page-sizes") |
| 32 | + try: |
| 33 | + p = subprocess.Popen("hugeadm --page-sizes", shell=True, env=local_env, stdout=subprocess.PIPE) |
| 34 | + rc = p.wait() |
| 35 | + except KeyboardInterrupt: |
| 36 | + return sizes |
| 37 | + except OSError: |
| 38 | + return sizes |
| 39 | + out = p.stdout.read().strip() |
| 40 | + |
Brad Bishop | 868407c | 2019-11-04 13:24:47 -0500 | [diff] [blame] | 41 | if rc != 0 or out == "": |
| 42 | return sizes |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 43 | |
Brad Bishop | 868407c | 2019-11-04 13:24:47 -0500 | [diff] [blame] | 44 | -- |
| 45 | 2.7.4 |
| 46 | |