mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-09-02 03:12:34 +01:00
WA3 Exsisting Code
This commit is contained in:
0
wa/tests/__init__.py
Normal file
0
wa/tests/__init__.py
Normal file
50
wa/tests/data/extensions/devices/test_device.py
Normal file
50
wa/tests/data/extensions/devices/test_device.py
Normal file
@@ -0,0 +1,50 @@
|
||||
# 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 wa import Plugin
|
||||
|
||||
|
||||
class TestDevice(Plugin):
|
||||
|
||||
name = 'test-device'
|
||||
kind = '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
wa/tests/data/interrupts/after
Executable file
98
wa/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
wa/tests/data/interrupts/before
Executable file
97
wa/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
wa/tests/data/interrupts/result
Executable file
98
wa/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
wa/tests/data/logcat.2.log
Normal file
14
wa/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
wa/tests/data/logcat.log
Normal file
10
wa/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
wa/tests/data/test-agenda.yaml
Normal file
25
wa/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
wa/tests/data/test-config.py
Normal file
17
wa/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
wa/tests/test_agenda.py
Normal file
195
wa/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 wa.framework.agenda import Agenda
|
||||
from wa.framework.exception 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)
|
21
wa/tests/test_config.py
Normal file
21
wa/tests/test_config.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import unittest
|
||||
from nose.tools import assert_equal
|
||||
|
||||
from wa.framework.configuration import merge_config_values
|
||||
|
||||
|
||||
class TestConfigUtils(unittest.TestCase):
|
||||
|
||||
def test_merge_values(self):
|
||||
test_cases = [
|
||||
('a', 3, 3),
|
||||
('a', [1, 2], ['a', 1, 2]),
|
||||
({1: 2}, [3, 4], [{1: 2}, 3, 4]),
|
||||
(set([2]), [1, 2, 3], [2, 1, 2, 3]),
|
||||
([1, 2, 3], set([2]), set([1, 2, 3])),
|
||||
([1, 2], None, [1, 2]),
|
||||
(None, 'a', 'a'),
|
||||
]
|
||||
for v1, v2, expected in test_cases:
|
||||
assert_equal(merge_config_values(v1, v2), expected)
|
||||
|
44
wa/tests/test_diff.py
Normal file
44
wa/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)
|
||||
|
||||
|
164
wa/tests/test_execution.py
Normal file
164
wa/tests/test_execution.py
Normal file
@@ -0,0 +1,164 @@
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from StringIO import StringIO
|
||||
from mock import Mock
|
||||
from nose.tools import assert_true, assert_false, assert_equal
|
||||
|
||||
from wa.framework import signal
|
||||
from wa.framework.agenda import Agenda
|
||||
from wa.framework.run import RunnerJob
|
||||
from wa.framework.execution import agenda_iterator
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from testutils import SignalWatcher
|
||||
|
||||
|
||||
class TestAgendaIteration(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
agenda_text = """
|
||||
global:
|
||||
iterations: 2
|
||||
sections:
|
||||
- id: a
|
||||
- id: b
|
||||
workloads:
|
||||
- id: 1
|
||||
name: bbench
|
||||
workloads:
|
||||
- id: 2
|
||||
name: dhrystone
|
||||
- id: 3
|
||||
name: coremark
|
||||
iterations: 1
|
||||
"""
|
||||
agenda_file = StringIO(agenda_text)
|
||||
agenda_file.name = 'agenda'
|
||||
self.agenda = Agenda(agenda_file)
|
||||
|
||||
def test_iteration_by_iteration(self):
|
||||
specs = ['{}-{}'.format(s.id, w.id)
|
||||
for _, s, w, _
|
||||
in agenda_iterator(self.agenda, 'by_iteration')]
|
||||
assert_equal(specs,
|
||||
['a-2', 'b-2', 'a-3', 'b-3', 'b-1', 'a-2', 'b-2', 'b-1'])
|
||||
|
||||
def test_iteration_by_section(self):
|
||||
specs = ['{}-{}'.format(s.id, w.id)
|
||||
for _, s, w, _
|
||||
in agenda_iterator(self.agenda, 'by_section')]
|
||||
assert_equal(specs,
|
||||
['a-2', 'a-3', 'b-2', 'b-3', 'b-1', 'a-2', 'b-2', 'b-1'])
|
||||
|
||||
def test_iteration_by_spec(self):
|
||||
specs = ['{}-{}'.format(s.id, w.id)
|
||||
for _, s, w, _ in
|
||||
agenda_iterator(self.agenda, 'by_spec')]
|
||||
assert_equal(specs,
|
||||
['a-2', 'a-2', 'a-3', 'b-2', 'b-2', 'b-3', 'b-1', 'b-1'])
|
||||
|
||||
|
||||
class FakeWorkloadLoader(object):
|
||||
|
||||
def get_workload(self, name, target, **params):
|
||||
workload = Mock()
|
||||
workload.name = name
|
||||
workload.target = target
|
||||
workload.parameters = params
|
||||
return workload
|
||||
|
||||
|
||||
class WorkloadExecutionWatcher(SignalWatcher):
|
||||
|
||||
signals = [
|
||||
signal.BEFORE_WORKLOAD_SETUP,
|
||||
signal.SUCCESSFUL_WORKLOAD_SETUP,
|
||||
signal.AFTER_WORKLOAD_SETUP,
|
||||
signal.BEFORE_WORKLOAD_EXECUTION,
|
||||
signal.SUCCESSFUL_WORKLOAD_EXECUTION,
|
||||
signal.AFTER_WORKLOAD_EXECUTION,
|
||||
signal.BEFORE_WORKLOAD_RESULT_UPDATE,
|
||||
signal.SUCCESSFUL_WORKLOAD_RESULT_UPDATE,
|
||||
signal.AFTER_WORKLOAD_RESULT_UPDATE,
|
||||
signal.BEFORE_WORKLOAD_TEARDOWN,
|
||||
signal.SUCCESSFUL_WORKLOAD_TEARDOWN,
|
||||
signal.AFTER_WORKLOAD_TEARDOWN,
|
||||
]
|
||||
|
||||
|
||||
class TestWorkloadExecution(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
params = {
|
||||
'target': Mock(),
|
||||
'context': Mock(),
|
||||
'loader': FakeWorkloadLoader(),
|
||||
}
|
||||
data = {
|
||||
'id': 'test',
|
||||
'workload': 'test',
|
||||
'label': None,
|
||||
'parameters': None,
|
||||
}
|
||||
self.job = RunnerJob('job1', 'execute-workload-job', params, data)
|
||||
self.workload = self.job.actor.workload
|
||||
self.watcher = WorkloadExecutionWatcher()
|
||||
|
||||
def test_normal_flow(self):
|
||||
self.job.run()
|
||||
assert_true(self.workload.setup.called)
|
||||
assert_true(self.workload.run.called)
|
||||
assert_true(self.workload.update_result.called)
|
||||
assert_true(self.workload.teardown.called)
|
||||
self.watcher.assert_all_called()
|
||||
|
||||
def test_failed_run(self):
|
||||
def bad(self):
|
||||
raise Exception()
|
||||
self.workload.run = bad
|
||||
try:
|
||||
self.job.run()
|
||||
except Exception:
|
||||
pass
|
||||
assert_true(self.workload.setup.called)
|
||||
assert_false(self.workload.update_result.called)
|
||||
assert_true(self.workload.teardown.called)
|
||||
|
||||
assert_true(self.watcher.before_workload_setup.called)
|
||||
assert_true(self.watcher.successful_workload_setup.called)
|
||||
assert_true(self.watcher.after_workload_setup.called)
|
||||
assert_true(self.watcher.before_workload_execution.called)
|
||||
assert_false(self.watcher.successful_workload_execution.called)
|
||||
assert_true(self.watcher.after_workload_execution.called)
|
||||
assert_true(self.watcher.before_workload_result_update.called)
|
||||
assert_false(self.watcher.successful_workload_result_update.called)
|
||||
assert_true(self.watcher.after_workload_result_update.called)
|
||||
assert_true(self.watcher.before_workload_teardown.called)
|
||||
assert_true(self.watcher.successful_workload_teardown.called)
|
||||
assert_true(self.watcher.after_workload_teardown.called)
|
||||
|
||||
def test_failed_setup(self):
|
||||
def bad(self):
|
||||
raise Exception()
|
||||
self.workload.setup = bad
|
||||
try:
|
||||
self.job.run()
|
||||
except Exception:
|
||||
pass
|
||||
assert_false(self.workload.run.called)
|
||||
assert_false(self.workload.update_result.called)
|
||||
assert_false(self.workload.teardown.called)
|
||||
|
||||
assert_true(self.watcher.before_workload_setup.called)
|
||||
assert_false(self.watcher.successful_workload_setup.called)
|
||||
assert_true(self.watcher.after_workload_setup.called)
|
||||
assert_false(self.watcher.before_workload_execution.called)
|
||||
assert_false(self.watcher.successful_workload_execution.called)
|
||||
assert_false(self.watcher.after_workload_execution.called)
|
||||
assert_false(self.watcher.before_workload_result_update.called)
|
||||
assert_false(self.watcher.successful_workload_result_update.called)
|
||||
assert_false(self.watcher.after_workload_result_update.called)
|
||||
assert_false(self.watcher.before_workload_teardown.called)
|
||||
assert_false(self.watcher.successful_workload_teardown.called)
|
||||
assert_false(self.watcher.after_workload_teardown.called)
|
248
wa/tests/test_plugin.py
Normal file
248
wa/tests/test_plugin.py
Normal file
@@ -0,0 +1,248 @@
|
||||
# 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
|
||||
import os
|
||||
from unittest import TestCase
|
||||
|
||||
from nose.tools import assert_equal, raises, assert_true
|
||||
|
||||
from wa.framework.plugin import Plugin, PluginMeta, PluginLoader, Parameter
|
||||
from wa.utils.types import list_of_ints
|
||||
from wa import ConfigError
|
||||
|
||||
|
||||
EXTDIR = os.path.join(os.path.dirname(__file__), 'data', 'extensions')
|
||||
|
||||
|
||||
class PluginLoaderTest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.loader = PluginLoader(paths=[EXTDIR, ])
|
||||
|
||||
def test_load_device(self):
|
||||
device = self.loader.get_device('test-device')
|
||||
assert_equal(device.name, 'test-device')
|
||||
|
||||
def test_list_by_kind(self):
|
||||
exts = self.loader.list_devices()
|
||||
assert_equal(len(exts), 1)
|
||||
assert_equal(exts[0].name, 'test-device')
|
||||
|
||||
|
||||
|
||||
class MyMeta(PluginMeta):
|
||||
|
||||
virtual_methods = ['validate', 'virtual1', 'virtual2']
|
||||
|
||||
|
||||
class MyBasePlugin(Plugin):
|
||||
|
||||
__metaclass__ = MyMeta
|
||||
|
||||
name = 'base'
|
||||
kind = 'test'
|
||||
|
||||
parameters = [
|
||||
Parameter('base'),
|
||||
]
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(MyBasePlugin, 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 MyAcidPlugin(MyBasePlugin):
|
||||
|
||||
name = 'acid'
|
||||
|
||||
parameters = [
|
||||
Parameter('hydrochloric', kind=list_of_ints, default=[1, 2]),
|
||||
Parameter('citric'),
|
||||
Parameter('carbonic', kind=int),
|
||||
]
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(MyAcidPlugin, 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 MyOtherPlugin(MyBasePlugin):
|
||||
|
||||
name = 'other'
|
||||
|
||||
parameters = [
|
||||
Parameter('mandatory', mandatory=True),
|
||||
Parameter('optional', allowed_values=['test', 'check']),
|
||||
]
|
||||
|
||||
class MyOtherOtherPlugin(MyOtherPlugin):
|
||||
|
||||
name = 'otherother'
|
||||
|
||||
parameters = [
|
||||
Parameter('mandatory', override=True),
|
||||
]
|
||||
|
||||
|
||||
class MyOverridingPlugin(MyAcidPlugin):
|
||||
|
||||
name = 'overriding'
|
||||
|
||||
parameters = [
|
||||
Parameter('hydrochloric', override=True, default=[3, 4]),
|
||||
]
|
||||
|
||||
|
||||
class MyThirdTeerPlugin(MyOverridingPlugin):
|
||||
|
||||
name = 'thirdteer'
|
||||
|
||||
|
||||
class MultiValueParamExt(Plugin):
|
||||
|
||||
name = 'multivalue'
|
||||
kind = 'test'
|
||||
|
||||
parameters = [
|
||||
Parameter('test', kind=list_of_ints, allowed_values=[42, 7, 73]),
|
||||
]
|
||||
|
||||
|
||||
class PluginMetaTest(TestCase):
|
||||
|
||||
def test_propagation(self):
|
||||
acid_params = [p.name for p in MyAcidPlugin.parameters]
|
||||
assert_equal(acid_params, ['base', 'hydrochloric', 'citric', 'carbonic'])
|
||||
|
||||
@raises(ValueError)
|
||||
def test_duplicate_param_spec(self):
|
||||
class BadPlugin(MyBasePlugin): # pylint: disable=W0612
|
||||
parameters = [
|
||||
Parameter('base'),
|
||||
]
|
||||
|
||||
def test_param_override(self):
|
||||
class OverridingPlugin(MyBasePlugin): # pylint: disable=W0612
|
||||
parameters = [
|
||||
Parameter('base', override=True, default='cheese'),
|
||||
]
|
||||
assert_equal(OverridingPlugin.parameters['base'].default, 'cheese')
|
||||
|
||||
@raises(ValueError)
|
||||
def test_invalid_param_spec(self):
|
||||
class BadPlugin(MyBasePlugin): # pylint: disable=W0612
|
||||
parameters = [
|
||||
7,
|
||||
]
|
||||
|
||||
def test_virtual_methods(self):
|
||||
acid = MyAcidPlugin()
|
||||
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)
|
||||
|
||||
def test_initialization(self):
|
||||
class MyExt(Plugin):
|
||||
name = 'myext'
|
||||
kind = 'test'
|
||||
values = {'a': 0}
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(MyExt, self).__init__(*args, **kwargs)
|
||||
self.instance_init = 0
|
||||
def initialize(self, context):
|
||||
self.values['a'] += 1
|
||||
|
||||
class MyChildExt(MyExt):
|
||||
name = 'mychildext'
|
||||
def initialize(self, context):
|
||||
self.instance_init += 1
|
||||
|
||||
ext = MyChildExt()
|
||||
ext.initialize(None)
|
||||
|
||||
assert_equal(MyExt.values['a'], 1)
|
||||
assert_equal(ext.instance_init, 1)
|
||||
|
||||
|
||||
class ParametersTest(TestCase):
|
||||
|
||||
def test_setting(self):
|
||||
myext = MyAcidPlugin(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 = MyOtherPlugin(mandatory='check', optional='check')
|
||||
myext.validate()
|
||||
|
||||
def test_default_override(self):
|
||||
myext = MyOverridingPlugin()
|
||||
assert_equal(myext.hydrochloric, [3, 4])
|
||||
myotherext = MyThirdTeerPlugin()
|
||||
assert_equal(myotherext.hydrochloric, [3, 4])
|
||||
|
||||
def test_multivalue_param(self):
|
||||
myext = MultiValueParamExt(test=[7, 42])
|
||||
myext.validate()
|
||||
assert_equal(myext.test, [7, 42])
|
||||
|
||||
@raises(ConfigError)
|
||||
def test_bad_multivalue_param(self):
|
||||
myext = MultiValueParamExt(test=[5])
|
||||
myext.validate()
|
||||
|
||||
@raises(ConfigError)
|
||||
def test_validation_no_mandatory(self):
|
||||
myext = MyOtherPlugin(optional='check')
|
||||
myext.validate()
|
||||
|
||||
@raises(ConfigError)
|
||||
def test_validation_no_mandatory_in_derived(self):
|
||||
MyOtherOtherPlugin()
|
||||
|
||||
@raises(ConfigError)
|
||||
def test_validation_bad_value(self):
|
||||
myext = MyOtherPlugin(mandatory=1, optional='invalid')
|
||||
myext.validate()
|
||||
|
44
wa/tests/test_runner.py
Normal file
44
wa/tests/test_runner.py
Normal file
@@ -0,0 +1,44 @@
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
from mock import Mock
|
||||
from nose.tools import assert_true, assert_false, assert_equal, assert_almost_equal
|
||||
|
||||
from wa.framework import pluginloader
|
||||
from wa.framework.output import RunOutput
|
||||
from wa.framework.run import Runner, RunnerJob, runmethod, reset_runmethods
|
||||
from wa.utils.serializer import json
|
||||
|
||||
|
||||
|
||||
class RunnerTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.output = RunOutput(tempfile.mktemp())
|
||||
self.output.initialize()
|
||||
|
||||
def tearDown(self):
|
||||
shutil.rmtree(self.output.output_directory)
|
||||
|
||||
def test_run_init(self):
|
||||
runner = Runner(self.output)
|
||||
runner.initialize()
|
||||
runner.finalize()
|
||||
assert_true(runner.info.name)
|
||||
assert_true(runner.info.start_time)
|
||||
assert_true(runner.info.end_time)
|
||||
assert_almost_equal(runner.info.duration,
|
||||
runner.info.end_time -
|
||||
runner.info.start_time)
|
||||
|
||||
def test_normal_run(self):
|
||||
runner = Runner(self.output)
|
||||
runner.add_job(1, Mock())
|
||||
runner.add_job(2, Mock())
|
||||
runner.initialize()
|
||||
runner.run()
|
||||
runner.finalize()
|
||||
assert_equal(len(runner.completed_jobs), 2)
|
63
wa/tests/test_signal.py
Normal file
63
wa/tests/test_signal.py
Normal file
@@ -0,0 +1,63 @@
|
||||
import unittest
|
||||
|
||||
from nose.tools import assert_equal, assert_true, assert_false
|
||||
|
||||
import wa.framework.signal as signal
|
||||
|
||||
|
||||
class Callable(object):
|
||||
|
||||
def __init__(self, val):
|
||||
self.val = val
|
||||
|
||||
def __call__(self):
|
||||
return self.val
|
||||
|
||||
|
||||
class TestPriorityDispatcher(unittest.TestCase):
|
||||
|
||||
def test_ConnectNotify(self):
|
||||
one = Callable(1)
|
||||
two = Callable(2)
|
||||
three = Callable(3)
|
||||
signal.connect(
|
||||
two,
|
||||
'test',
|
||||
priority=200
|
||||
)
|
||||
signal.connect(
|
||||
one,
|
||||
'test',
|
||||
priority=100
|
||||
)
|
||||
signal.connect(
|
||||
three,
|
||||
'test',
|
||||
priority=300
|
||||
)
|
||||
result = [i[1] for i in signal.send('test')]
|
||||
assert_equal(result, [3, 2, 1])
|
||||
|
||||
def test_wrap_propagate(self):
|
||||
d = {'before': False, 'after': False, 'success': False}
|
||||
def before():
|
||||
d['before'] = True
|
||||
def after():
|
||||
d['after'] = True
|
||||
def success():
|
||||
d['success'] = True
|
||||
signal.connect(before, signal.BEFORE_WORKLOAD_SETUP)
|
||||
signal.connect(after, signal.AFTER_WORKLOAD_SETUP)
|
||||
signal.connect(success, signal.SUCCESSFUL_WORKLOAD_SETUP)
|
||||
|
||||
caught = False
|
||||
try:
|
||||
with signal.wrap('WORKLOAD_SETUP'):
|
||||
raise RuntimeError()
|
||||
except RuntimeError:
|
||||
caught=True
|
||||
|
||||
assert_true(d['before'])
|
||||
assert_true(d['after'])
|
||||
assert_true(caught)
|
||||
assert_false(d['success'])
|
171
wa/tests/test_utils.py
Normal file
171
wa/tests/test_utils.py
Normal file
@@ -0,0 +1,171 @@
|
||||
# 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, assert_not_equal, assert_in, assert_not_in
|
||||
from nose.tools import assert_true, assert_false
|
||||
|
||||
from wa.utils.types import list_or_integer, list_or_bool, caseless_string, arguments, prioritylist, TreeNode
|
||||
|
||||
|
||||
class TestPriorityList(TestCase):
|
||||
|
||||
def test_insert(self):
|
||||
pl = prioritylist()
|
||||
elements = {3: "element 3",
|
||||
2: "element 2",
|
||||
1: "element 1",
|
||||
5: "element 5",
|
||||
4: "element 4"
|
||||
}
|
||||
for key in elements:
|
||||
pl.add(elements[key], priority=key)
|
||||
|
||||
match = zip(sorted(elements.values()), pl[:])
|
||||
for pair in match:
|
||||
assert(pair[0] == pair[1])
|
||||
|
||||
def test_delete(self):
|
||||
pl = prioritylist()
|
||||
elements = {2: "element 3",
|
||||
1: "element 2",
|
||||
0: "element 1",
|
||||
4: "element 5",
|
||||
3: "element 4"
|
||||
}
|
||||
for key in elements:
|
||||
pl.add(elements[key], priority=key)
|
||||
del elements[2]
|
||||
del pl[2]
|
||||
match = zip(sorted(elements.values()), pl[:])
|
||||
for pair in match:
|
||||
assert(pair[0] == pair[1])
|
||||
|
||||
def test_multiple(self):
|
||||
pl = prioritylist()
|
||||
pl.add('1', 1)
|
||||
pl.add('2.1', 2)
|
||||
pl.add('3', 3)
|
||||
pl.add('2.2', 2)
|
||||
it = iter(pl)
|
||||
assert_equal(it.next(), '3')
|
||||
assert_equal(it.next(), '2.1')
|
||||
assert_equal(it.next(), '2.2')
|
||||
assert_equal(it.next(), '1')
|
||||
|
||||
def test_iterator_break(self):
|
||||
pl = prioritylist()
|
||||
pl.add('1', 1)
|
||||
pl.add('2.1', 2)
|
||||
pl.add('3', 3)
|
||||
pl.add('2.2', 2)
|
||||
for i in pl:
|
||||
if i == '2.1':
|
||||
break
|
||||
assert_equal(pl.index('3'), 3)
|
||||
|
||||
def test_add_before_after(self):
|
||||
pl = prioritylist()
|
||||
pl.add('m', 1)
|
||||
pl.add('a', 2)
|
||||
pl.add('n', 1)
|
||||
pl.add('b', 2)
|
||||
pl.add_before('x', 'm')
|
||||
assert_equal(list(pl), ['a', 'b', 'x', 'm', 'n'])
|
||||
pl.add_after('y', 'b')
|
||||
assert_equal(list(pl), ['a', 'b','y', 'x', 'm', 'n'])
|
||||
pl.add_after('z', 'm')
|
||||
assert_equal(list(pl), ['a', 'b', 'y', 'x', 'm', 'z', 'n'])
|
||||
|
||||
|
||||
class TestTreeNode(TestCase):
|
||||
|
||||
def test_addremove(self):
|
||||
n1, n2, n3 = TreeNode(), TreeNode(), TreeNode()
|
||||
n1.add_child(n2)
|
||||
n3.parent = n2
|
||||
assert_equal(n2.parent, n1)
|
||||
assert_in(n3, n2.children)
|
||||
n2.remove_child(n3)
|
||||
assert_equal(n3.parent, None)
|
||||
assert_not_in(n3, n2.children)
|
||||
n1.add_child(n2) # duplicat add
|
||||
assert_equal(n1.children, [n2])
|
||||
|
||||
def test_ancestor_descendant(self):
|
||||
n1, n2a, n2b, n3 = TreeNode(), TreeNode(), TreeNode(), TreeNode()
|
||||
n1.add_child(n2a)
|
||||
n1.add_child(n2b)
|
||||
n2a.add_child(n3)
|
||||
assert_equal(list(n3.iter_ancestors()), [n3, n2a, n1])
|
||||
assert_equal(list(n1.iter_descendants()), [n2a, n3, n2b])
|
||||
assert_true(n1.has_descendant(n3))
|
||||
assert_true(n3.has_ancestor(n1))
|
||||
assert_false(n3.has_ancestor(n2b))
|
||||
|
||||
def test_root(self):
|
||||
n1, n2, n3 = TreeNode(), TreeNode(), TreeNode()
|
||||
n1.add_child(n2)
|
||||
n2.add_child(n3)
|
||||
assert_true(n1.is_root)
|
||||
assert_false(n2.is_root)
|
||||
assert_equal(n3.get_root(), n1)
|
||||
|
||||
def test_common_ancestor(self):
|
||||
n1, n2, n3a, n3b, n4, n5 = TreeNode(), TreeNode(), TreeNode(), TreeNode(), TreeNode(), TreeNode()
|
||||
n1.add_child(n2)
|
||||
n2.add_child(n3a)
|
||||
n2.add_child(n3b)
|
||||
n3b.add_child(n4)
|
||||
n3a.add_child(n5)
|
||||
assert_equal(n4.get_common_ancestor(n3a), n2)
|
||||
assert_equal(n3a.get_common_ancestor(n4), n2)
|
||||
assert_equal(n3b.get_common_ancestor(n4), n3b)
|
||||
assert_equal(n4.get_common_ancestor(n3b), n3b)
|
||||
assert_equal(n4.get_common_ancestor(n5), n2)
|
||||
|
||||
def test_iteration(self):
|
||||
n1, n2, n3, n4, n5 = TreeNode(), TreeNode(), TreeNode(), TreeNode(), TreeNode()
|
||||
n1.add_child(n2)
|
||||
n2.add_child(n3)
|
||||
n3.add_child(n4)
|
||||
n4.add_child(n5)
|
||||
ancestors = [a for a in n5.iter_ancestors(upto=n2)]
|
||||
assert_equal(ancestors, [n5, n4, n3])
|
||||
ancestors = [a for a in n5.iter_ancestors(after=n2)]
|
||||
assert_equal(ancestors, [n2, n1])
|
||||
|
||||
@raises(ValueError)
|
||||
def test_trivial_loop(self):
|
||||
n1, n2, n3 = TreeNode(), TreeNode(), TreeNode()
|
||||
n1.add_child(n2)
|
||||
n2.add_child(n3)
|
||||
n3.add_child(n1)
|
||||
|
||||
@raises(ValueError)
|
||||
def test_tree_violation(self):
|
||||
n1, n2a, n2b, n3 = TreeNode(), TreeNode(), TreeNode(), TreeNode()
|
||||
n1.add_child(n2a)
|
||||
n1.add_child(n2b)
|
||||
n2a.add_child(n3)
|
||||
n2b.add_child(n3)
|
||||
|
||||
@raises(ValueError)
|
||||
def test_self_parent(self):
|
||||
n = TreeNode()
|
||||
n.add_child(n)
|
39
wa/tests/testutils.py
Normal file
39
wa/tests/testutils.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from mock import Mock
|
||||
from nose.tools import assert_true
|
||||
|
||||
from wa.framework import signal
|
||||
from wa.framework.plugin import Plugin
|
||||
from wa.utils.types import identifier
|
||||
|
||||
|
||||
class SignalWatcher(object):
|
||||
|
||||
signals = []
|
||||
|
||||
def __init__(self):
|
||||
for sig in self.signals:
|
||||
name = identifier(sig.name)
|
||||
callback = Mock()
|
||||
callback.im_func.__name__ = name
|
||||
setattr(self, name, callback)
|
||||
signal.connect(getattr(self, name), sig)
|
||||
|
||||
def assert_all_called(self):
|
||||
for m in self.__dict__.itervalues():
|
||||
assert_true(m.called)
|
||||
|
||||
|
||||
class MockContainerActor(Plugin):
|
||||
|
||||
name = 'mock-container'
|
||||
kind = 'container-actor'
|
||||
|
||||
def __init__(self, owner=None, *args, **kwargs):
|
||||
super(MockContainerActor, self).__init__(*args, **kwargs)
|
||||
self.owner=owner
|
||||
self.initialize = Mock()
|
||||
self.finalize = Mock()
|
||||
self.enter = Mock()
|
||||
self.exit = Mock()
|
||||
self.job_started = Mock()
|
||||
self.job_completed = Mock()
|
Reference in New Issue
Block a user