Merge ~alextu/plainbox-provider-checkbox:test-cpu-pc10-by-turbostate into plainbox-provider-checkbox:master

Proposed by Alex Tu
Status: Work in progress
Proposed branch: ~alextu/plainbox-provider-checkbox:test-cpu-pc10-by-turbostate
Merge into: plainbox-provider-checkbox:master
Diff against target: 320 lines (+298/-0)
3 files modified
bin/check-turbostat-power-residency.sh (+165/-0)
units/power-management/jobs.pxu (+121/-0)
units/power-management/test-plan.pxu (+12/-0)
Reviewer Review Type Date Requested Status
Sylvain Pineau Needs Information
Jonathan Cave (community) Needs Fixing
You-Sheng Yang Approve
OEM Solutions Group: Engineers Pending
OEM Services QA Pending
Pierre Equoy Pending
StanleyHuang Pending
Gene Li Pending
Rex Tsai Pending
jeremyszu Pending
Checkbox Developers Pending
Review via email: mp+388726@code.launchpad.net

Commit message

    pick turbostate-long-idle-c10 test case from pc-sanity

    from https://git.launchpad.net/plainbox-provider-pc-sanity/tree/usr/share/plainbox-provider-checkbox/units/pc-sanity/pc-sanity-power-consumption.pxu

------

This test case is for power consumption checking.
The CPU package power state is expected to sleep deep to C10 in long idle otherwise it's mostly failed for e-star compliance.

To post a comment you must log in.
Revision history for this message
Alex Tu (alextu) wrote :

After this test case been merged.
The plan is to add this case into the somerville auto plan[1] because Dell platforms need e-star compliances.

[1] https://git.launchpad.net/oem-qa-checkbox/tree/units/somerville-addon.pxu

Revision history for this message
Ray Chen (ray.chen) wrote :

Just question, from https://trello.com/c/3C0b5Nkt and other related cards, Is this test would also apply to another PC-OEM project?

Revision history for this message
Alex Tu (alextu) wrote :

This test job is an automatic test case and should be included into projects those need e-star compliance.

to avoid confusing, I moved the URL of trello card to commit comment instead(just for tracker).

Revision history for this message
Jonathan Cave (jocave) wrote :

This breaks checkbox job writing rules in such a myriad of ways that I think listing them all here would not be productive. Hard no from me.

review: Disapprove
Revision history for this message
Alex Tu (alextu) wrote :

thanks for review, I'm following the suggestion to refine this case : https://chat.canonical.com/canonical/pl/wg1csztgtjn7mk1a7r1111uy8o

Revision history for this message
Alex Tu (alextu) wrote :

I refactored the code to adopt the policy, please review again.

the passed case for reference:
https://paste.ubuntu.com/p/7jdVmVRjC8/

the failed case for reference:
https://paste.ubuntu.com/p/QrCZQzDRyW/

btw, this automatic test case is also added to cpu-cert-automated plan which will be nested by other auto plan.

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Same here, too many violations (use of sudo, exit code not propagated, set -x instead of set -e, installation via apt, DISPLAY hardcoded, ...)

review: Disapprove
Revision history for this message
Alex Tu (alextu) wrote :

past the concern from reviewer here for reference:
1. installing linux-tools-"$(uname -r)" not work on the snap environment, so this case should be put into oem provider.
```
such requirement (linux-tools-5.6.0-1008-oem) will never work if checkbox is installed via snap. Or we need a new build of e.g cdts everytime a new kernel is published

at the same time making this kind of job deb only is not ideal
```
https://chat.canonical.com/canonical/pl/ctfx3gzd77gqxrdc7g4ass91sw

2. the sru pool as a wide range of cpu, some are really old. So, this new test case will always failed on those machines.
https://chat.canonical.com/canonical/pl/8wbj4h6wgjgtm8yf3he8fxb4hy

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

would be good to record the following setting to restore them after such test:

gsettings get org.gnome.desktop.screensaver lock-enabled
gsettings get org.gnome.desktop.session idle-delay

Once again I'm not entirely sure waiting 30s with running processes in the background can make the system going into C10

Revision history for this message
Alex Tu (alextu) wrote :

"Once again I'm not entirely sure waiting 30s with running processes in the background can make the system going into C10"
Ans : yes, that's the way we are currently counting on to catch the problematic CPU package which can not get into C10 during long idle. There's must be some blocking issue(Bug) if your machine can not get into long idle after set idle-delay to 10 then wait for 30s.

And I refined the logic to keep the idle-delay value and only restore it when there's a keeped one. BTW, lock-enable is not necessary during my testing.

For the concern of impact environment that checkbox run in snap,
per-talked with Rex that we should restrict this job to be only executed on classic environment to avoid impact the environment that running in snap.
Do we have a way to achieve it? by which 'requires:' value?

Revision history for this message
Alex Tu (alextu) wrote :

the message for test result for reference:
https://pastebin.ubuntu.com/p/zh5xVqnpN5/

log files in session folder:
ubuntu@dell-bto-focal-fossa-201810-26535:~$ cat /home/ubuntu/.cache/plainbox/sessions/checkbox-run-2020-08-25T03.26.21.session/CHECKBOX_DATA/turbostat-pkgpc-longidle.log | pastebinit
https://paste.ubuntu.com/p/4pf2j6GRGQ/

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :
Revision history for this message
Alex Tu (alextu) wrote :

I refactored this patch futher to cover both s2i and longidle.

Yes, KC discussed with me that we aligned that his case is to cover hardware capability by sys filesystem.

And mine is to cover the system level power consumption to make sure the system can pass e-star compliance.

Which is targeted to achieve this goal : https://docs.google.com/presentation/d/1KXBGWPg5_pVTzg-bxaE27PF7rzAdMS_esF-DO5k6woY/edit?ts=5f4d92fe#slide=id.g92ed89da92_0_14

Revision history for this message
Alex Tu (alextu) wrote :

ubuntu@dell-bto-focal-fossa-201810-26535:~$ DISPLAY=:0 checkbox-cli run com.canonical.certification::power-management/check-turbostat-long-idle-residency

https://pastebin.canonical.com/p/MDFXpnnvp5/

ubuntu@dell-bto-focal-fossa-201810-26535:~$ DISPLAY=:0 checkbox-cli run com.canonical.certification::power-management/check-turbostat-long-idle-residency

https://pastebin.canonical.com/p/ntzpZ5yMdR/

Revision history for this message
Alex Tu (alextu) wrote :
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

I still think your MR and KC's https://code.launchpad.net/~kchsieh/plainbox-provider-checkbox/+git/plainbox-provider-checkbox/+merge/390146 have redundancies in many places.

I'm not sure which method works the best to ensure that system can go into idle. KC is using
`xset dpms force off` but your job instead relies on `gsettings set org.gnome.desktop.session idle-delay`.

Which one is good, idk. Again I'm only evaluating your MP from the code perspective and compliance with checkbox. I'm not a PM expert.

One last thing I'd like to know, from the blog post you both linked it seems idle can be reached if NO usb devices are connected. won't be the case for most of SRU systems. I don't see such recommendation either in your job desc.

review: Needs Fixing
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :
Revision history for this message
Alex Tu (alextu) wrote :

As we explained that this this test case set higher bar to cover whole system behavior targeting to pass e-star compliance which all power states should stay stably in long idle and s2i.

The one from KC is just to check the capability of power state, say it's the 1st line checking hardware/driver capability. And mine is system stability.

So, KC's test can just counting on `xset dpms force off` to check the capability. And I choice `gsettings set org.gnome.desktop.session idle-delay` to simulate the system behavior.

I understand you have concern on the power management part, so I can invite HWE join this review.

For the 'Unplug USB devices.': yes, there might some problematic USB blocking power state. Because autosanity and QA will run this test without USB storage, so it's ok.
So, the plan would be land this test for autosnaiy, Canonical QA, ODM QA testing first. Then we think the solution before land it to SRU plan.

And thanks for the inline suggestion, I'll check it.

Revision history for this message
You-Sheng Yang (vicamo) :
review: Needs Fixing
Revision history for this message
Alex Tu (alextu) wrote :

thanks for your review and replied inline.
I will fix them later.

Revision history for this message
Alex Tu (alextu) wrote :

another job which also need linux-tools package, we might can share the same way installing linux-tools : https://code.launchpad.net/~alexhung/plainbox-provider-checkbox/+git/plainbox-provider-checkbox/+merge/391097

Revision history for this message
You-Sheng Yang (vicamo) wrote :

Didn't find something seriously wrong. Thank you.

review: Approve
Revision history for this message
Jonathan Cave (jocave) wrote :

Switching to work in progress. If the problems identified by the down voters are addressed then you may request reviews again.

Revision history for this message
Alex Tu (alextu) wrote :

refer to the experience of this test case on pc-sanity, the additional patches 77431a8 and 4613170 to make sure the test done on expected environment. They need additional resource from https://code.launchpad.net/~alextu/plainbox-provider-resource/+git/plainbox-provider-resource/+merge/395357

the 9438fae gives more instruction about the next step when this case failed.

Revision history for this message
Alex Tu (alextu) wrote :

Hi Sylvain,
Please help to review this MP, I mad it better base on pc-sanity experience.

The script checking turbostate result has been reviewed by Vicamo@HWE.

This test case is needed for the test upgrading oem kernel 5.6 to hwe
kernel 5.8 on machines in certification pool.

On Tue, Dec 15, 2020, 7:45 PM Alex Tu <email address hidden> wrote:

> Alex Tu has proposed merging
> ~alextu/plainbox-provider-checkbox:test-cpu-pc10-by-turbostate into
> plainbox-provider-checkbox:master.
>
> Commit message:
> pick turbostate-long-idle-c10 test case from pc-sanity
>
> from
> https://git.launchpad.net/plainbox-provider-pc-sanity/tree/usr/share/plainbox-provider-checkbox/units/pc-sanity/pc-sanity-power-consumption.pxu
>
> ------
>
> This test case is for power consumption checking.
> The CPU package power state is expected to sleep deep to C10 in long idle
> otherwise it's mostly failed for e-star compliance.
>
> Requested reviews:
> You-Sheng Yang (vicamo)
> Sylvain Pineau (sylvain-pineau)
> OEM Solutions Group: Engineers (oem-solutions-engineers)
> OEM Services QA (oem-qa)
> Pierre Equoy (pieq)
> StanleyHuang (stanley31)
> Jonathan Cave (jocave)
> Gene Li (genelicc)
> Rex Tsai (chihchun)
> jeremyszu (os369510)
> Checkbox Developers (checkbox-dev)
>
> For more details, see:
>
> https://code.launchpad.net/~alextu/plainbox-provider-checkbox/+git/plainbox-provider-checkbox/+merge/388726
> --
> You are the owner of
> ~alextu/plainbox-provider-checkbox:test-cpu-pc10-by-turbostate.
>

Revision history for this message
Jonathan Cave (jocave) wrote :

As far as I'm concerned it's still not ok to have a job install packages within the checkbox run. The user or the provisioning mechanism of the device should do this if it is required.

review: Needs Fixing
Revision history for this message
Alex Tu (alextu) wrote :

If we don't permit checkbox to install linux-tools-"$(uname -r)", then it will be a limitation that users need to manually install it before testing.

so far, this restriction block:
 - this MP
 - https://code.launchpad.net/~alexhung/plainbox-provider-checkbox/+git/plainbox-provider-checkbox/+merge/394155

But seems sylvain-pineau agreed that installation of linux-tools-"$(uname -r)" on another MP: https://code.launchpad.net/~alexhung/plainbox-provider-checkbox/+git/plainbox-provider-checkbox/+merge/394155 .

Do we have a consistent guild line for the policy of checkbox test cases? Or wiki for the policies?

Revision history for this message
Jonathan Cave (jocave) wrote :

> If we don't permit checkbox to install linux-tools-"$(uname -r)", then it will be a limitation that users need to manually install it before testing.

Yes, personally I prefer this. In my opinion the set of packages available is a piece of system state that is recorded by a resource job at the start of a checkbox session and should not be modified by checkbox during a session. This maintains the possible ways of dependencies being available as:

1) They are part of the os image by default
2) a. they are installed as a deb package dependency if checkbox is installed by deb
   b. they are included in the snap package as a stage-package or snapcarft part if checkbox is installed by snap
3) They are explicitly added prior the checkbox run by the user / automated provisioning system etc

For me adding a fourth option of allowing jobs to add packages mid session breaks "integrity" of information that checkbox gathers and includes in the submissions.

Revision history for this message
Maciej Kisielewski (kissiel) wrote :

I'm marking this MR as "work in progress", the reviews are in and we need to find a consensus.

Revision history for this message
Alex Tu (alextu) wrote :

Sorry for late response. It's quilt busy lately.
By following jocave's suggestion, I removed the installation of linux-tools and the require for "package.name == 'checkbox-ng'".

Thanks for reviewing and please review the latest change.

This is a test result:
https://pastebin.canonical.com/p/tVHdXXtVJ8/

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

One small issue wit the test plan.

Review of the core script will take more time

review: Needs Fixing
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Does the new version runs using checkbox remote?

Are you still planning to run this nested test plan as part of kernel SRU testing?

review: Needs Information
Revision history for this message
Alex Tu (alextu) wrote :

Yes, all the verification of this MP are on checkbox remote, and this is another one after removing 'device' from `power-turbostat-residency-automated`

Yes, the 1st step we are doing is always include this case during new machine enablement.
Then we can include it to Kernel SRU when we feel it's stable enough.

So, after this MP merged, we are able to ask ODM do the test on their machines to capture more data.

And SRU Jenkins script can also try this plan so that we can see how it goes on certification pool.

For the core script, I know it's not that easy for you review. So, I call help to You-Sheng Yang(Vicamo)@HWE and he approved that as well(see the comment above).

ea683da... by Alex Tu

removed non-necessary id from power-turbostat-residency-automated

Revision history for this message
Alex Tu (alextu) wrote :

the test result from checkbox remote
https://paste.ubuntu.com/p/TfJtSkX9Qz/

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

I've reviewed the execution from the pastebin link above.

com.canonical.certification::miscellanea/install_kernel_tools does not exist in our current providers. where does it come from?

Unfortunately, one of the first dependency failed: com.canonical.certification::power-management/cpu-low-power-idle

Was it expected? I'd prefer a run where all tests are passing of course.

Next a couple of remarks regarding the depends fields of your new jobs. Some don't have any where others can have up to 3 job requirements. I'd help to have a clear answer here as I'd expect gfxrc6 related jobs to be skipped too (I can be wrong of course). Could you confirm the expected behavior, with cpu-low-power-idle failed is it normal to still run residency tests?

review: Needs Information
Revision history for this message
OEM Taipei Bot (oem-taipei-bot) wrote :

[BOT]
$ cat plainbox-provider-checkbox-0.59.0-1-ea683da-in-linux-container-focal-summary.log
bootstrap-client-cert-desktop-20-04-automated FAIL stderr: unable to find nested part: com.canonical.certification::submission-cert-automated
https://oem-share.canonical.com/share/lyoncore/artifacts/plainbox-provider-checkbox-0.59.0-1-ea683da-in-linux-container-focal

Revision history for this message
OEM Taipei Bot (oem-taipei-bot) wrote :

Execute `curl -X POST http://10.102.135.31/api/v1/teams/self-contained/pipelines/plainbox-provider-checkbox/resources/merge-proposal-388726/check/webhook?webhook_token=merge-proposal-388726` within TW VPN to restart the test.
[autopkgtest]
$ cat plainbox-provider-checkbox-0.59.0-1-ea683da-in-linux-container-focal-summary.log
bootstrap-client-cert-desktop-20-04-automated FAIL stderr: unable to find nested part: com.canonical.certification::submission-cert-automated
https://oem-share.canonical.com/partners/lyoncore/share/artifacts/plainbox-provider-checkbox-0.59.0-1-ea683da-in-linux-container-focal

Unmerged commits

ea683da... by Alex Tu

removed non-necessary id from power-turbostat-residency-automated

38a2e06... by Alex Tu

follow the suggestion from reviewer.

https://code.launchpad.net/~alextu/plainbox-provider-checkbox/+git/plainbox-provider-checkbox/+merge/388726/comments/1042378

0297d6d... by Alex Tu

changed the way to enter long idle by xset dpms

The original way to simulate system get into long idle without
interactive for a while works on local run or ssh run checkbox. But
failed on checkbox remote.

So far, looks xset dpms get the same result, so I give up the original
way and move to xset dkms instead.

06ae2f0... by Alex Tu

preserve the turbostate log for s2i

07b3e3f... by Alex Tu

changed the way using sleep.mem_sleep

c2244e5... by Alex Tu

giving more tips for the failure of turbostat case.

cherry-pick 8873f8f from plainbox-provider-pc-sanity

4613170... by Alex Tu

restric turbostate tests to system that supported.

and update the automatic plan as well

77431a8... by Alex Tu

to check one residency in one job

decfec2... by Alex Tu

refactor and fixed things according to reviewer's suggestion.

46cda33... by Alex Tu

remove xte and add a automated plan to cover all jobs

and update readme of check-turbostat-power-residency.sh

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/check-turbostat-power-residency.sh b/bin/check-turbostat-power-residency.sh
2new file mode 100755
3index 0000000..627f804
4--- /dev/null
5+++ b/bin/check-turbostat-power-residency.sh
6@@ -0,0 +1,165 @@
7+#!/bin/bash
8+
9+#refer to https://01.org/blogs/qwang59/2020/linux-s0ix-troubleshooting
10+set -e
11+result="pass"
12+command -v turbostat || exit 1
13+
14+TARGET_STATS="GFX%rc6,Pkg%pc2,Pkg%pc3,Pkg%pc6,Pkg%pc7,Pkg%pc8,Pkg%pc9,Pk%pc10,SYS%LPI"
15+declare -A stats_p
16+declare -A avg_criteria
17+op_mode="short-idle"
18+custom_avg_criteria="true"
19+i=0
20+for s in ${TARGET_STATS//,/ }; do
21+ stats_p[$i]="$s"
22+ avg_criteria["$s"]=0
23+ i=$((i+1))
24+done
25+
26+usage() {
27+cat << EOF
28+usage: $(basename "$0") options [--output-directory <target-folder-for-turbostat-log>] [--op-mode <expected-operation-mode-of-e-star>]
29+
30+This tool will run turbostat and check if the power state meet our requirement.
31+Most of operations are need root permission.
32+The generated turbostat log will be put in <target-folder-for-turbostat-log>/turbostat-<expected-operation-mode-of-e-star>.log"
33+
34+ -h|--help Print this message
35+ --output-directory
36+ Sepcify the path of folder that you want to store turbostat logs. The default one is /tmp
37+ -f Read external turbostat log instead of doing turbostat.; do not need root permission.
38+
39+ Please get log by this command:
40+ turbostat --out external-log --show GFX%rc6,Pkg%pc2,Pkg%pc3,Pkg%pc6,Pkg%pc7,Pkg%pc8,Pkg%pc9,Pk%pc10,SYS%LPI
41+ Then:
42+ $(basename "$0") -f path-to-external-log
43+
44+ --op-mode The expected operation mode defined by e-star spec. The valuse could be short-idle, long-idle or sleep-mode
45+ It will be appended to the file name of the generated turbostat log file. If value is sleep-mode, this
46+ script will call turbostat with rtcwake to put system to s2i mode.
47+ The default is short-idle.
48+
49+ Usage:
50+ $(basename "$0") --op-mode sleep-mode ; # Enter s2i then get turbostat value
51+
52+ $(basename "$0") --op-mode long-idle ; # You execute $(basename "$0") during system in long-idle.
53+
54+ --stat Check if stat matchs expected percentage.
55+
56+ Usage: $(basename "$0") --stat [stat:percentage]
57+
58+ State could be GFX%rc6, Pk%pc10 or SYS%LPI
59+ e.g. $(basename "$0") --stat Pk%pc10:60 --stat SYS%LPI:70
60+EOF
61+exit 1
62+}
63+
64+while [ $# -gt 0 ]
65+do
66+ case "$1" in
67+ -h | --help)
68+ usage 0
69+ exit 0
70+ ;;
71+ --op-mode)
72+ shift
73+ op_mode="$1";
74+ ;;
75+ --folder)
76+ shift
77+ [ -d "$1" ] || (echo "[ERROR] not exists folder $1" && usage)
78+ session_folder=$1;
79+ ;;
80+ -f)
81+ shift
82+ if [ -f "$1" ]; then
83+ EX_FILE="$1";
84+ else
85+ echo"[ERROR] $1 is not there."
86+ usage
87+ fi
88+ ;;
89+ --stat)
90+ shift
91+ [ -z "${TARGET_STATS##*${1%%:*}*}" ] || (echo "[ERROR] illegle parameter $1" && usage)
92+ avg_criteria["${1%%:*}"]="${1##*:}"
93+ custom_avg_criteria="true"
94+ ;;
95+ *)
96+ usage
97+ esac
98+ shift
99+done
100+
101+if [ "$custom_avg_criteria" != "true" ]; then
102+ avg_criteria["GFX%rc6"]=50
103+ avg_criteria["Pk%pc10"]=80
104+ avg_criteria["SYS%LPI"]=70
105+fi
106+
107+[ -n "$session_folder" ] || session_folder="/tmp"
108+
109+STAT_FILE="$session_folder/turbostat-$op_mode.log"
110+
111+require_root(){
112+ if [ "$(id -u)" != "0" ]; then
113+ >&2 echo "[ERROR]need root permission"
114+ usage
115+ fi
116+}
117+
118+if [ -n "$EX_FILE" ]; then
119+ cp "$EX_FILE" "$STAT_FILE"
120+elif [ "$op_mode" == "sleep-mode" ]; then
121+ require_root
122+ echo "[INFO] getting turbostat log. Please wait for 60s"
123+ turbostat --out "$STAT_FILE" --show $TARGET_STATS rtcwake -m freeze -s 60
124+else
125+ require_root
126+ echo "[INFO] getting turbostat log. Please wait for about 120s"
127+ # turbostat take 3-4 secs per iteration
128+ turbostat --num_iterations 30 --out "$STAT_FILE" --show $TARGET_STATS
129+fi
130+i=0
131+while read -r avg; do
132+ if [ "${avg_criteria[${stats_p[$i]}]}" != "0" ]; then
133+ echo "[INFO] checking if ${stats_p[$i]}($avg%) >= ${avg_criteria[${stats_p[$i]}]}%"
134+ if [ "$(bc <<< "$avg >= ${avg_criteria[${stats_p[$i]}]}")" == "1" ]; then
135+ echo "Passed."
136+ else
137+ >&2 echo "Failed" "avg $i : $avg NOT >= ${avg_criteria[${stats_p[$i]}]} "
138+ result="failed"
139+ fi
140+ fi
141+ i=$((i+1));
142+done< <(grep -v "[a-zA-Z]" "$STAT_FILE" | awk '
143+BEGIN { max = 0 }
144+{
145+ if (NF > max) max = NF;
146+ for (i = 1; i <= NF; i++)
147+ {
148+ a[i] = a[i] + $i;
149+ }
150+}
151+END {
152+ for (i = 1; i <= max; i++)
153+ {
154+ if (a[i] > 1 ) print a[i] / NR;
155+ else print 0
156+ }
157+}
158+')
159+
160+if [ "$result" != "pass" ]; then
161+ echo "Your system not get Intel CPU PC10 or s0ix as expected, it could impact e-star compliance."
162+ echo "If the following test cases not run, that means your CPU architure or kernel driver not support PC10 or s0ix, please open bugs for HWE"
163+ echo " - power-management/cpu-low-power-idle"
164+ echo " - power-management/system-low-power-idle executed and passed."
165+ echo "Otherwise, please get PHM report to check which device blocking PC10 or s0ix and open bugs for HWE to check kernel modules"
166+ echo ""
167+ echo "reference:"
168+ echo " - https://01.org/blogs/qwang59/2020/linux-s0ix-troubleshooting"
169+ echo " - https://01.org/blogs/qwang59/2018/how-achieve-s0ix-states-linux"
170+ exit 1
171+fi
172diff --git a/units/power-management/jobs.pxu b/units/power-management/jobs.pxu
173index d2ef21b..b0c41da 100644
174--- a/units/power-management/jobs.pxu
175+++ b/units/power-management/jobs.pxu
176@@ -451,3 +451,124 @@ _steps:
177 _verification:
178 Did the Ambient Light Sensor values change when you shaking your hands over the sensor?
179 Did the Screen backlight also changed?
180+
181+plugin: shell
182+category_id: com.canonical.plainbox::power-management
183+id: power-management/turbostat_long_idle_result
184+estimated_duration: 90s
185+user: root
186+requires:
187+ executable.name == 'turbostat'
188+command:
189+ echo "Saving cpu package state tracking in $PLAINBOX_SESSION_SHARE/turbostat-long-idle.log and package_cstate_show"
190+ xset dpms force off
191+ check-turbostat-power-residency.sh --op-mode long-idle --folder "$PLAINBOX_SESSION_SHARE" --stat Pk%pc10:0 > /dev/null
192+ xset dpms force off
193+_summary: Get tubostate result from long idle.
194+_description:
195+ get turbo state result from long idle so that we can know cpu pkg power status. The turbostat tool is suggested by HWE. Also provide package_state_show for debug reference.
196+ This test will generate a turbostat log under "$PLAINBOX_SESSION_SHARE".
197+
198+plugin: shell
199+category_id: com.canonical.plainbox::power-management
200+id: power-management/check-turbostat-long-idle-cpu-residency
201+requires:
202+ lsb.release >= "20.04"
203+estimated_duration: 2s
204+depends:
205+ power-management/cpu-low-power-idle
206+ power-management/turbostat_long_idle_result
207+command:
208+ [ -f "$PLAINBOX_SESSION_SHARE"/idle-delay.orig ] && gsettings set org.gnome.desktop.session idle-delay $(cat "$PLAINBOX_SESSION_SHARE"/idle-delay.orig)
209+ check-turbostat-power-residency.sh -f "$PLAINBOX_SESSION_SHARE"/turbostat-long-idle.log --stat Pk%pc10:70
210+_summary: Check expected CPU power stat residency in long-idle.
211+_description:
212+ check expected CPU power stat residency in long idle by by turbostat which HWE suggested and also provide package_state_show for debug reference.
213+ This test job is an automatic test case and should be included into projects those need e-star compliance.
214+
215+plugin: shell
216+category_id: com.canonical.plainbox::power-management
217+id: power-management/check-turbostat-long-idle-s0ix-residency
218+requires:
219+ lsb.release >= "20.04"
220+estimated_duration: 2s
221+depends:
222+ power-management/cpu-low-power-idle
223+ power-management/system-low-power-idle
224+ power-management/turbostat_long_idle_result
225+command:
226+ [ -f "$PLAINBOX_SESSION_SHARE"/idle-delay.orig ] && gsettings set org.gnome.desktop.session idle-delay $(cat "$PLAINBOX_SESSION_SHARE"/idle-delay.orig)
227+ check-turbostat-power-residency.sh -f "$PLAINBOX_SESSION_SHARE"/turbostat-long-idle.log --stat SYS%LPI:70
228+_summary: Check expected s0ix power stat residency in long-idle.
229+_description:
230+ check expected s0ix power stat residency in long idle by by turbostat which HWE suggested and also provide package_state_show for debug reference.
231+ This test job is an automatic test case and should be included into projects those need e-star compliance.
232+
233+plugin: shell
234+category_id: com.canonical.plainbox::power-management
235+id: power-management/check-turbostat-long-idle-gfxrc6-residency
236+requires:
237+ lsb.release >= "20.04"
238+ device.driver == 'i915'
239+estimated_duration: 2s
240+depends:
241+ power-management/turbostat_long_idle_result
242+command:
243+ [ -f "$PLAINBOX_SESSION_SHARE"/idle-delay.orig ] && gsettings set org.gnome.desktop.session idle-delay $(cat "$PLAINBOX_SESSION_SHARE"/idle-delay.orig)
244+ check-turbostat-power-residency.sh -f "$PLAINBOX_SESSION_SHARE"/turbostat-long-idle.log --stat GFX%rc6:90
245+_summary: Check expected GFXRC6 power stat residency in long-idle.
246+_description:
247+ check expected GFXRC6 power stat residency in long idle by by turbostat which HWE suggested and also provide package_state_show for debug reference.
248+ This test job is an automatic test case and should be included into projects those need e-star compliance.
249+
250+plugin: shell
251+category_id: com.canonical.plainbox::power-management
252+id: power-management/check-turbostat-s2i-cpu-residency
253+estimated_duration: 90s
254+user: root
255+requires:
256+ lsb.release >= "20.04"
257+ sleep.mem_sleep == 's2idle'
258+depends:
259+ power-management/cpu-low-power-idle
260+command:
261+ check-turbostat-power-residency.sh --folder "$PLAINBOX_SESSION_SHARE" --op-mode sleep-mode --stat Pk%pc10:70
262+_summary: Check expected CPU power stat residency in suspend to idle(s2i).
263+_description:
264+ check expected CPU power stat residency in suspend to idle(s2i) by turbostat which HWE suggested and also provide package_state_show for debug reference.
265+ This test job is an automatic test case and should be included into projects those need e-star compliance.
266+
267+plugin: shell
268+category_id: com.canonical.plainbox::power-management
269+id: power-management/check-turbostat-s2i-s0ix-residency
270+estimated_duration: 90s
271+user: root
272+requires:
273+ lsb.release >= "20.04"
274+ sleep.mem_sleep == 's2idle'
275+depends:
276+ power-management/cpu-low-power-idle
277+ power-management/system-low-power-idle
278+command:
279+ check-turbostat-power-residency.sh --folder "$PLAINBOX_SESSION_SHARE" --op-mode sleep-mode --stat SYS%LPI:70
280+_summary: Check expected s0ix power stat residency in suspend to idle(s2i).
281+_description:
282+ check expected s0ix power stat residency in suspend to idle(s2i) by turbostat which HWE suggested and also provide package_state_show for debug reference.
283+ This test job is an automatic test case and should be included into projects those need e-star compliance.
284+
285+plugin: shell
286+category_id: com.canonical.plainbox::power-management
287+id: power-management/check-turbostat-s2i-gfxrc6-residency
288+estimated_duration: 90s
289+user: root
290+requires:
291+ lsb.release >= "20.04"
292+ device.driver == 'i915'
293+ sleep.mem_sleep == 's2idle'
294+ executable.name == 'turbostat'
295+command:
296+ check-turbostat-power-residency.sh --folder "$PLAINBOX_SESSION_SHARE" --op-mode sleep-mode --stat GFX%rc6:90
297+_summary: Check expected GFXRC6 power stat residency in suspend to idle(s2i).
298+_description:
299+ check expected GFXRC6 power stat residency in suspend to idle(s2i) by turbostat which HWE suggested and also provide package_state_show for debug reference.
300+ This test job is an automatic test case and should be included into projects those need e-star compliance.
301diff --git a/units/power-management/test-plan.pxu b/units/power-management/test-plan.pxu
302index 8391bca..ce5ce7d 100644
303--- a/units/power-management/test-plan.pxu
304+++ b/units/power-management/test-plan.pxu
305@@ -86,3 +86,15 @@ _description: Manual power tests for Snappy Ubuntu Core devices
306 include:
307 power-management/poweroff-manual
308 power-management/reboot-manual
309+
310+id: power-turbostat-residency-automated
311+unit: test plan
312+_name: Check turbostate residency (automated)
313+_description:
314+include:
315+ power-management/check-turbostat-long-idle-cpu-residency
316+ power-management/check-turbostat-long-idle-s0ix-residency
317+ power-management/check-turbostat-long-idle-gfxrc6-residency
318+ power-management/check-turbostat-s2i-cpu-residency
319+ power-management/check-turbostat-s2i-s0ix-residency
320+ power-management/check-turbostat-s2i-gfxrc6-residency

Subscribers

People subscribed via source and target branches