CN-121764744-B - Power supply cycle test method and device, electronic equipment and readable storage medium
Abstract
The application provides a power supply circulation test method, a device, electronic equipment and a readable storage medium, which are used for analyzing a test command and judging whether a current test flow is a continuous running mode or not, logging in a desktop environment through automatic logging configuration and starting a target test program before restarting a test item through an automatic starting item according to a test program identifier in the test command if the current test flow is the continuous running mode, recovering test parameters recorded in a parameter warehouse, continuously executing preprocessing and/or action sequences, storing execution data and the ending time of the current test program into a session log corresponding to the target test program before restarting, and ending the test flow and outputting a test result if the circulation times of the test program reach preset circulation times. Therefore, efficiency and accuracy in power supply cycle test can be improved.
Inventors
- DENG LINFENG
- CHEN SHIFENG
- QIAN ZHONGJUN
- GONG YADONG
Assignees
- 此芯科技集团有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260302
Claims (10)
- 1. A power cycle test method, the power cycle test method comprising: Analyzing the test command, and judging whether the current test flow is a continuous running mode or not; If the current test flow is a continuous running mode, logging in a desktop environment through automatic logging configuration, and starting a target test program before restarting a test item through an automatic starting item according to a test program identifier in the test command, wherein the automatic logging configuration and the automatic starting item are installed when the test program is started for the first time, and a parameter warehouse is built when the test program is started for the first time, so as to generate the test program identifier; Restoring the test parameters recorded in the parameter warehouse, continuously executing the preprocessing and/or the action sequence, and storing the execution data and the ending time of the current test program into a session log corresponding to the target test program before restarting; if the cycle times of the test program reach the preset cycle times, ending the test flow and outputting the test result.
- 2. The power cycle test method of claim 1, wherein after the parsing the test command to determine whether the current test flow is a run-on mode, the power cycle test method further comprises: If the current test flow is not the continuous running mode, generating a test program identifier according to test parameters obtained by analyzing the test command; Initializing the session log, establishing the parameter warehouse, and writing the test parameters into the parameter warehouse; installing an automatic login configuration and an automatic start item; Reading a preprocessing and/or action sequence from a configuration file, executing the preprocessing and/or action sequence, and storing execution data and the ending time of the test program into the session log; Detecting whether a system restarting process is triggered currently or not; If the system restarting process is triggered, the current testing process is exited, and the running mode is entered.
- 3. The power cycle test method of claim 2, further comprising, after said detecting whether a system restart procedure is currently triggered: If the system restarting process is not triggered, detecting whether the cycle number of the current test program reaches the preset cycle number or not; If the cycle times of the test program reach the preset cycle times, ending the test flow and outputting a test result; if the cycle number of the test program does not reach the preset cycle number, recording the cycle number, continuously reading and executing the preprocessing and/or action sequence from the configuration file until the cycle number of the test program reaches the preset cycle number, ending the test flow and outputting the test result.
- 4. The power cycle test method according to claim 2, wherein if the cycle number of the test program reaches the preset cycle number, ending the test flow and outputting the test result, comprising: increasing the current cycle times once, and detecting whether the cycle times of the current test program reach the preset cycle times or not; If the cycle times of the test program reach the preset cycle times, ending the test flow and outputting a test result; The power supply cycle test method further comprises the following steps: if the cycle number of the test program does not reach the preset cycle number, recording the cycle number, continuously reading and executing the preprocessing and/or action sequence from the configuration file until the cycle number of the test program reaches the preset cycle number, ending the test flow and outputting the test result.
- 5. The power cycle test method of claim 2, wherein after the initializing the session log and establishing the parameter repository, writing the test parameters to the parameter repository, the power cycle test method further comprises: and centralizing and persisting the test parameters in the parameter warehouse.
- 6. The power cycle test method according to claim 2, wherein if the cycle number of the test program reaches the preset cycle number, ending the test flow and outputting the test result, comprising: if the cycle number of the test program reaches the preset cycle number, unloading the configured automatic login configuration and the automatic start item, recovering the system automatic login configuration, and outputting a test result after clearing the temporary file temporarily stored.
- 7. The power cycle test method of claim 1, the power supply cycle test method is characterized by further comprising the following steps: in the test flow, if an abnormal event is triggered, automatically executing an abnormal processing flow according to the type of the abnormal event; wherein the exception event includes at least one of: Automatic login configuration, automatic start item installation failure, parameter file damage or parameter file verification failure in a parameter warehouse, abnormal writing of a session log, and receiving a test flow interrupt instruction.
- 8. A power cycle test apparatus, the power cycle test apparatus comprising: The mode judging module is used for analyzing the test command and judging whether the current test flow is a continuous running mode or not; The test program restarting module is used for logging in a desktop environment through automatic logging configuration if the current test flow is a continuous running mode, and starting a target test program before restarting a test item through an automatic starting item according to a test program identifier in the test command, wherein the automatic logging configuration and the automatic starting item are installed when the test program is started for the first time, and a parameter warehouse is built when the test program is started for the first time, so that the test program identifier is generated; The test data storage module is used for recovering the test parameters recorded in the parameter warehouse, continuously executing the preprocessing and/or the action sequence, and storing the execution data and the ending time of the test program into the session log corresponding to the target test program before restarting; and the test result output module is used for ending the test flow and outputting the test result if the cycle number of the test program reaches the preset cycle number.
- 9. An electronic device comprising a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor in communication with the memory via the bus when the electronic device is in operation, the processor executing the machine-readable instructions to perform the steps of the power cycle test method of any one of claims 1 to 7.
- 10. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, performs the steps of the power cycle test method of any of claims 1 to 7.
Description
Power supply cycle test method and device, electronic equipment and readable storage medium Technical Field The present application relates to the field of computer technologies, and in particular, to a power cycle test method and apparatus, an electronic device, and a readable storage medium. Background The power supply circulation test refers to a test process of repeatedly executing a circulation process of 'power on-steady operation-power off/power off-power off stay-power on again' on an electronic device or component so as to evaluate the reliability and stability of the electronic device or component under the working condition of long-term and frequent power on and off. In the prior art, in the process of testing power supply circulation in a computer system, an engineer generally writes a script, and a system command is directly driven to test through the script. Under the test flow, if the system is restarted, the test flow cannot be automatically recovered, and usually, a worker is required to manually restart or execute the restart flow through another piece of equipment, and test data are easy to lose after restarting, so that the problems of lower efficiency and higher error rate exist in the power supply circulation test. Disclosure of Invention In view of the above, the present application is directed to a power cycle testing method, apparatus, electronic device, and readable storage medium, in the test running process, by automatically starting a target testing program before restarting through an automatic login configuration and an automatic starting item, which are configured, the preprocessing and/or the action sequence of the test parameters recorded in the parameter warehouse are restored, and the execution result is saved to the same session log before restarting, so that the efficiency and accuracy in the power cycle testing can be improved by automatically logging in and automatically restoring the testing flow of the test parameters to be continuously executed. In a first aspect, an embodiment of the present application provides a power cycle test method, where the power cycle test method includes: Analyzing the test command, and judging whether the current test flow is a continuous running mode or not; If the current test flow is a continuous running mode, logging in a desktop environment through automatic logging configuration, and starting a target test program before restarting a test item through an automatic starting item according to a test program identifier in the test command, wherein the automatic logging configuration and the automatic starting item are installed when the test program is started for the first time, and a parameter warehouse is built when the test program is started for the first time, so as to generate the test program identifier; Restoring the test parameters recorded in the parameter warehouse, continuously executing the preprocessing and/or the action sequence, and storing the execution data and the ending time of the current test program into a session log corresponding to the target test program before restarting; if the cycle times of the test program reach the preset cycle times, ending the test flow and outputting the test result. In one possible implementation manner, after the analyzing the test command and determining whether the current test flow is the run-on mode, the power cycle test method further includes: If the current test flow is not the continuous running mode, generating a test program identifier according to test parameters obtained by analyzing the test command; Initializing the session log, establishing the parameter warehouse, and writing the test parameters into the parameter warehouse; installing an automatic login configuration and an automatic start item; Reading a preprocessing and/or action sequence from a configuration file, executing the preprocessing and/or action sequence, and storing execution data and the ending time of the test program into the session log; Detecting whether a system restarting process is triggered currently or not; If the system restarting process is triggered, the current testing process is exited, and the running mode is entered. In one possible implementation manner, after the detecting whether the system restart procedure is triggered currently, the power cycle test method further includes: If the system restarting process is not triggered, detecting whether the cycle number of the current test program reaches the preset cycle number or not; If the cycle times of the test program reach the preset cycle times, ending the test flow and outputting a test result; if the cycle number of the test program does not reach the preset cycle number, recording the cycle number, continuously reading and executing the preprocessing and/or action sequence from the configuration file until the cycle number of the test program reaches the preset cycle number, ending the test flow and outputting the test resul