summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/buildperf/test_basic.py
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-06-27 14:45:02 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-17 10:35:43 +0100
commitdaee7558a563fad5034cb7aeb7d67e7c1cbb17e8 (patch)
treeaa9d95030cc270a7bb75c6e044687b9297c64535 /meta/lib/oeqa/buildperf/test_basic.py
parent6203a77a53fe44dd51f36c40268f26b68ab72d70 (diff)
downloadpoky-daee7558a563fad5034cb7aeb7d67e7c1cbb17e8.tar.gz
oeqa.buildperf: rename module containing basic tests
(From OE-Core rev: 56e455cf4b42ff4db36debd342bcb03c5199ba52) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/buildperf/test_basic.py')
-rw-r--r--meta/lib/oeqa/buildperf/test_basic.py133
1 files changed, 133 insertions, 0 deletions
diff --git a/meta/lib/oeqa/buildperf/test_basic.py b/meta/lib/oeqa/buildperf/test_basic.py
new file mode 100644
index 0000000000..ada5aba053
--- /dev/null
+++ b/meta/lib/oeqa/buildperf/test_basic.py
@@ -0,0 +1,133 @@
1# Copyright (c) 2016, Intel Corporation.
2#
3# This program is free software; you can redistribute it and/or modify it
4# under the terms and conditions of the GNU General Public License,
5# version 2, as published by the Free Software Foundation.
6#
7# This program is distributed in the hope it will be useful, but WITHOUT
8# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
10# more details.
11#
12"""Basic set of build performance tests"""
13import os
14import shutil
15
16from . import BuildPerfTest, perf_test_case
17from oeqa.utils.commands import get_bb_vars
18
19
20@perf_test_case
21class Test1P1(BuildPerfTest):
22 name = "test1"
23 build_target = 'core-image-sato'
24 description = "Measure wall clock of bitbake {} and size of tmp dir".format(build_target)
25
26 def _run(self):
27 self.log_cmd_output("bitbake {} -c fetchall".format(self.build_target))
28 self.rm_tmp()
29 self.rm_sstate()
30 self.rm_cache()
31 self.sync()
32 self.measure_cmd_resources(['bitbake', self.build_target], 'build',
33 'bitbake ' + self.build_target)
34 self.measure_disk_usage(self.bb_vars['TMPDIR'], 'tmpdir', 'tmpdir')
35 self.save_buildstats()
36
37
38@perf_test_case
39class Test1P2(BuildPerfTest):
40 name = "test12"
41 build_target = 'virtual/kernel'
42 description = "Measure bitbake {}".format(build_target)
43
44 def _run(self):
45 self.log_cmd_output("bitbake {} -c cleansstate".format(
46 self.build_target))
47 self.sync()
48 self.measure_cmd_resources(['bitbake', self.build_target], 'build',
49 'bitbake ' + self.build_target)
50
51
52@perf_test_case
53class Test1P3(BuildPerfTest):
54 name = "test13"
55 build_target = 'core-image-sato'
56 description = "Build {} with rm_work enabled".format(build_target)
57
58 def _run(self):
59 postfile = os.path.join(self.out_dir, 'postfile.conf')
60 with open(postfile, 'w') as fobj:
61 fobj.write('INHERIT += "rm_work"\n')
62 try:
63 self.rm_tmp()
64 self.rm_sstate()
65 self.rm_cache()
66 self.sync()
67 cmd = ['bitbake', '-R', postfile, self.build_target]
68 self.measure_cmd_resources(cmd, 'build',
69 'bitbake' + self.build_target)
70 self.measure_disk_usage(self.bb_vars['TMPDIR'], 'tmpdir', 'tmpdir')
71 finally:
72 os.unlink(postfile)
73 self.save_buildstats()
74
75
76@perf_test_case
77class Test2(BuildPerfTest):
78 name = "test2"
79 build_target = 'core-image-sato'
80 description = "Measure bitbake {} -c rootfs with sstate".format(build_target)
81
82 def _run(self):
83 self.rm_tmp()
84 self.rm_cache()
85 self.sync()
86 cmd = ['bitbake', self.build_target, '-c', 'rootfs']
87 self.measure_cmd_resources(cmd, 'do_rootfs', 'bitbake do_rootfs')
88
89
90@perf_test_case
91class Test3(BuildPerfTest):
92 name = "test3"
93 description = "Parsing time metrics (bitbake -p)"
94
95 def _run(self):
96 # Drop all caches and parse
97 self.rm_cache()
98 self.force_rm(os.path.join(self.bb_vars['TMPDIR'], 'cache'))
99 self.measure_cmd_resources(['bitbake', '-p'], 'parse_1',
100 'bitbake -p (no caches)')
101 # Drop tmp/cache
102 self.force_rm(os.path.join(self.bb_vars['TMPDIR'], 'cache'))
103 self.measure_cmd_resources(['bitbake', '-p'], 'parse_2',
104 'bitbake -p (no tmp/cache)')
105 # Parse with fully cached data
106 self.measure_cmd_resources(['bitbake', '-p'], 'parse_3',
107 'bitbake -p (cached)')
108
109
110@perf_test_case
111class Test4(BuildPerfTest):
112 name = "test4"
113 build_target = 'core-image-sato'
114 description = "eSDK metrics"
115
116 def _run(self):
117 self.log_cmd_output("bitbake {} -c do_populate_sdk_ext".format(
118 self.build_target))
119 self.bb_vars = get_bb_vars(None, self.build_target)
120 tmp_dir = self.bb_vars['TMPDIR']
121 installer = os.path.join(
122 self.bb_vars['SDK_DEPLOY'],
123 self.bb_vars['TOOLCHAINEXT_OUTPUTNAME'] + '.sh')
124 # Measure installer size
125 self.measure_disk_usage(installer, 'installer_bin', 'eSDK installer')
126 # Measure deployment time and deployed size
127 deploy_dir = os.path.join(tmp_dir, 'esdk-deploy')
128 if os.path.exists(deploy_dir):
129 shutil.rmtree(deploy_dir)
130 self.sync()
131 self.measure_cmd_resources([installer, '-y', '-d', deploy_dir],
132 'deploy', 'eSDK deploy')
133 self.measure_disk_usage(deploy_dir, 'deploy_dir', 'deploy dir')