blob: 83934abef87f3e27e1e1e73fd486cfc41aa25fa4 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From 0077532b07e268347cb8557be6d70148d5f0e840 Mon Sep 17 00:00:00 2001
Patrick Williamsb48b7b42016-08-17 15:04:38 -05002From: Ting Liu <b28495@freescale.com>
3Date: Wed, 21 Aug 2013 15:44:57 +0800
4Subject: [PATCH] run_test.py: not use hard coded path ../obj/hugeadm
5
6Hard coded path makes the script impossible to run out of source tree.
7After 'make install', we can use hugeadm utility under DESTDIR.
8
9Upstream-Status: Submitted
10
11Signed-off-by: Ting Liu <b28495@freescale.com>
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080012
Brad Bishop868407c2019-11-04 13:24:47 -050013Update for 2.22.
14Signed-off-by: Zheng Ruoqin <zhengrq.fnst@cn.fujitsu.com>
Brad Bishope42b3e32020-01-15 22:08:42 -050015
16Update to work for python3
17Signed-off-by: Changqing Li <changqing.li@windriver.com>
Patrick Williamsb48b7b42016-08-17 15:04:38 -050018---
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080019 tests/run_tests.py | 12 +++++++++++-
20 1 file changed, 11 insertions(+), 1 deletion(-)
Patrick Williamsb48b7b42016-08-17 15:04:38 -050021
22diff --git a/tests/run_tests.py b/tests/run_tests.py
Brad Bishop868407c2019-11-04 13:24:47 -050023index 018264d..0aabcd1 100755
Patrick Williamsb48b7b42016-08-17 15:04:38 -050024--- a/tests/run_tests.py
25+++ b/tests/run_tests.py
Brad Bishop868407c2019-11-04 13:24:47 -050026@@ -245,9 +245,19 @@ def get_pagesizes():
Patrick Williamsb48b7b42016-08-17 15:04:38 -050027 Use libhugetlbfs' hugeadm utility to get a list of page sizes that have
28 active mount points and at least one huge page allocated to the pool.
29 """
30+ local_env = os.environ.copy()
31+ local_env["PATH"] = "../obj:%s" % local_env.get("PATH", "")
32 sizes = set()
33 out = ""
34- (rc, out) = bash("../obj/hugeadm --page-sizes")
35+ try:
36+ p = subprocess.Popen("hugeadm --page-sizes", shell=True, env=local_env, stdout=subprocess.PIPE)
37+ rc = p.wait()
38+ except KeyboardInterrupt:
39+ return sizes
40+ except OSError:
41+ return sizes
Brad Bishope42b3e32020-01-15 22:08:42 -050042+ out = p.stdout.read().decode().strip()
Patrick Williamsb48b7b42016-08-17 15:04:38 -050043+
Brad Bishop868407c2019-11-04 13:24:47 -050044 if rc != 0 or out == "":
45 return sizes
Patrick Williamsb48b7b42016-08-17 15:04:38 -050046
Brad Bishop868407c2019-11-04 13:24:47 -050047--
482.7.4
49