diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:19:54 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:19:54 +0200 |
commit | c158582c0fc7f4bd73980fe9adad446855f4d61b (patch) | |
tree | 31b701a2367cb983e76e76cd7c2ba176ad33e5ac /recipes-test/virt-test/files/qemu-tests-tsc-sync-build-avoidance.patch | |
download | meta-vt-daisy-140929.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'recipes-test/virt-test/files/qemu-tests-tsc-sync-build-avoidance.patch')
-rw-r--r-- | recipes-test/virt-test/files/qemu-tests-tsc-sync-build-avoidance.patch | 194 |
1 files changed, 194 insertions, 0 deletions
diff --git a/recipes-test/virt-test/files/qemu-tests-tsc-sync-build-avoidance.patch b/recipes-test/virt-test/files/qemu-tests-tsc-sync-build-avoidance.patch new file mode 100644 index 0000000..2e078ff --- /dev/null +++ b/recipes-test/virt-test/files/qemu-tests-tsc-sync-build-avoidance.patch | |||
@@ -0,0 +1,194 @@ | |||
1 | commit 58b79263adaaee08a7a913268f36e2f957b330db | ||
2 | Author: Jonas Eriksson <jonas.eriksson@enea.com> | ||
3 | Date: Fri Mar 21 15:21:18 2014 +0100 | ||
4 | |||
5 | tsc_sync tests: Avoid build and parameterize | ||
6 | |||
7 | Signed-off-by: Jonas Eriksson <jonas.eriksson@enea.com> | ||
8 | Upstream-Status: Pending | ||
9 | |||
10 | diff --git a/qemu/tests/timerdevice_clock_drift_with_ntp.py b/qemu/tests/timerdevice_clock_drift_with_ntp.py | ||
11 | index 4498519..28f22c0 100644 | ||
12 | --- a/qemu/tests/timerdevice_clock_drift_with_ntp.py | ||
13 | +++ b/qemu/tests/timerdevice_clock_drift_with_ntp.py | ||
14 | @@ -26,9 +26,11 @@ def run(test, params, env): | ||
15 | :param params: Dictionary with test parameters. | ||
16 | :param env: Dictionary with the test environment. | ||
17 | """ | ||
18 | + drift_filename = params.get("drift_filename", "/var/lib/ntp/drift") | ||
19 | + | ||
20 | def _drift_file_exist(): | ||
21 | try: | ||
22 | - session.cmd("test -f /var/lib/ntp/drift") | ||
23 | + session.cmd("test -f %s" % drift_filename) | ||
24 | return True | ||
25 | except Exception: | ||
26 | return False | ||
27 | @@ -46,20 +48,25 @@ def run(test, params, env): | ||
28 | timeout = int(params.get("login_timeout", 360)) | ||
29 | sess_guest_load = vm.wait_for_login(timeout=timeout) | ||
30 | |||
31 | - error.context("Copy time-warp-test.c to guest", logging.info) | ||
32 | - src_file_name = os.path.join(data_dir.get_deps_dir(), "time_warp", | ||
33 | - "time-warp-test.c") | ||
34 | - vm.copy_files_to(src_file_name, "/tmp") | ||
35 | + time_warp_test_cmd = params.get("time_warp_test_cmd", "/tmp/time-warp-test") | ||
36 | + | ||
37 | + if sess_guest_load.get_command_status("test -x %s" % time_warp_test_cmd): | ||
38 | + error.context("Copy time-warp-test.c to guest", logging.info) | ||
39 | + src_file_name = os.path.join(data_dir.get_deps_dir(), "time_warp", | ||
40 | + "time-warp-test.c") | ||
41 | + vm.copy_files_to(src_file_name, "/tmp") | ||
42 | |||
43 | - error.context("Compile the time-warp-test.c", logging.info) | ||
44 | - cmd = "cd /tmp/;" | ||
45 | - cmd += " yum install -y popt-devel;" | ||
46 | - cmd += " rm -f time-warp-test;" | ||
47 | - cmd += " gcc -Wall -o time-warp-test time-warp-test.c -lrt" | ||
48 | - sess_guest_load.cmd(cmd) | ||
49 | + error.context("Compile the time-warp-test.c", logging.info) | ||
50 | + cmd = "cd /tmp/;" | ||
51 | + cmd += " yum install -y popt-devel;" | ||
52 | + cmd += " rm -f time-warp-test;" | ||
53 | + cmd += " gcc -Wall -o time-warp-test time-warp-test.c -lrt" | ||
54 | + sess_guest_load.cmd(cmd) | ||
55 | |||
56 | error.context("Stop ntpd and apply load on guest", logging.info) | ||
57 | - sess_guest_load.cmd("yum install -y ntp; service ntpd stop") | ||
58 | + default_ntp_stop_cmd = "yum install -y ntp; service ntpd stop; rm -f %s" % drift_filename | ||
59 | + ntp_stop_cmd = params.get("ntp_stop_cmd", default_ntp_stop_cmd) | ||
60 | + sess_guest_load.cmd(ntp_stop_cmd) | ||
61 | load_cmd = "for ((I=0; I<`grep 'processor id' /proc/cpuinfo| wc -l`; I++));" | ||
62 | load_cmd += " do taskset -c $I /bin/bash -c 'for ((;;)); do X=1; done &';" | ||
63 | load_cmd += " done" | ||
64 | @@ -80,12 +87,12 @@ def run(test, params, env): | ||
65 | |||
66 | error.context("Run time-warp-test", logging.info) | ||
67 | session = vm.wait_for_login(timeout=timeout) | ||
68 | - cmd = "/tmp/time-warp-test > /dev/null &" | ||
69 | + cmd = "%s > /dev/null &" % time_warp_test_cmd | ||
70 | session.sendline(cmd) | ||
71 | |||
72 | error.context("Start ntpd on guest", logging.info) | ||
73 | - cmd = "service ntpd start; sleep 1; echo" | ||
74 | - session.cmd(cmd) | ||
75 | + ntp_start_cmd = params.get("ntp_start_cmd", "service ntpd start; sleep 1; echo") | ||
76 | + session.cmd(ntp_start_cmd) | ||
77 | |||
78 | error.context("Check if the drift file exists on guest", logging.info) | ||
79 | test_run_timeout = float(params["test_run_timeout"]) | ||
80 | @@ -93,10 +100,12 @@ def run(test, params, env): | ||
81 | utils_misc.wait_for(_drift_file_exist, test_run_timeout, step=5) | ||
82 | except aexpect.ShellCmdError, detail: | ||
83 | raise error.TestError("Failed to wait for the creation of" | ||
84 | - " /var/lib/ntp/drift file. Detail: '%s'" % detail) | ||
85 | + " %s file. Detail: '%s'" % | ||
86 | + (drift_filename, detail)) | ||
87 | |||
88 | error.context("Verify the drift file content on guest", logging.info) | ||
89 | - output = session.cmd("cat /var/lib/ntp/drift") | ||
90 | + output = session.cmd("cat %s" % drift_filename) | ||
91 | if int(abs(float(output))) > 20: | ||
92 | raise error.TestFail("Failed to check the ntp drift." | ||
93 | - " Output: '%s'" % output) | ||
94 | + " Output from 'cat %s': '%s'" % | ||
95 | + (drift_filename, output)) | ||
96 | diff --git a/qemu/tests/timerdevice_tscsync_change_host_clksource.py b/qemu/tests/timerdevice_tscsync_change_host_clksource.py | ||
97 | index 5339fce..3ea6cb2 100644 | ||
98 | --- a/qemu/tests/timerdevice_tscsync_change_host_clksource.py | ||
99 | +++ b/qemu/tests/timerdevice_tscsync_change_host_clksource.py | ||
100 | @@ -43,23 +43,27 @@ def run(test, params, env): | ||
101 | if not '0' in output: | ||
102 | raise error.TestFail("Failed to check vsyscall. Output: '%s'" % output) | ||
103 | |||
104 | - error.context("Copy time-warp-test.c to guest", logging.info) | ||
105 | - src_file_name = os.path.join(data_dir.get_deps_dir(), "tsc_sync", | ||
106 | - "time-warp-test.c") | ||
107 | - vm.copy_files_to(src_file_name, "/tmp") | ||
108 | - | ||
109 | - error.context("Compile the time-warp-test.c", logging.info) | ||
110 | - cmd = "cd /tmp/;" | ||
111 | - cmd += " yum install -y popt-devel;" | ||
112 | - cmd += " rm -f time-warp-test;" | ||
113 | - cmd += " gcc -Wall -o time-warp-test time-warp-test.c -lrt" | ||
114 | - session.cmd(cmd) | ||
115 | - | ||
116 | - error.context("Run time-warp-test", logging.info) | ||
117 | + time_warp_test_cmd = params.get("time_warp_test_cmd", "/tmp/time-warp-test") | ||
118 | + | ||
119 | + if session.get_command_status("test -x %s" % time_warp_test_cmd): | ||
120 | + error.context("Copy time-warp-test.c to guest", logging.info) | ||
121 | + src_file_name = os.path.join(data_dir.get_deps_dir(), "tsc_sync", | ||
122 | + "time-warp-test.c") | ||
123 | + vm.copy_files_to(src_file_name, "/tmp") | ||
124 | + | ||
125 | + error.context("Compile the time-warp-test.c", logging.info) | ||
126 | + cmd = "cd /tmp/;" | ||
127 | + cmd += " yum install -y popt-devel;" | ||
128 | + cmd += " rm -f time-warp-test;" | ||
129 | + cmd += " gcc -Wall -o time-warp-test time-warp-test.c -lrt" | ||
130 | + session.cmd(cmd) | ||
131 | + | ||
132 | + time_warp_test_cmd = "/tmp/time-warp-test" | ||
133 | + | ||
134 | + error.context("Run %s" % time_warp_test_cmd, logging.info) | ||
135 | test_run_timeout = int(params.get("test_run_timeout", 10)) | ||
136 | session.sendline("$(sleep %d; pkill time-warp-test) &" % test_run_timeout) | ||
137 | - cmd = "/tmp/time-warp-test" | ||
138 | - _, output = session.cmd_status_output(cmd, timeout=(test_run_timeout + 60)) | ||
139 | + _, output = session.cmd_status_output(time_warp_test_cmd, timeout=(test_run_timeout + 60)) | ||
140 | |||
141 | re_str = "fail:(\d+).*?fail:(\d+).*fail:(\d+)" | ||
142 | fail_cnt = re.findall(re_str, output) | ||
143 | @@ -83,8 +87,7 @@ def run(test, params, env): | ||
144 | logging.info) | ||
145 | cmd = "$(sleep %d; pkill time-warp-test) &" | ||
146 | session.sendline(cmd % test_run_timeout) | ||
147 | - cmd = "/tmp/time-warp-test" | ||
148 | - _, output = session.cmd_status_output(cmd, | ||
149 | + _, output = session.cmd_status_output(time_warp_test_cmd, | ||
150 | timeout=(test_run_timeout + 60)) | ||
151 | |||
152 | fail_cnt = re.findall(re_str, output) | ||
153 | diff --git a/qemu/tests/timerdevice_tscsync_longtime.py b/qemu/tests/timerdevice_tscsync_longtime.py | ||
154 | index 47cc659..841be62 100644 | ||
155 | --- a/qemu/tests/timerdevice_tscsync_longtime.py | ||
156 | +++ b/qemu/tests/timerdevice_tscsync_longtime.py | ||
157 | @@ -40,23 +40,25 @@ def run(test, params, env): | ||
158 | timeout = int(params.get("login_timeout", 360)) | ||
159 | session = vm.wait_for_login(timeout=timeout) | ||
160 | |||
161 | - error.context("Copy time-warp-test.c to guest", logging.info) | ||
162 | - src_file_name = os.path.join(data_dir.get_root_dir(), "shared", "deps", | ||
163 | - "time-warp-test.c") | ||
164 | - vm.copy_files_to(src_file_name, "/tmp") | ||
165 | + time_warp_test_cmd = params.get("time_warp_test_cmd", "/tmp/time-warp-test") | ||
166 | |||
167 | - error.context("Compile the time-warp-test.c", logging.info) | ||
168 | - cmd = "cd /tmp/;" | ||
169 | - cmd += " yum install -y popt-devel;" | ||
170 | - cmd += " rm -f time-warp-test;" | ||
171 | - cmd += " gcc -Wall -o time-warp-test time-warp-test.c -lrt" | ||
172 | - session.cmd(cmd) | ||
173 | + if sess_guest_load.get_command_status("test -x %s", time_warp_test_cmd): | ||
174 | + error.context("Copy time-warp-test.c to guest", logging.info) | ||
175 | + src_file_name = os.path.join(data_dir.get_root_dir(), "shared", "deps", | ||
176 | + "time-warp-test.c") | ||
177 | + vm.copy_files_to(src_file_name, "/tmp") | ||
178 | + | ||
179 | + error.context("Compile the time-warp-test.c", logging.info) | ||
180 | + cmd = "cd /tmp/;" | ||
181 | + cmd += " yum install -y popt-devel;" | ||
182 | + cmd += " rm -f time-warp-test;" | ||
183 | + cmd += " gcc -Wall -o time-warp-test time-warp-test.c -lrt" | ||
184 | + session.cmd(cmd) | ||
185 | |||
186 | error.context("Run time-warp-test for minimum 4 hours", logging.info) | ||
187 | test_run_timeout = int(params.get("test_run_timeout", 14400)) | ||
188 | session.sendline("$(sleep %d; pkill time-warp-test) &" % test_run_timeout) | ||
189 | - cmd = "/tmp/time-warp-test" | ||
190 | - _, output = session.cmd_status_output(cmd, timeout=(test_run_timeout + 60)) | ||
191 | + _, output = session.cmd_status_output(time_warp_test_cmd, timeout=(test_run_timeout + 60)) | ||
192 | |||
193 | re_str = "fail:(\d+).*?fail:(\d+).*fail:(\d+)" | ||
194 | fail_cnt = re.findall(re_str, output) | ||