1f08c3bdfSopenharmony_ciTestcase 03
2f08c3bdfSopenharmony_ci-----------
3f08c3bdfSopenharmony_ci
4f08c3bdfSopenharmony_ciThis test verifies that when you online a new CPU, that the scheduler
5f08c3bdfSopenharmony_citakes advantage of it by shifting some of its workloads onto it.  We do
6f08c3bdfSopenharmony_cithis by offlining a CPU, creating a bunch of processor intensive
7f08c3bdfSopenharmony_ciprocesses, and then onlining the CPU, and checking to make sure at least
8f08c3bdfSopenharmony_cione of the processes moved to that CPU.
9f08c3bdfSopenharmony_ci
10f08c3bdfSopenharmony_ci
11f08c3bdfSopenharmony_ciAlgorithm
12f08c3bdfSopenharmony_ci=========
13f08c3bdfSopenharmony_ciGiven a CPU to test that exists
14f08c3bdfSopenharmony_ci
15f08c3bdfSopenharmony_ciTake a snapshot of what CPUs are on and off initially
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_ciLoop until done:
18f08c3bdfSopenharmony_ci  Online all of the CPUs and note their state
19f08c3bdfSopenharmony_ci
20f08c3bdfSopenharmony_ci  Offline the specified CPU
21f08c3bdfSopenharmony_ci
22f08c3bdfSopenharmony_ci  Start up a number of processes equal to twice the number of CPUs we
23f08c3bdfSopenharmony_ci  have, so we can be pretty sure that we've got enough processes that at
24f08c3bdfSopenharmony_ci  least one will migrate to the new CPU.
25f08c3bdfSopenharmony_ci
26f08c3bdfSopenharmony_ci  Now online the specified CPU
27f08c3bdfSopenharmony_ci
28f08c3bdfSopenharmony_ci  Wait a few seconds, to allow the process scheduler to move processes
29f08c3bdfSopenharmony_ci  around a bit.
30f08c3bdfSopenharmony_ci
31f08c3bdfSopenharmony_ci  Verify that at least one process has migrated to the new CPU by
32f08c3bdfSopenharmony_ci  looking at the output from 'ps -o psr -o com' and searching for our
33f08c3bdfSopenharmony_ci  CPU running the process.
34f08c3bdfSopenharmony_ci
35f08c3bdfSopenharmony_ci
36f08c3bdfSopenharmony_ciWhen exiting:
37f08c3bdfSopenharmony_ci  Kill all of the load processes
38f08c3bdfSopenharmony_ci
39f08c3bdfSopenharmony_ci  Restore all CPUs to their initial state
40