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

Optimize this case to support all the PCM #758

Closed
wants to merge 3 commits into from
Closed

Optimize this case to support all the PCM #758

wants to merge 3 commits into from

Conversation

1994lwz
Copy link

@1994lwz 1994lwz commented Aug 31, 2021

Rename the case check-pause-suspend-resume-release.sh to check-pause-suspend-resume-release.sh.

And optimize this case to support all the PCM.

Signed-off-by: VickyX_Intel_Ubuntu [email protected]

…end-resume-release.sh.

And optimize this case to support all the PCM.

Signed-off-by: VickyX_Intel_Ubuntu <[email protected]>
@1994lwz 1994lwz requested a review from a team as a code owner August 31, 2021 07:22
Copy link
Collaborator

@fredoh9 fredoh9 left a comment

Choose a reason for hiding this comment

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

commit text has typos. Need more information about this change


rm -rf /tmp/sof-test.lock
rm -rf /tmp/sof-test.lock
Copy link
Collaborator

Choose a reason for hiding this comment

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

who will create /tmp/sof-test.lock?

Copy link
Author

Choose a reason for hiding this comment

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

After verification, this code is useless, I will delete it.

@@ -146,7 +145,7 @@ expect {
}

#enter suspend-resume cycle once per pause instance
set retval [catch { exec bash check-suspend-resume.sh -l 1 } msg]
set retval [catch { exec bash /home/ubuntu/sof-test/test-case/check-suspend-resume.sh -l 1 } msg]
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 hard coded path, can we use BASH_SOURCE[0] in expect?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed, /home/ubuntu/ is not going to work for most people. It worked with a relative path before, what changed?

Copy link
Author

Choose a reason for hiding this comment

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

I will change the code and use the BASH_SOURCE[0] to get the dirname.

@fredoh9 fredoh9 requested review from marc-hb and a team August 31, 2021 16:03
@fredoh9
Copy link
Collaborator

fredoh9 commented Aug 31, 2021

Since you are touching this file, some of shellcheck errors/warnings are easy to fix.

Copy link
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

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

Rename the case check-pause-suspend-resume-release.sh to check-pause-suspend-resume-release.sh.

(same name)

File renames are very painful because they can cause endless version control issues. Is this rename really necessary? I see no justification for it in the commit message.

If the rename is absolutely necessary, do the rename in a separate commit that only renames the file, this helps git identify the rename and reduces version control issues a little bit.

Optimize this case to support all the PCM #758

This is not an optimization. An optimization does the same thing faster or better in some way. This is adding a new feature: iterating no all PCMs (the same way as before).

fi
sof-kernel-log-check.sh "$KERNEL_CHECKPOINT"
exit $?
ret=$?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Either you don't change that unrelated part of the code to minimize the size of the commit, or you change it and then you go all the way and fix the most obvious shellcheck warnings too (in a separate commit). Don't stop in the middle of the bridge.

Copy link
Author

Choose a reason for hiding this comment

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

About the rename, because the original name is check-pause-release-suspend-resume.sh, it does not represent the test that our case will be done, so I changed it to check-pause-suspend-resume-release.sh. I will raise a PR to change the case name.

exit $ret
fi
sof-kernel-log-check.sh "$KERNEL_CHECKPOINT" || die "Caught error in kernel log"
#exit $?
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you think it's really useful to leave code commented out, add a comment explaining why.

Copy link
Author

Choose a reason for hiding this comment

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

delete the #exit $?

@@ -146,7 +145,7 @@ expect {
}

#enter suspend-resume cycle once per pause instance
set retval [catch { exec bash check-suspend-resume.sh -l 1 } msg]
set retval [catch { exec bash /home/ubuntu/sof-test/test-case/check-suspend-resume.sh -l 1 } msg]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed, /home/ubuntu/ is not going to work for most people. It worked with a relative path before, what changed?

# expect is tcl language script
# catch: Evaluate script and trap exceptional returns
# after ms: Ms must be an integer giving a time in milliseconds.
# The command sleeps for ms milliseconds and then returns.
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you change the indentation then take that opportunity to use more shell functions, see why in #740 . One of the function should be something like test_single_pcm()

VickyX_Intel_Ubuntu added 2 commits September 1, 2021 10:10
Signed-off-by: VickyX_Intel_Ubuntu <[email protected]>
… be done.

Rename the case name to check-pause-suspend-resume-release.sh.

Signed-off-by: VickyX_Intel_Ubuntu <[email protected]>
Copy link
Collaborator

@marc-hb marc-hb left a comment

Choose a reason for hiding this comment

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

This PR is completely broken now, abandon this PR and start a new one.

The first commit still has a rename and code change in a single commit.
The second commit has a bit of code but does NOT add the for loop contrary to its commit message
The third commit does a second rename.

This is actually a good demonstration that renames always make version control much harder. A rename will also break any other script or CI engine that relies on the old name. I bet the new name is better but it's not so much better that it's worth these hassles, so forget about the rename for now.

Please also fix your git config to have your real name in the Signed-off field.

Screenshot 2021-09-01 at 13 14 04

@1994lwz 1994lwz closed this Sep 2, 2021
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.

3 participants