Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some issues related with the test case power-management/lid_close_suspend_open (Bugfix) #1093

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

eugene-yujinwu
Copy link
Contributor

Fix some issues related with the test case power-management/lid_close_suspend_open (bugfix) (#1080)

  • Include a note to ensure the test is executed at the appropriate time
  • Fix the typo in the test order number
  • Remove functionally similar test cases power-management/lid from the test plan
  • Adjust the place of test case to avoid running it just after the suspend case

Description

Resolved issues

Documentation

Tests

Copy link

codecov bot commented Mar 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.48%. Comparing base (4020cd1) to head (f1f03f9).

Current head f1f03f9 differs from pull request most recent head ab7d95c

Please upload reports for the commit ab7d95c to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1093      +/-   ##
==========================================
- Coverage   43.38%   41.48%   -1.91%     
==========================================
  Files         357      341      -16     
  Lines       38686    37754     -932     
  Branches     6561     6412     -149     
==========================================
- Hits        16784    15661    -1123     
- Misses      21238    21451     +213     
+ Partials      664      642      -22     
Flag Coverage Δ
provider-base 15.26% <ø> (-1.51%) ⬇️
provider-genio ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eugene-yujinwu eugene-yujinwu changed the title Fix some issues related with the test case power-management/lid_close_suspend_open (bugfix) (#1080) Fix some issues related with the test case power-management/lid_close_suspend_open (Bugfix) Mar 20, 2024
(Please wait at least 30 seconds after resuming from sleep before running this test. In most cases,
systemd will hold off on reacting to lid events in a period of time after system startup or resume.)
1. Press "Enter" to start the test.
2. Close the lid (Please close the lid within 10 sec).
3. Wait 5 seconds with the lid closed.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a bit confuse to me that the waiting time is not match in step 3 and the above notes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stanley31huang Thanks for comment. They are different time, the time mentioned in the notes is the time should wait to run this test if system just resume from suspend. The time in step 3 is the time to close the lid. It's maybe really a bit confusing, I'm not sure how to make it a little more clear. Any suggestion are welcome.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that we could simply write a scripts to check if current time is too close to previous suspend process.
If previous suspend process within 30 seconds, Ask user to wait a period of time and then close the lid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good idea. But I don't know how to get the how long the last suspend time to now. Do you have any idea about that? Thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the scripts will make sure the system is ready for suspend test, we need to modify the steps here.

@stanley31huang
Copy link
Collaborator

@eugene-yujinwu please remove the latest white space character from the title for the validate_title check.

@eugene-yujinwu eugene-yujinwu changed the title Fix some issues related with the test case power-management/lid_close_suspend_open (Bugfix) Fix some issues related with the test case power-management/lid_close_suspend_open (Bugfix) Mar 21, 2024
@eugene-yujinwu
Copy link
Contributor Author

@eugene-yujinwu please remove the latest white space character from the title for the validate_title check.

Done. Thanks!

@clairlin53
Copy link
Contributor

@eugene-yujinwu
I recommend keeping the second times with lid test, there were some issues observed with lid close after second times and there is an issue when closing the lid over 10 seconds, please refer to the following bugs for more details.
https://bugs.launchpad.net/stella/+bug/1974120
https://bugs.launchpad.net/stella/+bug/1979038
https://bugs.launchpad.net/stella/+bug/1962826

@eugene-yujinwu
Copy link
Contributor Author

eugene-yujinwu commented Mar 22, 2024

@eugene-yujinwu I recommend keeping the second times with lid test, there were some issues observed with lid close after second times and there is an issue when closing the lid over 10 seconds, please refer to the following bugs for more details. https://bugs.launchpad.net/stella/+bug/1974120 https://bugs.launchpad.net/stella/+bug/1979038 https://bugs.launchpad.net/stella/+bug/1962826

@clairlin53 Thank you for your comment. I think it makes sense to keep this case, as shown by the bugs you mentioned , we have indeed encountered situations in the past where the first close lid worked fine, but the second close lid had a problem.
I will add it back. Thank you.

@eugene-yujinwu
Copy link
Contributor Author

Add the power-management/lid test back per Clair's comments.

@eugene-yujinwu
Copy link
Contributor Author

Reopen it. Thank @vincent!

@hanhsuan
Copy link
Contributor

@eugene-yujinwu I am thinking about that the 30 seconds is the default value defined in the logind.conf by HoldoffTimeoutSec. Is that possible to show the real value while this test case at beginning ? Then the user don't have to guess how long they have to wait for next test.

@eugene-yujinwu eugene-yujinwu marked this pull request as draft April 17, 2024 06:29
if [ "$holdoff_timeout_sec" -ne 0 ]; then
while (journalctl --since "$holdoff_timeout_sec seconds ago" -b 0 -r | grep "suspend exit" >/dev/null 2>&1)
do
echo "The system just resume from suspend, please wait for $holdoff_timeout_sec seconds and continue the test"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $holdoff_timeout_sec is never changed during the loop, it would be better to echo just once at beginning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hanhsuan A new commit was pushed, please kindly help review it. Many thanks!

do
echo "waiting... "
sleep 3
done
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of having a while loop to polling the journal logs, I would suggest we simply sleep within a period of time if needed, likes

previous_sleep_log=$(journalctl --output=short-unix --since "$holdoff_timeout_sec seconds ago" -b 0 -r | grep "suspend exit")
if [ "$holdoff_timeout_sec" -ne 0 and "$previous_sleep_log" -ne "" ]; then
    # set the previous_sleep_time
    previous_sleep_time=$(echo $previous_sleep_log | awk -F'.' '{ print $1 }')
    # sleep a period of time
    sleep_time=$(( $(date +"%s") - "$previous_sleep_time" ))
    echo "sleep for $sleep_time seconds ..."
    sleep "$sleep_time"
fi
echo "System is ready for suspend test"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stanley31huang a new commit was pushed per this advise. Just a little change. Please have a look when you have time. thanks a lot.

…_suspend_open (bugfix) (canonical#1080)

- Include a note to ensure the test is executed at the appropriate time
- Fix the typo in the test order number
- Remove functionally similar test cases power-management/lid from the test plan
- Adjust the place of test case to avoid running it just after the suspend case
Co-authored-by: stanley31huang <stanley.huang@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants