Repository navigation
Case: add stress reboot test-case #6
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,94 @@ | ||||||
| #!/bin/bash | ||||||
|
|
||||||
| ## | ||||||
| ## Case Name: stress test reboot | ||||||
| ## Preconditions: | ||||||
| ## N/A | ||||||
| ## Description: | ||||||
| ## run reboot for the stress test | ||||||
| ## default duration is 10s | ||||||
| ## default loop count is 3 | ||||||
| ## Case step: | ||||||
| ## 1. check system status is correct | ||||||
| ## 2. wait for the Random value | ||||||
| ## 3. trigger for the reboot | ||||||
| ## Expect result: | ||||||
| ## Test execute without report error in the LOG | ||||||
| ## | ||||||
|
|
||||||
| source $(dirname ${BASH_SOURCE[0]})/../case-lib/lib.sh | ||||||
|
|
||||||
| OPT_OPT_lst['l']='loop' OPT_DESC_lst['l']='loop count' | ||||||
| OPT_PARM_lst['l']=1 OPT_VALUE_lst['l']=5 | ||||||
|
|
||||||
| func_opt_parse_option $* | ||||||
|
|
||||||
| func_lib_check_sudo | ||||||
| func_lib_trigger_stress | ||||||
|
|
||||||
| loop_count=${OPT_VALUE_lst['l']} | ||||||
|
|
||||||
| [[ $loop_count -le 0 ]] && exit 0 | ||||||
| # write the orig & status count to the status file | ||||||
| echo $loop_count >> $STRESS_STATUS_LOG | ||||||
| count=$(head -n 1 $STRESS_STATUS_LOG|awk '{print $1;}') | ||||||
| # because write record by desc | ||||||
| current=$[ $count - $loop_count + 1 ] | ||||||
|
|
||||||
| dlogi "Round: $current/$count"|tee -a $STRESS_OUTPUT_LOG | ||||||
|
|
||||||
| # verify-pcm-list.sh & verify-tplg-binary.sh need TPLG file | ||||||
| export TPLG=$(sof-get-default-tplg.sh) | ||||||
|
|
||||||
| declare -a verify_lst | ||||||
| verify_lst=(${verify_lst[*]} "verify-firmware-presence.sh") | ||||||
| verify_lst=(${verify_lst[*]} "verify-kernel-module-load-probe.sh") | ||||||
| verify_lst=(${verify_lst[*]} "verify-pcm-list.sh") | ||||||
| verify_lst=(${verify_lst[*]} "verify-sof-firmware-load.sh") | ||||||
| verify_lst=(${verify_lst[*]} "verify-tplg-binary.sh") | ||||||
|
|
||||||
| # here will write double line into $STRESS_OUTPUT_LOG | ||||||
| # because for the 1st round those information write by nohup command redirect | ||||||
| # but after system reboot the nohup redirect is missing | ||||||
| dlogi "Check status begin"|tee -a $STRESS_OUTPUT_LOG | ||||||
| for i in ${verify_lst[*]} | ||||||
| do | ||||||
| $(dirname ${BASH_SOURCE[0]})/$i | ||||||
| if [ $? -ne 0 ];then | ||||||
| # last line add failed keyword | ||||||
| sed -i '$s/$/ fail/' $STRESS_STATUS_LOG | ||||||
| dlogi "$i: fail" |tee -a $STRESS_OUTPUT_LOG | ||||||
| exit 1 | ||||||
| else | ||||||
| # last line add pass keyword | ||||||
| dlogi "$i: pass" |tee -a $STRESS_OUTPUT_LOG | ||||||
| fi | ||||||
| done | ||||||
| dlogi "Status check finished" | ||||||
| sed -i '$s/$/ pass/' $STRESS_STATUS_LOG | ||||||
|
|
||||||
| # run the script for the next round | ||||||
| loop_count=$[ $loop_count - 1 ] | ||||||
|
|
||||||
| # Store the environment for the next round load this script | ||||||
| dlogi "Setup the environment for next round bootup" |tee -a $STRESS_OUTPUT_LOG | ||||||
|
|
||||||
| declare -A exp_lst | ||||||
| exp_lst['TPLG']=$TPLG | ||||||
| exp_lst['LOG_ROOT']=$LOG_ROOT | ||||||
| # just keep the last dmesg bootup kernel line for the success | ||||||
| exp_lst['DMESG_LOG_START_LINE']=$(wc -l /var/log/kern.log|awk '{print $1;}') | ||||||
|
|
||||||
| for key in ${!exp_lst[@]} | ||||||
| do | ||||||
| sudo sof-boot-once.sh export $key=${exp_lst[$key]} | ||||||
| done | ||||||
|
|
||||||
| # run this script for next boot up round | ||||||
| dlogi "sof-boot-onece.sh ${BASH_SOURCE[0]} -l $loop_count" |tee -a $STRESS_OUTPUT_LOG | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| sudo sof-boot-once.sh ${BASH_SOURCE[0]} -l $loop_count | ||||||
|
|
||||||
| # template delay before reboot | ||||||
| sleep 1s | ||||||
|
|
||||||
| sudo reboot | ||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you hijack the dlog* cmd to wrap the
|tee -a $STRESS_OUTPUT_LOGwhenSTRESS_OUTPUT_LOGis defined?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's the good idea, I will try it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check with #5 , I don't think here need to modify
because when run from remote, the
nohupcommand will handle all outputfrom the local it don't need to handle it
here use
teecommand because after system reboot,the
nohupcommand is miss, Because current script is run inrc.localwhich called by root permission