Merge ~canonical-kernel-team/+git/autotest-client-tests:ubuntu_stress_smoke_split_test into ~canonical-kernel-team/+git/autotest-client-tests:master
- Git
- lp:~canonical-kernel-team/+git/autotest-client-tests
- ubuntu_stress_smoke_split_test
- Merge into master
Status: | Merged |
---|---|
Merge reported by: | Po-Hsu Lin |
Merged at revision: | da077f98d8bbafc26698320b7d155b1bb53e94a6 |
Proposed branch: | ~canonical-kernel-team/+git/autotest-client-tests:ubuntu_stress_smoke_split_test |
Merge into: | ~canonical-kernel-team/+git/autotest-client-tests:master |
Diff against target: |
443 lines (+193/-160) 5 files modified
ubuntu_stress_smoke_test/control (+55/-2) ubuntu_stress_smoke_test/ubuntu_stress_single_smoke_test.sh (+79/-157) ubuntu_stress_smoke_test/ubuntu_stress_smoke_test.py (+1/-1) ubuntu_stress_smoke_test/ubuntu_stress_smoke_test_cleanup.sh (+11/-0) ubuntu_stress_smoke_test/ubuntu_stress_smoke_test_init.sh (+47/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Po-Hsu Lin | Approve | ||
Review via email:
|
Commit message
Split ubuntu_
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Paolo Pisati (p-pisati) wrote : | # |
I removed all white spaces and converted s/$s/$STRESSOR/.
I wonder if could move swap creation/allocation into setup() and thus cut down execution time, let me give it a try.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Paolo Pisati (p-pisati) wrote : | # |
Ok, i moved swap creation/deletion in ubuntu_
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Po-Hsu Lin (cypressyew) wrote : | # |
Cool! Thanks for fixing this.
The test case number is correct now (setup + 267 stressors + swapoff)
I just found out there is a "sleep 15" command in the shell script, right after setting the oom level. That's the real cause of this time-consuming issue. I think that one should be moved out as well. (It's still a good thing to not swap on/off repeatedly.)
Also, there is one issue with doing swap configuration in setup():
The logic for autotest is that the setup() will get triggered only once if the test case version didn't get bumped. So when you try to run the same test suite on the same machine without re-provisioning it or removing autotest/
This is the workflow:
1. initialize()
2. setup()
3. run_once() with stressors
4. swapoff()
With a second run immediately after the first one:
5. initialize()
6. run_once() with stressors
7. swapoff()
I can think of two possible solutions now.
1. Like when we did for ubuntu_
2. Create a new job like the swapoff() you made here, and run it before iterating through all of the stressors
Solution 2 might be more straightforward, we can break the smoke_test shell script into 3 parts:
1. Pre-test configuration like check_machine(), sleep 15 and set_max_oom_level into one script. And determine if we need to skip the stressors base on the check_machine() result there. (For example a VM with small ram. Now it will still iterate through all the tests but without doing any real things. These skipped tests will be treated as PASSED and it cloud give us a false impression that this has been tested and the result is good.)
2. The stressor execution part, which is done.
3. cleanup, swapoff, zswap and cgroup_mem restoration part.
Part 1 and 3 can be embedded in ubuntu_
Sorry for getting this comment too lengthy, please feel free to ping me is you have any question.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Paolo Pisati (p-pisati) wrote : | # |
Ok, i moved the swap on / oom part into a separate script (ubuntu_
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Paolo Pisati (p-pisati) wrote : | # |
I moved the swapon/swapoff part into two separate scripts (ubuntu_
Since setup() is already called after initialize() from autotest itself, i don't understand why we call it again from control, and we can probably remove it, but we can save that for a subsequent pull req.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Po-Hsu Lin (cypressyew) wrote : | # |
> Ok, i moved the swap on / oom part into a separate script
> (ubuntu_
> method, but now i noticed that initialize() is called every time run_once() is
> invoked (thus creating a swap file every time a single test is run): wasn't
> that supposed to run just at the start of autotest?
Hi Paolo,
yes you're right! I just noticed that I got confused by the ubuntu_
The initalize() method is indeed being called EVERY TIME when the test is started. So the actual workflow is like this:
1. initialize()
2. setup()
3. run_once() with stressors
4. initialize()
5. run_once()
From the document [1]:
initialize() - This is run before everything, every time the test is run.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Po-Hsu Lin (cypressyew) wrote (last edit ): | # |
> I moved the swapon/swapoff part into two separate scripts
> (ubuntu_
> invoked from control.
Thanks!
This looks good.
>
> Since setup() is already called after initialize() from autotest itself, i
> don't understand why we call it again from control, and we can probably remove
> it, but we can save that for a subsequent pull req.
Hi,
Calling setup() explicitly give us the opportunity to:
1. Abort the test early when setup() has failed, otherwise all the sub-tests will try to run setup() again.
2. We can also abort the tests after setup() intentionally, to help us build the test for manual tests (see build-only branch)
3. Have an extra setup entry on the test report, when it fails we can tell it's a test build issue. Otherwise we will need to look into the result of sub-tests.
4. Make setup() itself has it's own timeout setting, sometimes it can take a while for setup() to run
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Po-Hsu Lin (cypressyew) wrote : | # |
+1 on this version, thanks for the hard work.
I will make follow-up change to remove set_max_oom_level() and sleep command in ubuntu_
Preview Diff
1 | diff --git a/ubuntu_stress_smoke_test/control b/ubuntu_stress_smoke_test/control |
2 | index a57199e..394b9f9 100644 |
3 | --- a/ubuntu_stress_smoke_test/control |
4 | +++ b/ubuntu_stress_smoke_test/control |
5 | @@ -10,10 +10,63 @@ TEST_CATEGORY = 'Functional' |
6 | TEST_TYPE = "client" |
7 | DOC = "" |
8 | |
9 | + |
10 | +# |
11 | +# Tests that can lock up some kernels or are CPU / arch specific, so exclude them for now |
12 | +# |
13 | +lockup1 = ["rdrand", "numa", "quota", "apparmor", "cpu-online", "kcmp", "copy-file", "exec"] |
14 | +lockup2 = ["spawn", "remap", "stack", "oom-pipe", "resources", "opcode", "sockfd" ,"vforkmany"] |
15 | +lockup3 = ["sockpair", "bind-mount", "funccall", "ioport", "watchdog", "mlockmany", "idle-page", "clone"] |
16 | +lockup = lockup1 + lockup2 + lockup3 |
17 | + |
18 | +# |
19 | +# Tests that are not kernel specific |
20 | +# |
21 | +generic1 = ["atomic", "bsearch", "heapsort", "hsearch", "longjmp", "lsearch", "matrix" ,"memcpy"] |
22 | +generic2 = ["rdrand", "str", "tsc", "vecmath", "wcs", "zlib", "matrix-3d", "l1cache"] |
23 | +generic3 = ["nop", "qsort"] |
24 | +generic = generic1 + generic2 + generic3 |
25 | + |
26 | +# |
27 | +# Tests that are known to cause breakage |
28 | +# |
29 | +breakage = ["xattr", "efivar", "sysinfo", "sysinval"] |
30 | + |
31 | +# |
32 | +# Currenly a new stress test can causes problems with s390x on older kernels |
33 | +# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1905438 |
34 | +# |
35 | +legacy = ["uprobe"] |
36 | + |
37 | +exclude = lockup + generic + breakage + legacy |
38 | + |
39 | +# |
40 | +# Tests that should be skipped on KVM kernels |
41 | +# |
42 | +cmd = "uname -r | awk -F'-' '{print $NF}'" |
43 | +flavour = utils.system_output(cmd, retain_output=True) |
44 | +if flavour == 'kvm': |
45 | + exclude.append('dnotify') |
46 | + |
47 | + |
48 | +test_dir = os.path.join(job.bindir, 'tests', NAME) |
49 | +cmd = '%s/ubuntu_stress_smoke_test_init.sh' % (test_dir) |
50 | +utils.system_output(cmd, retain_output=True) |
51 | + |
52 | result = job.run_test_detail(NAME, test_name='setup', tag='setup', timeout=60*60) |
53 | if result == 'GOOD': |
54 | - results = job.run_test_detail(NAME, test_name='stress-smoke-test', tag='stress-smoke-test', timeout=35*60) |
55 | + stressng_dir = os.path.join(job.bindir, 'tmp', NAME, 'src', 'stress-ng') |
56 | + cmd = '%s/stress-ng --stressor' % (stressng_dir) |
57 | + stressors = utils.system_output(cmd, retain_output=True).split() |
58 | else: |
59 | - print("ERROR: test failed to build, skipping all the sub tests") |
60 | + print("ERROR: can't get a list of available stressors") |
61 | + exit(1) |
62 | + |
63 | +for stress in stressors: |
64 | + if stress not in exclude: |
65 | + job.run_test_detail(NAME, test_name=stress , tag=stress, timeout=35*60) |
66 | + |
67 | +cmd = '%s/ubuntu_stress_smoke_test_cleanup.sh' % (test_dir) |
68 | +utils.system_output(cmd, retain_output=True) |
69 | |
70 | # vi:set ts=4 sw=4 expandtab syntax=python: |
71 | diff --git a/ubuntu_stress_smoke_test/ubuntu_stress_smoke_test.sh b/ubuntu_stress_smoke_test/ubuntu_stress_single_smoke_test.sh |
72 | similarity index 70% |
73 | rename from ubuntu_stress_smoke_test/ubuntu_stress_smoke_test.sh |
74 | rename to ubuntu_stress_smoke_test/ubuntu_stress_single_smoke_test.sh |
75 | index 729d474..e3be957 100755 |
76 | --- a/ubuntu_stress_smoke_test/ubuntu_stress_smoke_test.sh |
77 | +++ b/ubuntu_stress_smoke_test/ubuntu_stress_single_smoke_test.sh |
78 | @@ -1,5 +1,8 @@ |
79 | #!/bin/bash |
80 | |
81 | +[ $# -lt 1 ] && echo "$0 requires STRESSOR name to be run" && exit 1 |
82 | +STRESSOR=${1} |
83 | + |
84 | # Maximum machine age in years |
85 | MAX_AGE=5 |
86 | # minimum required memory in MB |
87 | @@ -59,45 +62,7 @@ INSTANCES=4 |
88 | # |
89 | #STRESS_OPTIONS="--ignite-cpu --maximize --syslog --verbose --verify" |
90 | STRESS_OPTIONS="--ignite-cpu --syslog --verbose --verify --oomable" |
91 | -# |
92 | -# Tests that can lock up some kernels or are CPU / arch specific, so exclude them for now |
93 | -# |
94 | -EXCLUDE="rdrand numa quota apparmor cpu-online kcmp copy-file exec " |
95 | -EXCLUDE+="spawn remap stack oom-pipe resources opcode sockfd vforkmany sockpair " |
96 | -EXCLUDE+="bind-mount funccall ioport watchdog mlockmany idle-page clone " |
97 | -# |
98 | -# Tests that are not kernel specific |
99 | -# |
100 | -EXCLUDE+="atomic bsearch heapsort hsearch longjmp lsearch matrix memcpy nop qsort " |
101 | -EXCLUDE+="rdrand str tsc vecmath wcs zlib matrix-3d l1cache " |
102 | -# |
103 | -# Tests that are known to cause breakage |
104 | -# |
105 | -EXCLUDE+="xattr efivar sysinfo sysinval " |
106 | -# |
107 | -# Currenly a new stress test can causes problems with s390x on older kernels |
108 | -# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1905438 |
109 | -# |
110 | -EXCLUDE+="uprobe " |
111 | -# |
112 | -# Tests that should be skipped on KVM kernels |
113 | -# |
114 | -[ "$(uname -r | awk -F'-' '{print $NF}')" == "kvm" ] && EXCLUDE+="dnotify " |
115 | -# |
116 | -# Tests that break on specific kernel versions and we won't fix |
117 | -# |
118 | -ver=$(uname -r | cut -d'.' -f1-2) |
119 | -if [ "$ver" == "4.20" ]; then |
120 | - # |
121 | - # Broken on 4.20, fixed in 5.0-rc2 |
122 | - # |
123 | - EXCLUDE+="dccp sctp " |
124 | -fi |
125 | |
126 | -# |
127 | -# Get built-in stressor names |
128 | -# |
129 | -STRESSORS=$(./stress-ng --stressors) |
130 | rc=0 |
131 | TMP_FILE=/tmp/stress-$$.log |
132 | |
133 | @@ -185,18 +150,6 @@ secs_now() |
134 | date "+%s" |
135 | } |
136 | |
137 | -not_exclude() |
138 | -{ |
139 | - for x in $2 |
140 | - do |
141 | - if [ $x == $1 ] |
142 | - then |
143 | - return 1 |
144 | - fi |
145 | - done |
146 | - return 0 |
147 | -} |
148 | - |
149 | # |
150 | # Try an ensure that this script and parent won't be oom'd |
151 | # |
152 | @@ -239,25 +192,6 @@ else |
153 | SYS_ZSWAP_SETTING="N" |
154 | fi |
155 | |
156 | -# |
157 | -# Always add 1GB of swap to ensure swapping is exercised |
158 | -# |
159 | -SWPIMG=$PWD/swap.img |
160 | - |
161 | -# |
162 | -# Create 1GB swap file |
163 | -# |
164 | -swapoff ${SWPIMG} >& /dev/null |
165 | -fallocate -l 1G ${SWPIMG} |
166 | -if [ $? -ne 0 ]; then |
167 | - echo "FAILED: Count not create 1GB swap file, file system:" |
168 | - df |
169 | - exit 1 |
170 | -fi |
171 | -chmod 0600 ${SWPIMG} |
172 | -mkswap ${SWPIMG} |
173 | -swapon ${SWPIMG} |
174 | - |
175 | echo " " |
176 | echo "Machine Configuration" |
177 | echo "Physical Pages: $(getconf _PHYS_PAGES)" |
178 | @@ -295,96 +229,87 @@ fi |
179 | |
180 | count=0 |
181 | s1=$(secs_now) |
182 | -for s in ${STRESSORS} |
183 | -do |
184 | - if not_exclude $s "$EXCLUDE" |
185 | - then |
186 | - count=$((count + 1)) |
187 | - dmesg -c >& /dev/null |
188 | - echo "$s STARTING" |
189 | - ${RUN_STRESS} -v -t ${DURATION} --${s} ${INSTANCES} --${s}-ops ${MAX_BOGO_OPS} ${STRESS_OPTIONS} >& ${TMP_FILE} |
190 | - ret=$? |
191 | - echo "$s RETURNED $ret" |
192 | - |
193 | - n=$(dmesg | grep "Out of memory:" | wc -l) |
194 | - if [ $ret -ne 0 -a $n -gt 0 ]; then |
195 | - ret=88 |
196 | - fi |
197 | +count=$((count + 1)) |
198 | +dmesg -c >& /dev/null |
199 | +echo "$STRESSOR STARTING" |
200 | +${RUN_STRESS} -v -t ${DURATION} --${STRESSOR} ${INSTANCES} --${STRESSOR}-ops ${MAX_BOGO_OPS} ${STRESS_OPTIONS} >& ${TMP_FILE} |
201 | +ret=$? |
202 | +echo "$STRESSOR RETURNED $ret" |
203 | + |
204 | +n=$(dmesg | grep "Out of memory:" | wc -l) |
205 | +if [ $ret -ne 0 -a $n -gt 0 ]; then |
206 | + ret=88 |
207 | +fi |
208 | |
209 | - n=$(dmesg | grep "Oops" | wc -l) |
210 | - if [ $n -gt 0 ]; then |
211 | - ret=99 |
212 | - fi |
213 | +n=$(dmesg | grep "Oops" | wc -l) |
214 | +if [ $n -gt 0 ]; then |
215 | + ret=99 |
216 | +fi |
217 | |
218 | - case $ret in |
219 | - 0) |
220 | - echo "$s PASSED" |
221 | - passed="$passed $s" |
222 | - ;; |
223 | - 1) |
224 | - echo "$s SKIPPED (test framework out of resources or test should not be run)" |
225 | - skipped="$skipped $s" |
226 | - ;; |
227 | - 2) |
228 | - echo "$s FAILED" |
229 | - failed="$failed $s" |
230 | - cat ${TMP_FILE} |
231 | - echo " " |
232 | - dmesg |
233 | - echo " " |
234 | - rc=1 |
235 | - ;; |
236 | - 3) |
237 | - echo "$s SKIPPED (stressor out of resources)" |
238 | - skipped="$skipped $s" |
239 | - ;; |
240 | - 4) |
241 | - echo "$s SKIPPED (stressor not implemented on this arch)" |
242 | - skipped="$skipped $s" |
243 | - ;; |
244 | - 5) |
245 | - echo "$s SKIPPED (premature signal killed stressor)" |
246 | - skipped="$skipped $s" |
247 | - ;; |
248 | - 6) |
249 | - echo "$s SKIPPED (premature child exit, this is a bug in the stress test)" |
250 | - skipped="$skipped $s" |
251 | - ;; |
252 | - 7) |
253 | - echo "$s PASSED (child bogo-ops metrics were not accurate)" |
254 | - passed="$passed $s" |
255 | - ;; |
256 | - 88) |
257 | - echo "$s OOMED (out of memory kills detected)" |
258 | - oomed="$oomed $s" |
259 | - ;; |
260 | - 99) |
261 | - echo "$s FAILED (kernel oopsed)" |
262 | - oopsed="$oopsed $s" |
263 | - dmesg |
264 | - echo " " |
265 | - rc=1 |
266 | - ;; |
267 | - 137) |
268 | - echo "$s OOMED (out of memory kills detected)" |
269 | - oomed="$oomed $s" |
270 | - ;; |
271 | - *) |
272 | - echo "$s BADRET (unknown return status $ret)" |
273 | - badret="$badret $s" |
274 | - dmesg |
275 | - echo " " |
276 | - ;; |
277 | - esac |
278 | - rm -f ${TMP_FILE} |
279 | - fi |
280 | -done |
281 | +case $ret in |
282 | +0) |
283 | + echo "$STRESSOR PASSED" |
284 | + passed="$passed $STRESSOR" |
285 | + ;; |
286 | +1) |
287 | + echo "$STRESSOR SKIPPED (test framework out of resources or test should not be run)" |
288 | + skipped="$skipped $STRESSOR" |
289 | + ;; |
290 | +2) |
291 | + echo "$STRESSOR FAILED" |
292 | + failed="$failed $STRESSOR" |
293 | + cat ${TMP_FILE} |
294 | + echo " " |
295 | + dmesg |
296 | + echo " " |
297 | + rc=1 |
298 | + ;; |
299 | +3) |
300 | + echo "$STRESSOR SKIPPED (stressor out of resources)" |
301 | + skipped="$skipped $STRESSOR" |
302 | + ;; |
303 | +4) |
304 | + echo "$STRESSOR SKIPPED (stressor not implemented on this arch)" |
305 | + skipped="$skipped $STRESSOR" |
306 | + ;; |
307 | +5) |
308 | + echo "$STRESSOR SKIPPED (premature signal killed stressor)" |
309 | + skipped="$skipped $STRESSOR" |
310 | + ;; |
311 | +6) |
312 | + echo "$STRESSOR SKIPPED (premature child exit, this is a bug in the stress test)" |
313 | + skipped="$skipped $STRESSOR" |
314 | + ;; |
315 | +7) |
316 | + echo "$STRESSOR PASSED (child bogo-ops metrics were not accurate)" |
317 | + passed="$passed $STRESSOR" |
318 | + ;; |
319 | +88) |
320 | + echo "$STRESSOR OOMED (out of memory kills detected)" |
321 | + oomed="$oomed $STRESSOR" |
322 | + ;; |
323 | +99) |
324 | + echo "$STRESSOR FAILED (kernel oopsed)" |
325 | + oopsed="$oopsed $STRESSOR" |
326 | + dmesg |
327 | + echo " " |
328 | + rc=1 |
329 | + ;; |
330 | +137) |
331 | + echo "$STRESSOR OOMED (out of memory kills detected)" |
332 | + oomed="$oomed $STRESSOR" |
333 | + ;; |
334 | +*) |
335 | + echo "$STRESSOR BADRET (unknown return status $ret)" |
336 | + badret="$badret $STRESSOR" |
337 | + dmesg |
338 | + echo " " |
339 | + ;; |
340 | +esac |
341 | +rm -f ${TMP_FILE} |
342 | s2=$(secs_now) |
343 | dur=$((s2 - $s1)) |
344 | |
345 | -#kill -9 $pid >& /dev/null |
346 | -#wait $pid |
347 | - |
348 | echo " " |
349 | echo "Summary:" |
350 | echo " Stressors run: $count" |
351 | @@ -397,9 +322,6 @@ echo " Badret: $(echo $badret | wc -w), $badret" |
352 | echo " " |
353 | echo "Tests took $dur seconds to run" |
354 | |
355 | -swapoff -a ${SWPIMG} |
356 | -rm ${SWPIMG} |
357 | - |
358 | if [ -e ${SYS_ZSWAP_ENABLED} ]; then |
359 | echo ${ORIGINAL_SYS_ZSWAP_SETTING} > ${SYS_ZSWAP_ENABLED} |
360 | fi |
361 | diff --git a/ubuntu_stress_smoke_test/ubuntu_stress_smoke_test.py b/ubuntu_stress_smoke_test/ubuntu_stress_smoke_test.py |
362 | index 4775e65..2d78cf7 100644 |
363 | --- a/ubuntu_stress_smoke_test/ubuntu_stress_smoke_test.py |
364 | +++ b/ubuntu_stress_smoke_test/ubuntu_stress_smoke_test.py |
365 | @@ -82,7 +82,7 @@ class ubuntu_stress_smoke_test(test.test): |
366 | if os.uname()[1] == '202008-28164-ZCU106': |
367 | raise error.TestFail('Test marked as failed for ZCU106 as requested by portias, dev test hang (LP: #1998738)') |
368 | os.chdir(os.path.join(self.srcdir, 'stress-ng')) |
369 | - cmd = '%s/ubuntu_stress_smoke_test.sh' % (self.bindir) |
370 | + cmd = '%s/ubuntu_stress_single_smoke_test.sh %s' % (self.bindir, test_name) |
371 | self.results = utils.system_output(cmd, retain_output=True) |
372 | |
373 | # vi:set ts=4 sw=4 expandtab syntax=python: |
374 | diff --git a/ubuntu_stress_smoke_test/ubuntu_stress_smoke_test_cleanup.sh b/ubuntu_stress_smoke_test/ubuntu_stress_smoke_test_cleanup.sh |
375 | new file mode 100755 |
376 | index 0000000..6c43281 |
377 | --- /dev/null |
378 | +++ b/ubuntu_stress_smoke_test/ubuntu_stress_smoke_test_cleanup.sh |
379 | @@ -0,0 +1,11 @@ |
380 | +#!/bin/bash |
381 | + |
382 | +# |
383 | +# Garbage collect swap file |
384 | +# |
385 | +SWPIMG=$PWD/swap.img |
386 | + |
387 | +swapoff ${SWPIMG} |
388 | +rm ${SWPIMG} |
389 | + |
390 | +exit $rc |
391 | diff --git a/ubuntu_stress_smoke_test/ubuntu_stress_smoke_test_init.sh b/ubuntu_stress_smoke_test/ubuntu_stress_smoke_test_init.sh |
392 | new file mode 100755 |
393 | index 0000000..0471fb7 |
394 | --- /dev/null |
395 | +++ b/ubuntu_stress_smoke_test/ubuntu_stress_smoke_test_init.sh |
396 | @@ -0,0 +1,47 @@ |
397 | +#!/bin/bash |
398 | + |
399 | +SYS_ZSWAP_ENABLED=/sys/module/zswap/parameters/enabled |
400 | + |
401 | +# |
402 | +# Try an ensure that this script and parent won't be oom'd |
403 | +# |
404 | +set_max_oom_level() |
405 | +{ |
406 | + if [ -e /proc/self/oom_score_adj ]; then |
407 | + echo -900 > /proc/self/oom_score_adj |
408 | + echo -900 > /proc/$PPID/oom_score_adj |
409 | + elif [ -e /proc/self/oom_adj ]; then |
410 | + echo -14 > /proc/self/oom_adj |
411 | + echo -14 > /proc/$PPID/oom_adj |
412 | + fi |
413 | + # |
414 | + # Ensure oom killer kills the stressor hogs rather |
415 | + # than the wrong random process (e.g. autotest!) |
416 | + # |
417 | + if [ -e /proc/sys/vm/oom_kill_allocating_task ]; then |
418 | + echo 0 > /proc/sys/vm/oom_kill_allocating_task |
419 | + fi |
420 | +} |
421 | + |
422 | +# |
423 | +# Always add 1GB of swap to ensure swapping is exercised |
424 | +# |
425 | +SWPIMG=$PWD/swap.img |
426 | + |
427 | +# |
428 | +# Create 1GB swap file |
429 | +# |
430 | +swapoff ${SWPIMG} >& /dev/null |
431 | +fallocate -l 1G ${SWPIMG} |
432 | +if [ $? -ne 0 ]; then |
433 | + echo "FAILED: Count not create 1GB swap file, file system:" |
434 | + df |
435 | + exit 1 |
436 | +fi |
437 | +chmod 0600 ${SWPIMG} |
438 | +mkswap ${SWPIMG} |
439 | +swapon ${SWPIMG} |
440 | + |
441 | +set_max_oom_level |
442 | +sleep 15 |
443 | +sync |
Hi Paolo, please find inline comments.
One side note.
I have this tested with Jammy kernel on openstack as well. The elapsed time will increase from 16 minutes to 90 minutes (provision will take about 8 minutes)
I think the bottleneck is swap on/off, the preparation for a single stressor will take about 15 seconds to run:
11:24:35 INFO | START ubuntu_ stress_ smoke_test. utime ubuntu_ stress_ smoke_test. utime timestamp= 1701861875 timeout=2100 localtime=Dec 06 11:24:35 ubuntu/ autotest/ client/ tests/ubuntu_ stress_ smoke_test/ ubuntu_ stress_ single_ smoke_test. sh utime' stress_ smoke_test. utime ubuntu_ stress_ smoke_test. utime timestamp= 1701861891 localtime=Dec 06 11:24:51 completed successfully
....
11:24:35 DEBUG| Running '/home/
....
11:24:50 DEBUG| [stdout] Tests took 0 seconds to run
11:24:51 INFO | GOOD ubuntu_
This can be treated as a follow-up after this commit.