mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-01 19:02:31 +01:00
Initial commit of open source Workload Automation.
This commit is contained in:
12
wlauto/tests/README
Normal file
12
wlauto/tests/README
Normal file
@@ -0,0 +1,12 @@
|
||||
To run these tests you need to have nose package installed. You can get it from PyPI by using pip:
|
||||
|
||||
pip install nose
|
||||
|
||||
Or, if you're on Ubuntu, you can get it from distribution repositories:
|
||||
|
||||
sudo apt-get install python-nose
|
||||
|
||||
Once you have it, you can the tests by executing the follwing the project's top-level directory (the
|
||||
one with setup.py):
|
||||
|
||||
nosetests
|
16
wlauto/tests/__init__.py
Normal file
16
wlauto/tests/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copyright 2013-2015 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
49
wlauto/tests/data/extensions/devices/test_device.py
Normal file
49
wlauto/tests/data/extensions/devices/test_device.py
Normal file
@@ -0,0 +1,49 @@
|
||||
# Copyright 2013-2015 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
from wlauto import Device
|
||||
|
||||
|
||||
class TestDevice(Device):
|
||||
|
||||
name = 'test-device'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.modules = []
|
||||
self.boot_called = 0
|
||||
self.push_file_called = 0
|
||||
self.pull_file_called = 0
|
||||
self.execute_called = 0
|
||||
self.set_sysfile_int_called = 0
|
||||
self.close_called = 0
|
||||
|
||||
def boot(self):
|
||||
self.boot_called += 1
|
||||
|
||||
def push_file(self, source, dest):
|
||||
self.push_file_called += 1
|
||||
|
||||
def pull_file(self, source, dest):
|
||||
self.pull_file_called += 1
|
||||
|
||||
def execute(self, command):
|
||||
self.execute_called += 1
|
||||
|
||||
def set_sysfile_int(self, file, value):
|
||||
self.set_sysfile_int_called += 1
|
||||
|
||||
def close(self, command):
|
||||
self.close_called += 1
|
98
wlauto/tests/data/interrupts/after
Executable file
98
wlauto/tests/data/interrupts/after
Executable file
@@ -0,0 +1,98 @@
|
||||
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7
|
||||
65: 0 0 0 0 0 0 0 0 GIC dma-pl330.2
|
||||
66: 0 0 0 0 0 0 0 0 GIC dma-pl330.0
|
||||
67: 0 0 0 0 0 0 0 0 GIC dma-pl330.1
|
||||
74: 0 0 0 0 0 0 0 0 GIC s3c2410-wdt
|
||||
85: 2 0 0 0 0 0 0 0 GIC exynos4210-uart
|
||||
89: 368 0 0 0 0 0 0 0 GIC s3c2440-i2c.1
|
||||
90: 0 0 0 0 0 0 0 0 GIC s3c2440-i2c.2
|
||||
92: 1294 0 0 0 0 0 0 0 GIC exynos5-hs-i2c.0
|
||||
95: 831 0 0 0 0 0 0 0 GIC exynos5-hs-i2c.3
|
||||
103: 1 0 0 0 0 0 0 0 GIC ehci_hcd:usb1, ohci_hcd:usb2
|
||||
104: 7304 0 0 0 0 0 0 0 GIC xhci_hcd:usb3, exynos-ss-udc.0
|
||||
105: 0 0 0 0 0 0 0 0 GIC xhci_hcd:usb5
|
||||
106: 0 0 0 0 0 0 0 0 GIC mali.0
|
||||
107: 16429 0 0 0 0 0 0 0 GIC dw-mci
|
||||
108: 1 0 0 0 0 0 0 0 GIC dw-mci
|
||||
109: 0 0 0 0 0 0 0 0 GIC dw-mci
|
||||
114: 28074 0 0 0 0 0 0 0 GIC mipi-dsi
|
||||
117: 0 0 0 0 0 0 0 0 GIC exynos-gsc
|
||||
118: 0 0 0 0 0 0 0 0 GIC exynos-gsc
|
||||
121: 0 0 0 0 0 0 0 0 GIC exynos5-jpeg-hx
|
||||
123: 7 0 0 0 0 0 0 0 GIC s5p-fimg2d
|
||||
126: 0 0 0 0 0 0 0 0 GIC s5p-mixer
|
||||
127: 0 0 0 0 0 0 0 0 GIC hdmi-int
|
||||
128: 0 0 0 0 0 0 0 0 GIC s5p-mfc-v6
|
||||
142: 0 0 0 0 0 0 0 0 GIC dma-pl330.3
|
||||
146: 0 0 0 0 0 0 0 0 GIC s5p-tvout-cec
|
||||
149: 1035 0 0 0 0 0 0 0 GIC mali.0
|
||||
152: 26439 0 0 0 0 0 0 0 GIC mct_tick0
|
||||
153: 0 2891 0 0 0 0 0 0 GIC mct_tick1
|
||||
154: 0 0 3969 0 0 0 0 0 GIC mct_tick2
|
||||
155: 0 0 0 2385 0 0 0 0 GIC mct_tick3
|
||||
160: 0 0 0 0 8038 0 0 0 GIC mct_tick4
|
||||
161: 0 0 0 0 0 8474 0 0 GIC mct_tick5
|
||||
162: 0 0 0 0 0 0 7842 0 GIC mct_tick6
|
||||
163: 0 0 0 0 0 0 0 7827 GIC mct_tick7
|
||||
200: 0 0 0 0 0 0 0 0 GIC exynos5-jpeg-hx
|
||||
201: 0 0 0 0 0 0 0 0 GIC exynos-sysmmu.29
|
||||
218: 0 0 0 0 0 0 0 0 GIC exynos-sysmmu.25
|
||||
220: 0 0 0 0 0 0 0 0 GIC exynos-sysmmu.27
|
||||
224: 0 0 0 0 0 0 0 0 GIC exynos-sysmmu.19
|
||||
251: 320 0 0 0 0 0 0 0 GIC mali.0
|
||||
252: 0 0 0 0 0 0 0 0 GIC exynos5-scaler
|
||||
253: 0 0 0 0 0 0 0 0 GIC exynos5-scaler
|
||||
254: 0 0 0 0 0 0 0 0 GIC exynos5-scaler
|
||||
272: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.5
|
||||
274: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.6
|
||||
280: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.11
|
||||
282: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.30
|
||||
284: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.12
|
||||
286: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.17
|
||||
288: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.4
|
||||
290: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.20
|
||||
294: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
296: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
298: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
300: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
302: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.16
|
||||
306: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.0
|
||||
316: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.2
|
||||
325: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.0
|
||||
332: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.16
|
||||
340: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.16
|
||||
342: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
344: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.16
|
||||
405: 327 0 0 0 0 0 0 0 combiner s3c_fb
|
||||
409: 0 0 0 0 0 0 0 0 combiner mcuctl
|
||||
414: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.28
|
||||
434: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.22
|
||||
436: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.23
|
||||
438: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.26
|
||||
443: 12 0 0 0 0 0 0 0 combiner mct_comp_irq
|
||||
446: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.21
|
||||
449: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.13
|
||||
453: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.15
|
||||
474: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.24
|
||||
512: 0 0 0 0 0 0 0 0 exynos-eint gpio-keys: KEY_POWER
|
||||
518: 0 0 0 0 0 0 0 0 exynos-eint drd_switch_vbus
|
||||
524: 0 0 0 0 0 0 0 0 exynos-eint gpio-keys: KEY_HOMEPAGE
|
||||
526: 1 0 0 0 0 0 0 0 exynos-eint HOST_DETECT
|
||||
527: 1 0 0 0 0 0 0 0 exynos-eint drd_switch_id
|
||||
531: 1 0 0 0 0 0 0 0 exynos-eint drd_switch_vbus
|
||||
532: 1 0 0 0 0 0 0 0 exynos-eint drd_switch_id
|
||||
537: 3 0 0 0 0 0 0 0 exynos-eint mxt540e_ts
|
||||
538: 0 0 0 0 0 0 0 0 exynos-eint sec-pmic-irq
|
||||
543: 1 0 0 0 0 0 0 0 exynos-eint hdmi-ext
|
||||
544: 0 0 0 0 0 0 0 0 s5p_gpioint gpio-keys: KEY_VOLUMEDOWN
|
||||
545: 0 0 0 0 0 0 0 0 s5p_gpioint gpio-keys: KEY_VOLUMEUP
|
||||
546: 0 0 0 0 0 0 0 0 s5p_gpioint gpio-keys: KEY_MENU
|
||||
547: 0 0 0 0 0 0 0 0 s5p_gpioint gpio-keys: KEY_BACK
|
||||
655: 0 0 0 0 0 0 0 0 sec-pmic rtc-alarm0
|
||||
IPI0: 0 0 0 0 0 0 0 0 Timer broadcast interrupts
|
||||
IPI1: 8823 7185 4642 5652 2370 2069 1452 1351 Rescheduling interrupts
|
||||
IPI2: 4 7 8 6 8 7 8 8 Function call interrupts
|
||||
IPI3: 1 0 0 0 0 0 0 0 Single function call interrupts
|
||||
IPI4: 0 0 0 0 0 0 0 0 CPU stop interrupts
|
||||
IPI5: 0 0 0 0 0 0 0 0 CPU backtrace
|
||||
Err: 0
|
97
wlauto/tests/data/interrupts/before
Executable file
97
wlauto/tests/data/interrupts/before
Executable file
@@ -0,0 +1,97 @@
|
||||
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7
|
||||
65: 0 0 0 0 0 0 0 0 GIC dma-pl330.2
|
||||
66: 0 0 0 0 0 0 0 0 GIC dma-pl330.0
|
||||
67: 0 0 0 0 0 0 0 0 GIC dma-pl330.1
|
||||
74: 0 0 0 0 0 0 0 0 GIC s3c2410-wdt
|
||||
85: 2 0 0 0 0 0 0 0 GIC exynos4210-uart
|
||||
89: 368 0 0 0 0 0 0 0 GIC s3c2440-i2c.1
|
||||
90: 0 0 0 0 0 0 0 0 GIC s3c2440-i2c.2
|
||||
92: 1204 0 0 0 0 0 0 0 GIC exynos5-hs-i2c.0
|
||||
95: 831 0 0 0 0 0 0 0 GIC exynos5-hs-i2c.3
|
||||
103: 1 0 0 0 0 0 0 0 GIC ehci_hcd:usb1, ohci_hcd:usb2
|
||||
104: 7199 0 0 0 0 0 0 0 GIC xhci_hcd:usb3, exynos-ss-udc.0
|
||||
105: 0 0 0 0 0 0 0 0 GIC xhci_hcd:usb5
|
||||
106: 0 0 0 0 0 0 0 0 GIC mali.0
|
||||
107: 16429 0 0 0 0 0 0 0 GIC dw-mci
|
||||
108: 1 0 0 0 0 0 0 0 GIC dw-mci
|
||||
109: 0 0 0 0 0 0 0 0 GIC dw-mci
|
||||
114: 26209 0 0 0 0 0 0 0 GIC mipi-dsi
|
||||
117: 0 0 0 0 0 0 0 0 GIC exynos-gsc
|
||||
118: 0 0 0 0 0 0 0 0 GIC exynos-gsc
|
||||
121: 0 0 0 0 0 0 0 0 GIC exynos5-jpeg-hx
|
||||
123: 7 0 0 0 0 0 0 0 GIC s5p-fimg2d
|
||||
126: 0 0 0 0 0 0 0 0 GIC s5p-mixer
|
||||
127: 0 0 0 0 0 0 0 0 GIC hdmi-int
|
||||
128: 0 0 0 0 0 0 0 0 GIC s5p-mfc-v6
|
||||
142: 0 0 0 0 0 0 0 0 GIC dma-pl330.3
|
||||
146: 0 0 0 0 0 0 0 0 GIC s5p-tvout-cec
|
||||
149: 1004 0 0 0 0 0 0 0 GIC mali.0
|
||||
152: 26235 0 0 0 0 0 0 0 GIC mct_tick0
|
||||
153: 0 2579 0 0 0 0 0 0 GIC mct_tick1
|
||||
154: 0 0 3726 0 0 0 0 0 GIC mct_tick2
|
||||
155: 0 0 0 2262 0 0 0 0 GIC mct_tick3
|
||||
161: 0 0 0 0 0 2554 0 0 GIC mct_tick5
|
||||
162: 0 0 0 0 0 0 1911 0 GIC mct_tick6
|
||||
163: 0 0 0 0 0 0 0 1928 GIC mct_tick7
|
||||
200: 0 0 0 0 0 0 0 0 GIC exynos5-jpeg-hx
|
||||
201: 0 0 0 0 0 0 0 0 GIC exynos-sysmmu.29
|
||||
218: 0 0 0 0 0 0 0 0 GIC exynos-sysmmu.25
|
||||
220: 0 0 0 0 0 0 0 0 GIC exynos-sysmmu.27
|
||||
224: 0 0 0 0 0 0 0 0 GIC exynos-sysmmu.19
|
||||
251: 312 0 0 0 0 0 0 0 GIC mali.0
|
||||
252: 0 0 0 0 0 0 0 0 GIC exynos5-scaler
|
||||
253: 0 0 0 0 0 0 0 0 GIC exynos5-scaler
|
||||
254: 0 0 0 0 0 0 0 0 GIC exynos5-scaler
|
||||
272: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.5
|
||||
274: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.6
|
||||
280: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.11
|
||||
282: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.30
|
||||
284: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.12
|
||||
286: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.17
|
||||
288: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.4
|
||||
290: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.20
|
||||
294: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
296: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
298: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
300: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
302: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.16
|
||||
306: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.0
|
||||
316: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.2
|
||||
325: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.0
|
||||
332: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.16
|
||||
340: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.16
|
||||
342: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
344: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.16
|
||||
405: 322 0 0 0 0 0 0 0 combiner s3c_fb
|
||||
409: 0 0 0 0 0 0 0 0 combiner mcuctl
|
||||
414: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.28
|
||||
434: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.22
|
||||
436: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.23
|
||||
438: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.26
|
||||
443: 12 0 0 0 0 0 0 0 combiner mct_comp_irq
|
||||
446: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.21
|
||||
449: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.13
|
||||
453: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.15
|
||||
474: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.24
|
||||
512: 0 0 0 0 0 0 0 0 exynos-eint gpio-keys: KEY_POWER
|
||||
518: 0 0 0 0 0 0 0 0 exynos-eint drd_switch_vbus
|
||||
524: 0 0 0 0 0 0 0 0 exynos-eint gpio-keys: KEY_HOMEPAGE
|
||||
526: 1 0 0 0 0 0 0 0 exynos-eint HOST_DETECT
|
||||
527: 1 0 0 0 0 0 0 0 exynos-eint drd_switch_id
|
||||
531: 1 0 0 0 0 0 0 0 exynos-eint drd_switch_vbus
|
||||
532: 1 0 0 0 0 0 0 0 exynos-eint drd_switch_id
|
||||
537: 3 0 0 0 0 0 0 0 exynos-eint mxt540e_ts
|
||||
538: 0 0 0 0 0 0 0 0 exynos-eint sec-pmic-irq
|
||||
543: 1 0 0 0 0 0 0 0 exynos-eint hdmi-ext
|
||||
544: 0 0 0 0 0 0 0 0 s5p_gpioint gpio-keys: KEY_VOLUMEDOWN
|
||||
545: 0 0 0 0 0 0 0 0 s5p_gpioint gpio-keys: KEY_VOLUMEUP
|
||||
546: 0 0 0 0 0 0 0 0 s5p_gpioint gpio-keys: KEY_MENU
|
||||
547: 0 0 0 0 0 0 0 0 s5p_gpioint gpio-keys: KEY_BACK
|
||||
655: 0 0 0 0 0 0 0 0 sec-pmic rtc-alarm0
|
||||
IPI0: 0 0 0 0 0 0 0 0 Timer broadcast interrupts
|
||||
IPI1: 8751 7147 4615 5623 2334 2066 1449 1348 Rescheduling interrupts
|
||||
IPI2: 3 6 7 6 7 6 7 7 Function call interrupts
|
||||
IPI3: 1 0 0 0 0 0 0 0 Single function call interrupts
|
||||
IPI4: 0 0 0 0 0 0 0 0 CPU stop interrupts
|
||||
IPI5: 0 0 0 0 0 0 0 0 CPU backtrace
|
||||
Err: 0
|
98
wlauto/tests/data/interrupts/result
Executable file
98
wlauto/tests/data/interrupts/result
Executable file
@@ -0,0 +1,98 @@
|
||||
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7
|
||||
65: 0 0 0 0 0 0 0 0 GIC dma-pl330.2
|
||||
66: 0 0 0 0 0 0 0 0 GIC dma-pl330.0
|
||||
67: 0 0 0 0 0 0 0 0 GIC dma-pl330.1
|
||||
74: 0 0 0 0 0 0 0 0 GIC s3c2410-wdt
|
||||
85: 0 0 0 0 0 0 0 0 GIC exynos4210-uart
|
||||
89: 0 0 0 0 0 0 0 0 GIC s3c2440-i2c.1
|
||||
90: 0 0 0 0 0 0 0 0 GIC s3c2440-i2c.2
|
||||
92: 90 0 0 0 0 0 0 0 GIC exynos5-hs-i2c.0
|
||||
95: 0 0 0 0 0 0 0 0 GIC exynos5-hs-i2c.3
|
||||
103: 0 0 0 0 0 0 0 0 GIC ehci_hcd:usb1, ohci_hcd:usb2
|
||||
104: 105 0 0 0 0 0 0 0 GIC xhci_hcd:usb3, exynos-ss-udc.0
|
||||
105: 0 0 0 0 0 0 0 0 GIC xhci_hcd:usb5
|
||||
106: 0 0 0 0 0 0 0 0 GIC mali.0
|
||||
107: 0 0 0 0 0 0 0 0 GIC dw-mci
|
||||
108: 0 0 0 0 0 0 0 0 GIC dw-mci
|
||||
109: 0 0 0 0 0 0 0 0 GIC dw-mci
|
||||
114: 1865 0 0 0 0 0 0 0 GIC mipi-dsi
|
||||
117: 0 0 0 0 0 0 0 0 GIC exynos-gsc
|
||||
118: 0 0 0 0 0 0 0 0 GIC exynos-gsc
|
||||
121: 0 0 0 0 0 0 0 0 GIC exynos5-jpeg-hx
|
||||
123: 0 0 0 0 0 0 0 0 GIC s5p-fimg2d
|
||||
126: 0 0 0 0 0 0 0 0 GIC s5p-mixer
|
||||
127: 0 0 0 0 0 0 0 0 GIC hdmi-int
|
||||
128: 0 0 0 0 0 0 0 0 GIC s5p-mfc-v6
|
||||
142: 0 0 0 0 0 0 0 0 GIC dma-pl330.3
|
||||
146: 0 0 0 0 0 0 0 0 GIC s5p-tvout-cec
|
||||
149: 31 0 0 0 0 0 0 0 GIC mali.0
|
||||
152: 204 0 0 0 0 0 0 0 GIC mct_tick0
|
||||
153: 0 312 0 0 0 0 0 0 GIC mct_tick1
|
||||
154: 0 0 243 0 0 0 0 0 GIC mct_tick2
|
||||
155: 0 0 0 123 0 0 0 0 GIC mct_tick3
|
||||
> 160: 0 0 0 0 8038 0 0 0 GIC mct_tick4
|
||||
161: 0 0 0 0 0 5920 0 0 GIC mct_tick5
|
||||
162: 0 0 0 0 0 0 5931 0 GIC mct_tick6
|
||||
163: 0 0 0 0 0 0 0 5899 GIC mct_tick7
|
||||
200: 0 0 0 0 0 0 0 0 GIC exynos5-jpeg-hx
|
||||
201: 0 0 0 0 0 0 0 0 GIC exynos-sysmmu.29
|
||||
218: 0 0 0 0 0 0 0 0 GIC exynos-sysmmu.25
|
||||
220: 0 0 0 0 0 0 0 0 GIC exynos-sysmmu.27
|
||||
224: 0 0 0 0 0 0 0 0 GIC exynos-sysmmu.19
|
||||
251: 8 0 0 0 0 0 0 0 GIC mali.0
|
||||
252: 0 0 0 0 0 0 0 0 GIC exynos5-scaler
|
||||
253: 0 0 0 0 0 0 0 0 GIC exynos5-scaler
|
||||
254: 0 0 0 0 0 0 0 0 GIC exynos5-scaler
|
||||
272: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.5
|
||||
274: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.6
|
||||
280: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.11
|
||||
282: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.30
|
||||
284: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.12
|
||||
286: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.17
|
||||
288: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.4
|
||||
290: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.20
|
||||
294: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
296: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
298: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
300: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
302: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.16
|
||||
306: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.0
|
||||
316: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.2
|
||||
325: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.0
|
||||
332: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.16
|
||||
340: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.16
|
||||
342: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.9
|
||||
344: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.16
|
||||
405: 5 0 0 0 0 0 0 0 combiner s3c_fb
|
||||
409: 0 0 0 0 0 0 0 0 combiner mcuctl
|
||||
414: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.28
|
||||
434: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.22
|
||||
436: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.23
|
||||
438: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.26
|
||||
443: 0 0 0 0 0 0 0 0 combiner mct_comp_irq
|
||||
446: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.21
|
||||
449: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.13
|
||||
453: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.15
|
||||
474: 0 0 0 0 0 0 0 0 combiner exynos-sysmmu.24
|
||||
512: 0 0 0 0 0 0 0 0 exynos-eint gpio-keys: KEY_POWER
|
||||
518: 0 0 0 0 0 0 0 0 exynos-eint drd_switch_vbus
|
||||
524: 0 0 0 0 0 0 0 0 exynos-eint gpio-keys: KEY_HOMEPAGE
|
||||
526: 0 0 0 0 0 0 0 0 exynos-eint HOST_DETECT
|
||||
527: 0 0 0 0 0 0 0 0 exynos-eint drd_switch_id
|
||||
531: 0 0 0 0 0 0 0 0 exynos-eint drd_switch_vbus
|
||||
532: 0 0 0 0 0 0 0 0 exynos-eint drd_switch_id
|
||||
537: 0 0 0 0 0 0 0 0 exynos-eint mxt540e_ts
|
||||
538: 0 0 0 0 0 0 0 0 exynos-eint sec-pmic-irq
|
||||
543: 0 0 0 0 0 0 0 0 exynos-eint hdmi-ext
|
||||
544: 0 0 0 0 0 0 0 0 s5p_gpioint gpio-keys: KEY_VOLUMEDOWN
|
||||
545: 0 0 0 0 0 0 0 0 s5p_gpioint gpio-keys: KEY_VOLUMEUP
|
||||
546: 0 0 0 0 0 0 0 0 s5p_gpioint gpio-keys: KEY_MENU
|
||||
547: 0 0 0 0 0 0 0 0 s5p_gpioint gpio-keys: KEY_BACK
|
||||
655: 0 0 0 0 0 0 0 0 sec-pmic rtc-alarm0
|
||||
IPI0: 0 0 0 0 0 0 0 0 Timer broadcast interrupts
|
||||
IPI1: 72 38 27 29 36 3 3 3 Rescheduling interrupts
|
||||
IPI2: 1 1 1 0 1 1 1 1 Function call interrupts
|
||||
IPI3: 0 0 0 0 0 0 0 0 Single function call interrupts
|
||||
IPI4: 0 0 0 0 0 0 0 0 CPU stop interrupts
|
||||
IPI5: 0 0 0 0 0 0 0 0 CPU backtrace
|
||||
Err: 0
|
14
wlauto/tests/data/logcat.2.log
Normal file
14
wlauto/tests/data/logcat.2.log
Normal file
@@ -0,0 +1,14 @@
|
||||
--------- beginning of /dev/log/main
|
||||
D/TextView( 2468): 7:07
|
||||
D/TextView( 2468): 7:07
|
||||
D/TextView( 2468): Thu, June 27
|
||||
--------- beginning of /dev/log/system
|
||||
D/TextView( 3099): CaffeineMark results
|
||||
D/TextView( 3099): Overall score:
|
||||
D/TextView( 3099): Rating
|
||||
D/TextView( 3099): Rank
|
||||
D/TextView( 3099): 0
|
||||
D/TextView( 3099): Details
|
||||
D/TextView( 3099): Publish
|
||||
D/TextView( 3099): Top 10
|
||||
D/TextView( 3099): 3672
|
10
wlauto/tests/data/logcat.log
Normal file
10
wlauto/tests/data/logcat.log
Normal file
@@ -0,0 +1,10 @@
|
||||
--------- beginning of /dev/log/main
|
||||
--------- beginning of /dev/log/system
|
||||
D/TextView( 2462): 5:05
|
||||
D/TextView( 2462): 5:05
|
||||
D/TextView( 2462): Mon, June 24
|
||||
D/TextView( 3072): Stop Test
|
||||
D/TextView( 3072): Testing CPU and memory…
|
||||
D/TextView( 3072): 0%
|
||||
D/TextView( 3072): Testing CPU and memory…
|
||||
|
25
wlauto/tests/data/test-agenda.yaml
Normal file
25
wlauto/tests/data/test-agenda.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
global:
|
||||
iterations: 8
|
||||
boot_parameters:
|
||||
os_mode: mp_a15_bootcluster
|
||||
runtime_parameters:
|
||||
a7_governor: Interactive
|
||||
a15_governor: Interactive2
|
||||
a7_cores: 3
|
||||
a15_cores: 2
|
||||
workloads:
|
||||
- id: 1c
|
||||
workload_name: bbench_with_audio
|
||||
- id: 1d
|
||||
workload_name: Bbench_with_audio
|
||||
runtime_parameters:
|
||||
os_mode: mp_a7_only
|
||||
a7_cores: 0
|
||||
iterations: 4
|
||||
- id: 1e
|
||||
workload_name: audio
|
||||
- id: 1f
|
||||
workload_name: antutu
|
||||
runtime_parameters:
|
||||
a7_cores: 1
|
||||
a15_cores: 1
|
17
wlauto/tests/data/test-config.py
Normal file
17
wlauto/tests/data/test-config.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Copyright 2013-2015 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
device = 'TEST'
|
195
wlauto/tests/test_agenda.py
Normal file
195
wlauto/tests/test_agenda.py
Normal file
@@ -0,0 +1,195 @@
|
||||
# Copyright 2013-2015 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
# pylint: disable=E0611
|
||||
# pylint: disable=R0201
|
||||
import os
|
||||
from StringIO import StringIO
|
||||
from unittest import TestCase
|
||||
|
||||
from nose.tools import assert_equal, assert_in, raises
|
||||
|
||||
from wlauto.core.agenda import Agenda
|
||||
from wlauto.exceptions import ConfigError
|
||||
|
||||
|
||||
YAML_TEST_FILE = os.path.join(os.path.dirname(__file__), 'data', 'test-agenda.yaml')
|
||||
|
||||
invalid_agenda_text = """
|
||||
workloads:
|
||||
- id: 1
|
||||
workload_parameters:
|
||||
test: 1
|
||||
"""
|
||||
invalid_agenda = StringIO(invalid_agenda_text)
|
||||
invalid_agenda.name = 'invalid1'
|
||||
|
||||
duplicate_agenda_text = """
|
||||
global:
|
||||
iterations: 1
|
||||
workloads:
|
||||
- id: 1
|
||||
workload_name: antutu
|
||||
workload_parameters:
|
||||
test: 1
|
||||
- id: 1
|
||||
workload_name: andebench
|
||||
"""
|
||||
duplicate_agenda = StringIO(duplicate_agenda_text)
|
||||
duplicate_agenda.name = 'invalid2'
|
||||
|
||||
short_agenda_text = """
|
||||
workloads: [antutu, linpack, andebench]
|
||||
"""
|
||||
short_agenda = StringIO(short_agenda_text)
|
||||
short_agenda.name = 'short'
|
||||
|
||||
default_ids_agenda_text = """
|
||||
workloads:
|
||||
- antutu
|
||||
- id: 1
|
||||
name: linpack
|
||||
- id: test
|
||||
name: andebench
|
||||
params:
|
||||
number_of_threads: 1
|
||||
- vellamo
|
||||
"""
|
||||
default_ids_agenda = StringIO(default_ids_agenda_text)
|
||||
default_ids_agenda.name = 'default_ids'
|
||||
|
||||
sectioned_agenda_text = """
|
||||
sections:
|
||||
- id: sec1
|
||||
runtime_params:
|
||||
dp: one
|
||||
workloads:
|
||||
- antutu
|
||||
- andebench
|
||||
- name: linpack
|
||||
runtime_params:
|
||||
dp: two
|
||||
- id: sec2
|
||||
runtime_params:
|
||||
dp: three
|
||||
workloads:
|
||||
- antutu
|
||||
workloads:
|
||||
- nenamark
|
||||
"""
|
||||
sectioned_agenda = StringIO(sectioned_agenda_text)
|
||||
sectioned_agenda.name = 'sectioned'
|
||||
|
||||
dup_sectioned_agenda_text = """
|
||||
sections:
|
||||
- id: sec1
|
||||
workloads:
|
||||
- antutu
|
||||
- id: sec1
|
||||
workloads:
|
||||
- andebench
|
||||
workloads:
|
||||
- nenamark
|
||||
"""
|
||||
dup_sectioned_agenda = StringIO(dup_sectioned_agenda_text)
|
||||
dup_sectioned_agenda.name = 'dup-sectioned'
|
||||
|
||||
caps_agenda_text = """
|
||||
config:
|
||||
device: TC2
|
||||
global:
|
||||
runtime_parameters:
|
||||
sysfile_values:
|
||||
/sys/test/MyFile: 1
|
||||
/sys/test/other file: 2
|
||||
workloads:
|
||||
- id: 1
|
||||
name: linpack
|
||||
"""
|
||||
caps_agenda = StringIO(caps_agenda_text)
|
||||
caps_agenda.name = 'caps'
|
||||
|
||||
bad_syntax_agenda_text = """
|
||||
config:
|
||||
# tab on the following line
|
||||
reboot_policy: never
|
||||
workloads:
|
||||
- antutu
|
||||
"""
|
||||
bad_syntax_agenda = StringIO(bad_syntax_agenda_text)
|
||||
bad_syntax_agenda.name = 'bad_syntax'
|
||||
|
||||
section_ids_test_text = """
|
||||
config:
|
||||
device: TC2
|
||||
reboot_policy: never
|
||||
workloads:
|
||||
- name: bbench
|
||||
id: bbench
|
||||
- name: audio
|
||||
sections:
|
||||
- id: foo
|
||||
- id: bar
|
||||
"""
|
||||
section_ids_agenda = StringIO(section_ids_test_text)
|
||||
section_ids_agenda.name = 'section_ids'
|
||||
|
||||
|
||||
class AgendaTest(TestCase):
|
||||
|
||||
def test_yaml_load(self):
|
||||
agenda = Agenda(YAML_TEST_FILE)
|
||||
assert_equal(len(agenda.workloads), 4)
|
||||
|
||||
def test_duplicate_id(self):
|
||||
try:
|
||||
Agenda(duplicate_agenda)
|
||||
except ConfigError, e:
|
||||
assert_in('duplicate', e.message.lower()) # pylint: disable=E1101
|
||||
else:
|
||||
raise Exception('ConfigError was not raised for an agenda with duplicate ids.')
|
||||
|
||||
def test_yaml_missing_field(self):
|
||||
try:
|
||||
Agenda(invalid_agenda_text)
|
||||
except ConfigError, e:
|
||||
assert_in('workload name', e.message)
|
||||
else:
|
||||
raise Exception('ConfigError was not raised for an invalid agenda.')
|
||||
|
||||
def test_defaults(self):
|
||||
agenda = Agenda(short_agenda)
|
||||
assert_equal(len(agenda.workloads), 3)
|
||||
assert_equal(agenda.workloads[0].workload_name, 'antutu')
|
||||
assert_equal(agenda.workloads[0].id, '1')
|
||||
|
||||
def test_default_id_assignment(self):
|
||||
agenda = Agenda(default_ids_agenda)
|
||||
assert_equal(agenda.workloads[0].id, '2')
|
||||
assert_equal(agenda.workloads[3].id, '3')
|
||||
|
||||
def test_sections(self):
|
||||
agenda = Agenda(sectioned_agenda)
|
||||
assert_equal(agenda.sections[0].workloads[0].workload_name, 'antutu')
|
||||
assert_equal(agenda.sections[1].runtime_parameters['dp'], 'three')
|
||||
|
||||
@raises(ConfigError)
|
||||
def test_dup_sections(self):
|
||||
Agenda(dup_sectioned_agenda)
|
||||
|
||||
@raises(ConfigError)
|
||||
def test_bad_syntax(self):
|
||||
Agenda(bad_syntax_agenda)
|
151
wlauto/tests/test_config.py
Normal file
151
wlauto/tests/test_config.py
Normal file
@@ -0,0 +1,151 @@
|
||||
# Copyright 2013-2015 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
# pylint: disable=E0611,R0201
|
||||
import os
|
||||
import tempfile
|
||||
from unittest import TestCase
|
||||
|
||||
from nose.tools import assert_equal, assert_in, raises
|
||||
|
||||
from wlauto.core.bootstrap import ConfigLoader
|
||||
from wlauto.core.agenda import AgendaWorkloadEntry, AgendaGlobalEntry
|
||||
from wlauto.core.configuration import RunConfiguration
|
||||
from wlauto.exceptions import ConfigError
|
||||
|
||||
|
||||
DATA_DIR = os.path.join(os.path.dirname(__file__), 'data')
|
||||
|
||||
BAD_CONFIG_TEXT = """device = 'TEST
|
||||
device_config = 'TEST-CONFIG'"""
|
||||
|
||||
|
||||
class MockExtensionLoader(object):
|
||||
|
||||
def __init__(self):
|
||||
self.aliases = {}
|
||||
self.global_param_aliases = {}
|
||||
self.extensions = {}
|
||||
|
||||
def get_extension_class(self, name, kind=None): # pylint: disable=unused-argument
|
||||
if name == 'defaults_workload':
|
||||
return DefaultsWorkload()
|
||||
else:
|
||||
return NamedMock(name)
|
||||
|
||||
def resolve_alias(self, name):
|
||||
return name, {}
|
||||
|
||||
def get_default_config(self, name): # pylint: disable=unused-argument
|
||||
return {}
|
||||
|
||||
def has_extension(self, name):
|
||||
return name in self.aliases or name in self.extensions
|
||||
|
||||
|
||||
class MockAgenda(object):
|
||||
|
||||
def __init__(self, *args):
|
||||
self.config = {}
|
||||
self.global_ = AgendaGlobalEntry()
|
||||
self.sections = []
|
||||
self.workloads = args
|
||||
|
||||
|
||||
class NamedMock(object):
|
||||
|
||||
def __init__(self, name):
|
||||
self.__attrs = {
|
||||
'global_alias': None
|
||||
}
|
||||
self.name = name
|
||||
self.parameters = []
|
||||
|
||||
def __getattr__(self, name):
|
||||
if not name in self.__attrs:
|
||||
self.__attrs[name] = NamedMock(name)
|
||||
return self.__attrs[name]
|
||||
|
||||
|
||||
class DefaultsWorkload(object):
|
||||
|
||||
def __init__(self):
|
||||
self.name = 'defaults_workload'
|
||||
self.parameters = [NamedMock('param')]
|
||||
self.parameters[0].default = [1, 2]
|
||||
|
||||
|
||||
class ConfigLoaderTest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.filepath = tempfile.mktemp()
|
||||
with open(self.filepath, 'w') as wfh:
|
||||
wfh.write(BAD_CONFIG_TEXT)
|
||||
|
||||
def test_load(self):
|
||||
test_cfg_file = os.path.join(DATA_DIR, 'test-config.py')
|
||||
config = ConfigLoader()
|
||||
config.update(test_cfg_file)
|
||||
assert_equal(config.device, 'TEST')
|
||||
|
||||
@raises(ConfigError)
|
||||
def test_load_bad(self):
|
||||
config_loader = ConfigLoader()
|
||||
config_loader.update(self.filepath)
|
||||
|
||||
def test_load_duplicate(self):
|
||||
config_loader = ConfigLoader()
|
||||
config_loader.update(dict(instrumentation=['test']))
|
||||
config_loader.update(dict(instrumentation=['test']))
|
||||
assert_equal(config_loader.instrumentation, ['test'])
|
||||
|
||||
def tearDown(self):
|
||||
os.unlink(self.filepath)
|
||||
|
||||
|
||||
class ConfigTest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.config = RunConfiguration(MockExtensionLoader())
|
||||
self.config.load_config({'device': 'MockDevice'})
|
||||
|
||||
def test_case(self):
|
||||
devparams = {
|
||||
'sysfile_values': {
|
||||
'/sys/test/MyFile': 1,
|
||||
'/sys/test/other file': 2,
|
||||
}
|
||||
}
|
||||
ws = AgendaWorkloadEntry(id='a', iterations=1, name='linpack', runtime_parameters=devparams)
|
||||
self.config.set_agenda(MockAgenda(ws))
|
||||
spec = self.config.workload_specs[0]
|
||||
assert_in('/sys/test/MyFile', spec.runtime_parameters['sysfile_values'])
|
||||
assert_in('/sys/test/other file', spec.runtime_parameters['sysfile_values'])
|
||||
|
||||
def test_list_defaults_params(self):
|
||||
ws = AgendaWorkloadEntry(id='a', iterations=1,
|
||||
name='defaults_workload', workload_parameters={'param':[3]})
|
||||
self.config.set_agenda(MockAgenda(ws))
|
||||
spec = self.config.workload_specs[0]
|
||||
assert_equal(spec.workload_parameters, {'param': [3]})
|
||||
|
||||
def test_global_instrumentation(self):
|
||||
self.config.load_config({'instrumentation': ['global_instrument']})
|
||||
ws = AgendaWorkloadEntry(id='a', iterations=1, name='linpack', instrumentation=['local_instrument'])
|
||||
self.config.set_agenda(MockAgenda(ws))
|
||||
self.config.finalize()
|
||||
assert_equal(self.config.workload_specs[0].instrumentation,
|
||||
['local_instrument', 'global_instrument'])
|
99
wlauto/tests/test_device.py
Normal file
99
wlauto/tests/test_device.py
Normal file
@@ -0,0 +1,99 @@
|
||||
# Copyright 2013-2015 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
# pylint: disable=abstract-method,no-self-use,no-name-in-module
|
||||
from collections import defaultdict, OrderedDict
|
||||
from unittest import TestCase
|
||||
|
||||
from nose.tools import raises, assert_equal
|
||||
|
||||
from wlauto import Device, Parameter, RuntimeParameter, CoreParameter
|
||||
from wlauto.exceptions import ConfigError
|
||||
|
||||
|
||||
class TestDevice(Device):
|
||||
|
||||
name = 'test-device'
|
||||
path_module = 'posixpath'
|
||||
|
||||
parameters = [
|
||||
Parameter('core_names', default=['a7', 'a7', 'a15'], override=True),
|
||||
Parameter('core_clusters', default=[0, 0, 1], override=True),
|
||||
]
|
||||
|
||||
runtime_parameters = [
|
||||
RuntimeParameter('test_param', 'getter', 'setter'),
|
||||
RuntimeParameter('test_param2', 'getter', 'setter'),
|
||||
CoreParameter('${core}_param', 'core_getter', 'core_setter'),
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(TestDevice, self).__init__(*args, **kwargs)
|
||||
self.value = None
|
||||
self.core_values = defaultdict()
|
||||
|
||||
def getter(self):
|
||||
return self.value
|
||||
|
||||
def setter(self, value):
|
||||
if self.value is None:
|
||||
self.value = value
|
||||
|
||||
def core_getter(self, core):
|
||||
return self.core_values.get(core)
|
||||
|
||||
def core_setter(self, core, value):
|
||||
self.core_values[core] = value
|
||||
|
||||
|
||||
class RuntimeParametersTest(TestCase):
|
||||
|
||||
def test_runtime_param(self):
|
||||
device = _instantiate(TestDevice)
|
||||
device.set_runtime_parameters(dict(test_param=5))
|
||||
assert_equal(device.value, 5)
|
||||
assert_equal(device.get_runtime_parameters().get('test_param'), 5)
|
||||
|
||||
def test_core_param(self):
|
||||
device = _instantiate(TestDevice)
|
||||
device.set_runtime_parameters(dict(a15_param=1, a7_param=2))
|
||||
assert_equal(device.core_values, {'a15': 1, 'a7': 2})
|
||||
assert_equal(device.get_runtime_parameters().get('a15_param'), 1)
|
||||
assert_equal(device.get_runtime_parameters().get('a7_param'), 2)
|
||||
|
||||
@raises(ConfigError)
|
||||
def test_bad_runtime_param(self):
|
||||
device = _instantiate(TestDevice)
|
||||
device.set_runtime_parameters(dict(bad_param=1))
|
||||
|
||||
def test_get_unset_runtime_params(self):
|
||||
device = _instantiate(TestDevice)
|
||||
expected = {'test_param': None, 'test_param2': None, 'a15_param': None, 'a7_param': None}
|
||||
assert_equal(device.get_runtime_parameters(), expected)
|
||||
|
||||
def test_param_set_order(self):
|
||||
device = _instantiate(TestDevice)
|
||||
device.set_runtime_parameters(OrderedDict([('test_param2', 1), ('test_param', 5)]))
|
||||
assert_equal(device.value, 1)
|
||||
device.value = None
|
||||
device.set_runtime_parameters(OrderedDict([('test_param', 5), ('test_param2', 1)]))
|
||||
assert_equal(device.value, 5)
|
||||
|
||||
|
||||
def _instantiate(cls, *args, **kwargs):
|
||||
# Needed to get around Extension's __init__ checks
|
||||
return cls(*args, **kwargs)
|
||||
|
44
wlauto/tests/test_diff.py
Normal file
44
wlauto/tests/test_diff.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# Copyright 2013-2015 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
# pylint: disable=E0611
|
||||
# pylint: disable=R0201
|
||||
import os
|
||||
import tempfile
|
||||
from unittest import TestCase
|
||||
|
||||
from nose.tools import assert_equal
|
||||
|
||||
from wlauto.instrumentation.misc import _diff_interrupt_files
|
||||
|
||||
|
||||
class InterruptDiffTest(TestCase):
|
||||
|
||||
def test_interrupt_diff(self):
|
||||
file_dir = os.path.join(os.path.dirname(__file__), 'data', 'interrupts')
|
||||
before_file = os.path.join(file_dir, 'before')
|
||||
after_file = os.path.join(file_dir, 'after')
|
||||
expected_result_file = os.path.join(file_dir, 'result')
|
||||
output_file = tempfile.mktemp()
|
||||
|
||||
_diff_interrupt_files(before_file, after_file, output_file)
|
||||
with open(output_file) as fh:
|
||||
output_diff = fh.read()
|
||||
with open(expected_result_file) as fh:
|
||||
expected_diff = fh.read()
|
||||
assert_equal(output_diff, expected_diff)
|
||||
|
||||
|
1035
wlauto/tests/test_execution.py
Normal file
1035
wlauto/tests/test_execution.py
Normal file
File diff suppressed because it is too large
Load Diff
286
wlauto/tests/test_extension.py
Normal file
286
wlauto/tests/test_extension.py
Normal file
@@ -0,0 +1,286 @@
|
||||
# Copyright 2014-2015 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
# pylint: disable=E0611,R0201,E1101
|
||||
from unittest import TestCase
|
||||
|
||||
from nose.tools import assert_equal, raises, assert_true
|
||||
|
||||
from wlauto.core.extension import Extension, Parameter, Param, ExtensionMeta, Module
|
||||
from wlauto.utils.types import list_of_ints
|
||||
from wlauto.exceptions import ConfigError
|
||||
|
||||
|
||||
class MyMeta(ExtensionMeta):
|
||||
|
||||
virtual_methods = ['validate', 'virtual1', 'virtual2']
|
||||
|
||||
|
||||
class MyBaseExtension(Extension):
|
||||
|
||||
__metaclass__ = MyMeta
|
||||
|
||||
name = 'base'
|
||||
|
||||
parameters = [
|
||||
Parameter('base'),
|
||||
]
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(MyBaseExtension, self).__init__(**kwargs)
|
||||
self.v1 = 0
|
||||
self.v2 = 0
|
||||
self.v3 = ''
|
||||
|
||||
def virtual1(self):
|
||||
self.v1 += 1
|
||||
self.v3 = 'base'
|
||||
|
||||
def virtual2(self):
|
||||
self.v2 += 1
|
||||
|
||||
|
||||
class MyAcidExtension(MyBaseExtension):
|
||||
|
||||
name = 'acid'
|
||||
|
||||
parameters = [
|
||||
Parameter('hydrochloric', kind=list_of_ints, default=[1, 2]),
|
||||
'citric',
|
||||
('carbonic', int),
|
||||
]
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(MyAcidExtension, self).__init__(**kwargs)
|
||||
self.vv1 = 0
|
||||
self.vv2 = 0
|
||||
|
||||
def virtual1(self):
|
||||
self.vv1 += 1
|
||||
self.v3 = 'acid'
|
||||
|
||||
def virtual2(self):
|
||||
self.vv2 += 1
|
||||
|
||||
|
||||
class MyOtherExtension(MyBaseExtension):
|
||||
|
||||
name = 'other'
|
||||
|
||||
parameters = [
|
||||
Param('mandatory', mandatory=True),
|
||||
Param('optional', allowed_values=['test', 'check']),
|
||||
]
|
||||
|
||||
class MyOtherOtherExtension(MyOtherExtension):
|
||||
|
||||
name = 'otherother'
|
||||
|
||||
parameters = [
|
||||
Param('mandatory', override=True),
|
||||
]
|
||||
|
||||
|
||||
class MyOverridingExtension(MyAcidExtension):
|
||||
|
||||
name = 'overriding'
|
||||
|
||||
parameters = [
|
||||
Parameter('hydrochloric', override=True, default=[3, 4]),
|
||||
]
|
||||
|
||||
|
||||
class MyThirdTeerExtension(MyOverridingExtension):
|
||||
|
||||
name = 'thirdteer'
|
||||
|
||||
|
||||
class MultiValueParamExt(Extension):
|
||||
|
||||
name = 'multivalue'
|
||||
|
||||
parameters = [
|
||||
Parameter('test', kind=list_of_ints, allowed_values=[42, 7, 73]),
|
||||
]
|
||||
|
||||
|
||||
class MyCoolModule(Module):
|
||||
|
||||
name = 'cool_module'
|
||||
|
||||
capabilities = ['fizzle']
|
||||
|
||||
def initialize(self):
|
||||
self.fizzle_factor = 0 # pylint: disable=attribute-defined-outside-init
|
||||
|
||||
def fizzle(self):
|
||||
self.fizzle_factor += 1
|
||||
|
||||
|
||||
class MyEvenCoolerModule(Module):
|
||||
|
||||
name = 'even_cooler_module'
|
||||
|
||||
capabilities = ['fizzle']
|
||||
|
||||
def fizzle(self):
|
||||
self.owner.self_fizzle_factor += 2
|
||||
|
||||
|
||||
class MyModularExtension(Extension):
|
||||
|
||||
name = 'modular'
|
||||
|
||||
parameters = [
|
||||
Parameter('modules', override=True, default=['cool_module']),
|
||||
]
|
||||
|
||||
|
||||
class MyOtherModularExtension(Extension):
|
||||
|
||||
name = 'other_modular'
|
||||
|
||||
parameters = [
|
||||
Parameter('modules', override=True, default=[
|
||||
'cool_module',
|
||||
'even_cooler_module',
|
||||
]),
|
||||
]
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(MyOtherModularExtension, self).__init__(**kwargs)
|
||||
self.self_fizzle_factor = 0
|
||||
|
||||
|
||||
class FakeLoader(object):
|
||||
|
||||
modules = [
|
||||
MyCoolModule,
|
||||
MyEvenCoolerModule,
|
||||
]
|
||||
|
||||
def get_module(self, name, owner, **kwargs): # pylint: disable=unused-argument
|
||||
for module in self.modules:
|
||||
if module.name == name:
|
||||
return _instantiate(module, owner)
|
||||
|
||||
|
||||
class ExtensionMetaTest(TestCase):
|
||||
|
||||
def test_propagation(self):
|
||||
acid_params = [p.name for p in MyAcidExtension.parameters]
|
||||
assert_equal(acid_params, ['modules', 'base', 'hydrochloric', 'citric', 'carbonic'])
|
||||
|
||||
@raises(ValueError)
|
||||
def test_duplicate_param_spec(self):
|
||||
class BadExtension(MyBaseExtension): # pylint: disable=W0612
|
||||
parameters = [
|
||||
Parameter('base'),
|
||||
]
|
||||
|
||||
def test_param_override(self):
|
||||
class OverridingExtension(MyBaseExtension): # pylint: disable=W0612
|
||||
parameters = [
|
||||
Parameter('base', override=True, default='cheese'),
|
||||
]
|
||||
assert_equal(OverridingExtension.parameters['base'].default, 'cheese')
|
||||
|
||||
@raises(ValueError)
|
||||
def test_invalid_param_spec(self):
|
||||
class BadExtension(MyBaseExtension): # pylint: disable=W0612
|
||||
parameters = [
|
||||
7,
|
||||
]
|
||||
|
||||
def test_virtual_methods(self):
|
||||
acid = _instantiate(MyAcidExtension)
|
||||
acid.virtual1()
|
||||
assert_equal(acid.v1, 1)
|
||||
assert_equal(acid.vv1, 1)
|
||||
assert_equal(acid.v2, 0)
|
||||
assert_equal(acid.vv2, 0)
|
||||
assert_equal(acid.v3, 'acid')
|
||||
acid.virtual2()
|
||||
acid.virtual2()
|
||||
assert_equal(acid.v1, 1)
|
||||
assert_equal(acid.vv1, 1)
|
||||
assert_equal(acid.v2, 2)
|
||||
assert_equal(acid.vv2, 2)
|
||||
|
||||
|
||||
class ParametersTest(TestCase):
|
||||
|
||||
def test_setting(self):
|
||||
myext = _instantiate(MyAcidExtension, hydrochloric=[5, 6], citric=5, carbonic=42)
|
||||
assert_equal(myext.hydrochloric, [5, 6])
|
||||
assert_equal(myext.citric, '5')
|
||||
assert_equal(myext.carbonic, 42)
|
||||
|
||||
def test_validation_ok(self):
|
||||
myext = _instantiate(MyOtherExtension, mandatory='check', optional='check')
|
||||
myext.validate()
|
||||
|
||||
def test_default_override(self):
|
||||
myext = _instantiate(MyOverridingExtension)
|
||||
assert_equal(myext.hydrochloric, [3, 4])
|
||||
myotherext = _instantiate(MyThirdTeerExtension)
|
||||
assert_equal(myotherext.hydrochloric, [3, 4])
|
||||
|
||||
def test_multivalue_param(self):
|
||||
myext = _instantiate(MultiValueParamExt, test=[7, 42])
|
||||
myext.validate()
|
||||
assert_equal(myext.test, [7, 42])
|
||||
|
||||
@raises(ConfigError)
|
||||
def test_bad_multivalue_param(self):
|
||||
myext = _instantiate(MultiValueParamExt, test=[5])
|
||||
myext.validate()
|
||||
|
||||
@raises(ConfigError)
|
||||
def test_validation_no_mandatory(self):
|
||||
myext = _instantiate(MyOtherExtension, optional='check')
|
||||
myext.validate()
|
||||
|
||||
@raises(ConfigError)
|
||||
def test_validation_no_mandatory_in_derived(self):
|
||||
_instantiate(MyOtherOtherExtension)
|
||||
|
||||
@raises(ConfigError)
|
||||
def test_validation_bad_value(self):
|
||||
myext = _instantiate(MyOtherExtension, mandatory=1, optional='invalid')
|
||||
myext.validate()
|
||||
|
||||
|
||||
class ModuleTest(TestCase):
|
||||
|
||||
def test_fizzle(self):
|
||||
myext = _instantiate(MyModularExtension)
|
||||
myext.load_modules(FakeLoader())
|
||||
assert_true(myext.can('fizzle'))
|
||||
myext.fizzle()
|
||||
assert_equal(myext.fizzle_factor, 1)
|
||||
|
||||
def test_self_fizzle(self):
|
||||
myext = _instantiate(MyOtherModularExtension)
|
||||
myext.load_modules(FakeLoader())
|
||||
myext.fizzle()
|
||||
assert_equal(myext.self_fizzle_factor, 2)
|
||||
|
||||
|
||||
def _instantiate(cls, *args, **kwargs):
|
||||
# Needed to get around Extension's __init__ checks
|
||||
return cls(*args, **kwargs)
|
||||
|
51
wlauto/tests/test_extension_loader.py
Normal file
51
wlauto/tests/test_extension_loader.py
Normal file
@@ -0,0 +1,51 @@
|
||||
# Copyright 2013-2015 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
# pylint: disable=E0611,R0201
|
||||
import os
|
||||
from unittest import TestCase
|
||||
|
||||
from nose.tools import assert_equal, assert_greater
|
||||
|
||||
from wlauto.core.extension_loader import ExtensionLoader
|
||||
|
||||
|
||||
EXTDIR = os.path.join(os.path.dirname(__file__), 'data', 'extensions')
|
||||
|
||||
|
||||
class ExtensionLoaderTest(TestCase):
|
||||
|
||||
def test_load_device(self):
|
||||
loader = ExtensionLoader(paths=[EXTDIR, ], load_defaults=False)
|
||||
device = loader.get_device('test-device')
|
||||
assert_equal(device.name, 'test-device')
|
||||
|
||||
def test_list_by_kind(self):
|
||||
loader = ExtensionLoader(paths=[EXTDIR, ], load_defaults=False)
|
||||
exts = loader.list_devices()
|
||||
assert_equal(len(exts), 1)
|
||||
assert_equal(exts[0].name, 'test-device')
|
||||
|
||||
def test_clear_and_reload(self):
|
||||
loader = ExtensionLoader()
|
||||
assert_greater(len(loader.list_devices()), 1)
|
||||
loader.clear()
|
||||
loader.update(paths=[EXTDIR, ])
|
||||
devices = loader.list_devices()
|
||||
assert_equal(len(devices), 1)
|
||||
assert_equal(devices[0].name, 'test-device')
|
||||
assert_equal(len(loader.list_extensions()), 1)
|
||||
|
226
wlauto/tests/test_instrumentation.py
Normal file
226
wlauto/tests/test_instrumentation.py
Normal file
@@ -0,0 +1,226 @@
|
||||
# Copyright 2013-2015 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
# pylint: disable=W0231,W0613,E0611,W0603,R0201
|
||||
from unittest import TestCase
|
||||
|
||||
from nose.tools import assert_equal, raises, assert_true, assert_false
|
||||
|
||||
from wlauto import Instrument
|
||||
from wlauto.core import signal, instrumentation
|
||||
from wlauto.instrumentation import instrument_is_installed, clear_instrumentation
|
||||
|
||||
|
||||
class MockInstrument(Instrument):
|
||||
|
||||
name = 'mock'
|
||||
|
||||
def __init__(self):
|
||||
Instrument.__init__(self, None)
|
||||
self.before = 0
|
||||
self.after = 0
|
||||
|
||||
def before_workload_execution(self, context):
|
||||
self.before += 1
|
||||
|
||||
def after_workload_execution(self, context):
|
||||
self.after += 1
|
||||
|
||||
|
||||
class MockInstrument2(Instrument):
|
||||
|
||||
name = 'mock_2'
|
||||
|
||||
def __init__(self):
|
||||
Instrument.__init__(self, None)
|
||||
self.before = 0
|
||||
self.after = 0
|
||||
self.result = 0
|
||||
|
||||
def before_workload_execution(self, context):
|
||||
self.before += 1
|
||||
|
||||
def after_workload_execution(self, context):
|
||||
self.after += 1
|
||||
|
||||
def after_workload_result_update(self, context):
|
||||
self.result += 1
|
||||
|
||||
|
||||
class MockInstrument3(Instrument):
|
||||
|
||||
name = 'mock_3'
|
||||
|
||||
def __init__(self):
|
||||
Instrument.__init__(self, None)
|
||||
|
||||
def slow_before_workload_execution(self, context):
|
||||
global counter
|
||||
counter += 1
|
||||
|
||||
|
||||
class MockInstrument4(Instrument):
|
||||
|
||||
name = 'mock_4'
|
||||
|
||||
def __init__(self):
|
||||
Instrument.__init__(self, None)
|
||||
|
||||
def slow_before_first_iteration_boot(self, context):
|
||||
global counter
|
||||
counter = 4
|
||||
|
||||
|
||||
class MockInstrument5(Instrument):
|
||||
|
||||
name = 'mock_5'
|
||||
|
||||
def __init__(self):
|
||||
Instrument.__init__(self, None)
|
||||
|
||||
def fast_before_first_iteration_boot(self, context):
|
||||
global counter
|
||||
counter += 2
|
||||
|
||||
|
||||
class MockInstrument6(Instrument):
|
||||
|
||||
name = 'mock_6'
|
||||
|
||||
def __init__(self):
|
||||
Instrument.__init__(self, None)
|
||||
|
||||
def before_first_iteration_boot(self, context):
|
||||
global counter
|
||||
counter *= 10
|
||||
|
||||
|
||||
class BadInstrument(Instrument):
|
||||
|
||||
name = 'bad'
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
# Not specifying the context argument.
|
||||
def teardown(self):
|
||||
pass
|
||||
|
||||
|
||||
counter = 0
|
||||
|
||||
|
||||
class InstrumentationTest(TestCase):
|
||||
|
||||
def tearDown(self):
|
||||
clear_instrumentation()
|
||||
|
||||
def test_install(self):
|
||||
instrument = _instantiate(MockInstrument)
|
||||
instrument2 = _instantiate(MockInstrument2)
|
||||
instrumentation.install(instrument)
|
||||
instrumentation.install(instrument2)
|
||||
signal.send(signal.BEFORE_WORKLOAD_EXECUTION, self, context=None)
|
||||
signal.send(signal.AFTER_WORKLOAD_EXECUTION, self, context=None)
|
||||
signal.send(signal.AFTER_WORKLOAD_RESULT_UPDATE, self, context=None)
|
||||
assert_equal(instrument.before, 1)
|
||||
assert_equal(instrument.after, 1)
|
||||
assert_equal(instrument2.before, 1)
|
||||
assert_equal(instrument2.after, 1)
|
||||
assert_equal(instrument2.result, 1)
|
||||
|
||||
def test_enable_disable(self):
|
||||
instrument = _instantiate(MockInstrument)
|
||||
instrument2 = _instantiate(MockInstrument2)
|
||||
instrumentation.install(instrument)
|
||||
instrumentation.install(instrument2)
|
||||
|
||||
instrumentation.disable_all()
|
||||
signal.send(signal.BEFORE_WORKLOAD_EXECUTION, self, context=None)
|
||||
signal.send(signal.AFTER_WORKLOAD_EXECUTION, self, context=None)
|
||||
signal.send(signal.AFTER_WORKLOAD_RESULT_UPDATE, self, context=None)
|
||||
assert_equal(instrument.before, 0)
|
||||
assert_equal(instrument.after, 0)
|
||||
assert_equal(instrument2.before, 0)
|
||||
assert_equal(instrument2.after, 0)
|
||||
assert_equal(instrument2.result, 0)
|
||||
|
||||
instrumentation.enable(instrument)
|
||||
signal.send(signal.BEFORE_WORKLOAD_EXECUTION, self, context=None)
|
||||
signal.send(signal.AFTER_WORKLOAD_EXECUTION, self, context=None)
|
||||
signal.send(signal.AFTER_WORKLOAD_RESULT_UPDATE, self, context=None)
|
||||
assert_equal(instrument.before, 1)
|
||||
assert_equal(instrument.after, 1)
|
||||
assert_equal(instrument2.before, 0)
|
||||
assert_equal(instrument2.after, 0)
|
||||
assert_equal(instrument2.result, 0)
|
||||
|
||||
instrumentation.enable_all()
|
||||
signal.send(signal.BEFORE_WORKLOAD_EXECUTION, self, context=None)
|
||||
signal.send(signal.AFTER_WORKLOAD_EXECUTION, self, context=None)
|
||||
signal.send(signal.AFTER_WORKLOAD_RESULT_UPDATE, self, context=None)
|
||||
assert_equal(instrument.before, 2)
|
||||
assert_equal(instrument.after, 2)
|
||||
assert_equal(instrument2.before, 1)
|
||||
assert_equal(instrument2.after, 1)
|
||||
assert_equal(instrument2.result, 1)
|
||||
|
||||
def test_local_instrument(self):
|
||||
global counter
|
||||
counter = 0
|
||||
self.install_local_instrument()
|
||||
signal.send(signal.BEFORE_WORKLOAD_EXECUTION, self, context=None)
|
||||
assert_equal(counter, 1)
|
||||
|
||||
def test_priority_prefix_instrument(self):
|
||||
global counter
|
||||
counter = 0
|
||||
instrument1 = _instantiate(MockInstrument4)
|
||||
instrument2 = _instantiate(MockInstrument5)
|
||||
instrument3 = _instantiate(MockInstrument6)
|
||||
instrumentation.install(instrument1)
|
||||
instrumentation.install(instrument2)
|
||||
instrumentation.install(instrument3)
|
||||
signal.send(signal.BEFORE_FIRST_ITERATION_BOOT, self, context=None)
|
||||
assert_equal(counter, 42)
|
||||
|
||||
@raises(ValueError)
|
||||
def test_bad_argspec(self):
|
||||
instrument = _instantiate(BadInstrument)
|
||||
instrumentation.install(instrument)
|
||||
|
||||
def test_check_installed(self):
|
||||
instrumentation.install(_instantiate(MockInstrument))
|
||||
assert_true(instrument_is_installed('mock'))
|
||||
assert_true(instrument_is_installed(MockInstrument))
|
||||
assert_false(instrument_is_installed(MockInstrument2))
|
||||
|
||||
def install_local_instrument(self):
|
||||
instrument = _instantiate(MockInstrument3)
|
||||
instrumentation.install(instrument)
|
||||
|
||||
@raises(ValueError)
|
||||
def test_duplicate_install(self):
|
||||
instrument = _instantiate(MockInstrument)
|
||||
instrument2 = _instantiate(MockInstrument)
|
||||
instrumentation.install(instrument)
|
||||
instrumentation.install(instrument2)
|
||||
|
||||
|
||||
def _instantiate(cls):
|
||||
# Needed to get around Extension's __init__ checks
|
||||
return cls()
|
||||
|
130
wlauto/tests/test_results_manager.py
Normal file
130
wlauto/tests/test_results_manager.py
Normal file
@@ -0,0 +1,130 @@
|
||||
# Copyright 2013-2015 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
# pylint: disable=W0231,W0613,E0611,W0603,R0201
|
||||
from unittest import TestCase
|
||||
|
||||
from nose.tools import assert_equal, assert_true, assert_false, assert_raises
|
||||
|
||||
from wlauto.core.result import ResultProcessor, ResultManager
|
||||
from wlauto.exceptions import WAError
|
||||
|
||||
|
||||
class MockResultProcessor1(ResultProcessor):
|
||||
|
||||
name = 'result_processor_with_exception'
|
||||
|
||||
def process_iteration_result(self, result, context):
|
||||
raise Exception()
|
||||
|
||||
def process_run_result(self, result, context):
|
||||
raise Exception()
|
||||
|
||||
|
||||
class MockResultProcessor2(ResultProcessor):
|
||||
|
||||
name = 'result_processor_with_wa_error'
|
||||
|
||||
def process_iteration_result(self, result, context):
|
||||
raise WAError()
|
||||
|
||||
def process_run_result(self, result, context):
|
||||
raise WAError()
|
||||
|
||||
|
||||
class MockResultProcessor3(ResultProcessor):
|
||||
|
||||
name = 'result_processor_with_keybaord_interrupt'
|
||||
|
||||
def process_iteration_result(self, result, context):
|
||||
raise KeyboardInterrupt()
|
||||
|
||||
def process_run_result(self, result, context):
|
||||
raise KeyboardInterrupt()
|
||||
|
||||
|
||||
class MockResultProcessor4(ResultProcessor):
|
||||
|
||||
name = 'result_processor'
|
||||
|
||||
def __init__(self):
|
||||
super(MockResultProcessor4, self).__init__()
|
||||
self.is_invoked = False
|
||||
|
||||
def process_iteration_result(self, result, context):
|
||||
self.is_invoked = True
|
||||
|
||||
def process_run_result(self, result, context):
|
||||
self.is_invoked = True
|
||||
|
||||
|
||||
class ResultManagerTest(TestCase):
|
||||
|
||||
def test_keyboard_interrupt(self):
|
||||
processor_keyboard_interrupt = _instantiate(MockResultProcessor3)
|
||||
|
||||
# adding the results processor to the result manager
|
||||
manager = ResultManager()
|
||||
assert_false(manager.processors)
|
||||
|
||||
# adding the results processor to the result manager
|
||||
manager.install(processor_keyboard_interrupt)
|
||||
|
||||
assert_equal(len(manager.processors), 1)
|
||||
assert_raises(KeyboardInterrupt, manager.add_result, None, None)
|
||||
|
||||
def test_add_result(self):
|
||||
processor_generic_exception = _instantiate(MockResultProcessor1)
|
||||
processor_wa_error = _instantiate(MockResultProcessor2)
|
||||
processor = _instantiate(MockResultProcessor4)
|
||||
|
||||
# adding the results processor to the result manager
|
||||
manager = ResultManager()
|
||||
assert_false(manager.processors)
|
||||
|
||||
# adding the results processor to the result manager
|
||||
manager.install(processor_generic_exception)
|
||||
manager.install(processor_wa_error)
|
||||
manager.install(processor)
|
||||
|
||||
assert_equal(len(manager.processors), 3)
|
||||
manager.add_result(None, None)
|
||||
|
||||
assert_true(processor.is_invoked)
|
||||
|
||||
def test_process_results(self):
|
||||
processor_generic_exception = _instantiate(MockResultProcessor1)
|
||||
processor_wa_error = _instantiate(MockResultProcessor2)
|
||||
processor = _instantiate(MockResultProcessor4)
|
||||
|
||||
# adding the results processor to the result manager
|
||||
manager = ResultManager()
|
||||
assert_false(manager.processors)
|
||||
|
||||
# adding the results processor to the result manager
|
||||
manager.install(processor_generic_exception)
|
||||
manager.install(processor_wa_error)
|
||||
manager.install(processor)
|
||||
|
||||
assert_equal(len(manager.processors), 3)
|
||||
manager.process_run_result(None, None)
|
||||
|
||||
assert_true(processor.is_invoked)
|
||||
|
||||
|
||||
def _instantiate(cls):
|
||||
# Needed to get around Extension's __init__ checks
|
||||
return cls()
|
63
wlauto/tests/test_utils.py
Normal file
63
wlauto/tests/test_utils.py
Normal file
@@ -0,0 +1,63 @@
|
||||
# Copyright 2013-2015 ARM Limited
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
|
||||
# pylint: disable=R0201
|
||||
from unittest import TestCase
|
||||
|
||||
from nose.tools import raises, assert_equal # pylint: disable=E0611
|
||||
|
||||
from wlauto.utils.android import check_output
|
||||
from wlauto.utils.misc import merge_dicts, TimeoutError
|
||||
|
||||
|
||||
class TestCheckOutput(TestCase):
|
||||
|
||||
def test_ok(self):
|
||||
check_output("python -c 'import time; time.sleep(0.1)'", timeout=0.5, shell=True)
|
||||
|
||||
@raises(TimeoutError)
|
||||
def test_bad(self):
|
||||
check_output("python -c 'import time; time.sleep(1)'", timeout=0.5, shell=True)
|
||||
|
||||
|
||||
class TestMerge(TestCase):
|
||||
|
||||
def test_dict_merge(self):
|
||||
base = {'a': 1, 'b': {'x': 9, 'z': 10}}
|
||||
other = {'b': {'x': 7, 'y': 8}, 'c': [1, 2, 3]}
|
||||
result = merge_dicts(base, other)
|
||||
assert_equal(result['a'], 1)
|
||||
assert_equal(result['b']['x'], 7)
|
||||
assert_equal(result['b']['y'], 8)
|
||||
assert_equal(result['b']['z'], 10)
|
||||
assert_equal(result['c'], [1, 2, 3])
|
||||
|
||||
def test_merge_dict_lists(self):
|
||||
base = {'a': [1, 3, 2]}
|
||||
other = {'a': [3, 4, 5]}
|
||||
result = merge_dicts(base, other)
|
||||
assert_equal(result['a'], [1, 3, 2, 3, 4, 5])
|
||||
result = merge_dicts(base, other, list_duplicates='first')
|
||||
assert_equal(result['a'], [1, 3, 2, 4, 5])
|
||||
result = merge_dicts(base, other, list_duplicates='last')
|
||||
assert_equal(result['a'], [1, 2, 3, 4, 5])
|
||||
|
||||
@raises(ValueError)
|
||||
def test_type_mismatch(self):
|
||||
base = {'a': [1, 2, 3]}
|
||||
other = {'a': 'test'}
|
||||
merge_dicts(base, other, match_types=True)
|
||||
|
Reference in New Issue
Block a user