Test method and device of heat dissipation regulation and control program, electronic equipment and storage medium
By simulating test environment scenarios on a virtual machine to test the heat dissipation control program, it solves the problems of high test costs and inability to simulate destructive scenarios in the existing technology, and realizes low-cost and efficient heat dissipation control program testing.
Patent Information
- Application Number
- CN202410650623.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-23
- Publication Date
- 2024-09-20
AI Technical Summary
The existing technology is expensive and difficult to simulate destructive test scenarios during heat dissipation control program testing, and cannot achieve comprehensive testing.
By simulating the test environment scenario on the virtual machine, the test environment parameters are obtained, and the heat dissipation control program to be tested is run in the simulated test environment to generate simulation control results. The test results are determined based on the target and simulation control results, and optimization is performed until the difference is less than the threshold. .
It is possible to complete a comprehensive test of the heat dissipation control program on the premise of reducing test costs, and improve test efficiency and accuracy.
Smart Images

Figure CN118672897A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of test processing technology, and in particular to a test method, device, electronic equipment and storage medium for a heat dissipation control program. Background Art
[0002] For hardware electronic devices, such as white box switches, good heat dissipation conditions must be ensured during operation to maintain the normal operation of each device. Hardware electronic devices often use heat dissipation control programs to perform heat dissipation in corresponding scenarios. Therefore, reliable testing of heat dissipation control programs is a prerequisite.
[0003] It is known from the related art that in the process of testing the heat dissipation control program, it is often achieved by actually testing the actual hardware electronic equipment in a closed space through environmental simulation equipment. This will increase the testing cost and cannot test the hardware electronic equipment in destructive test scenarios.
[0004] Therefore, finding a testing method for the thermal control program that reduces the testing cost and can perform comprehensive testing has become a current research hotspot. Summary of the invention
[0005] The present invention provides a test method, device, electronic equipment and storage medium for a heat dissipation control program, which can achieve comprehensive testing of the heat dissipation control program while reducing the test cost.
[0006] The present invention provides a testing method for a heat dissipation control program, which is applied to a virtual machine, wherein the virtual machine runs on a physical machine, and the method comprises: obtaining test environment parameters, and based on the test environment parameters and a pre-built simulation test environment system, simulating a simulation test environment scenario of the heat dissipation control program to be tested; simulating the heat dissipation control program to be tested to obtain a simulated heat dissipation control program; running the simulated heat dissipation control program under the simulated test environment scenario to obtain a simulation control result output by the simulated heat dissipation control program; determining a test result of the heat dissipation control program to be tested according to a target control result and the simulation control result, wherein the target control result is a control result of the heat dissipation control program to be tested that matches the test environment parameters.
[0007] According to a testing method for a heat dissipation control program provided by the present invention, the test result of the heat dissipation control program to be tested is determined based on the target control result and the simulation control result, specifically including: when the difference between the target control result and the simulation control result is less than or equal to a difference threshold, determining that the test result of the control program to be tested is passed; when the difference between the target control result and the simulation control result is greater than the difference threshold, determining that the test result of the control program to be tested is failed.
[0008] According to a testing method for a heat dissipation control program provided by the present invention, after determining that the test result of the control program to be tested is failed, the method also includes: pausing the running of the simulated heat dissipation control program in the simulated test environment scenario, and recording the simulated test environment scenario; re-optimizing the control program to be tested according to the simulated test environment scenario to obtain an optimized control program to be tested; simulating the optimized control program to be tested to obtain a simulated optimized heat dissipation control program; using the simulated optimized heat dissipation control program as the simulated heat dissipation control program, and restarting the running of the simulated heat dissipation control program in the simulated test environment scenario, and repeatedly executing the steps of pausing the running of the simulated heat dissipation control program in the simulated test environment scenario, and recording the simulated test environment scenario, until using the simulated optimized heat dissipation control program as the simulated heat dissipation control program, and restarting the running of the simulated heat dissipation control program in the simulated test environment scenario, until the difference between the target control result and the simulated control result obtained after restarting the running of the simulated heat dissipation control program in the simulated test environment scenario is less than or equal to the difference threshold.
[0009] According to a testing method for a heat dissipation control program provided by the present invention, before re-optimizing the control program to be tested according to the simulated test environment scenario to obtain the optimized control program to be tested, the method also includes: generating a heat dissipation control curve based on the target control result and the simulated control result; re-optimizing the control program to be tested according to the simulated test environment scenario to obtain the optimized control program to be tested specifically includes: re-optimizing the control program to be tested according to the heat dissipation control curve and the simulated test environment scenario to obtain the optimized control program to be tested.
[0010] According to a testing method for a heat dissipation control program provided by the present invention, obtaining the test environment parameters is implemented in the following manner: obtaining the test environment parameter file transmitted by the physical machine, wherein the test environment parameter file is determined based on a configuration file parsed by the physical machine, the configuration file is a configuration file corresponding to a user instruction obtained by the physical machine, and the user instruction is used to represent an instruction indicating the test environment parameter; mounting the test environment parameter file to obtain the test environment parameters.
[0011] According to a testing method for a heat dissipation control program provided by the present invention, the test environment parameters include dynamic test environment parameters that change continuously within a preset time period; the simulated test environment scenario of the heat dissipation control program to be tested is simulated based on the test environment parameters and a pre-built simulation test environment system, specifically including: based on the dynamic test environment parameters and a pre-built simulation test environment system, a simulated dynamic test environment scenario of the heat dissipation control program to be tested is simulated; running the post-simulation heat dissipation control program in the simulated test environment scenario to obtain a simulated control result output by the post-simulation heat dissipation control program, specifically including: running the post-simulation heat dissipation control program in the simulated dynamic test environment scenario to obtain a simulated control result output by the post-simulation heat dissipation control program in real time and dynamically.
[0012] According to a testing method for a heat dissipation control program provided by the present invention, the simulated control results include simulated fan control results and simulated water pump control results; the simulated test environment scenario is run under the simulated test environment scenario to obtain the simulated control results output by the simulated heat dissipation control program, specifically including: running the simulated test environment scenario under the simulated test environment scenario, obtaining the simulated fan control results output by the simulated heat dissipation control program based on the first file node of the virtual machine, and obtaining the simulated water pump control results output by the simulated heat dissipation control program based on the second file node of the virtual machine, wherein the first file node and the second file node are different file nodes.
[0013] The present invention also provides a testing device for a heat dissipation control program, which is applied to a virtual machine, wherein the virtual machine runs on a physical machine, and the device includes: an acquisition module, which is used to acquire test environment parameters, and based on the test environment parameters and a pre-built simulation test environment system, simulates a simulated test environment scenario of the heat dissipation control program to be tested; a simulation module, which is used to simulate the heat dissipation control program to be tested to obtain a simulated heat dissipation control program; a processing module, which is used to run the simulated heat dissipation control program under the simulated test environment scenario to obtain a simulated control result output by the simulated heat dissipation control program; and a generation module, which is used to determine the test result of the heat dissipation control program to be tested according to a target control result and the simulation control result, wherein the target control result is a control result of the heat dissipation control program to be tested that matches the test environment parameters.
[0014] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a test method for a heat dissipation control program as described in any one of the above is implemented.
[0015] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the test method of the heat dissipation control program as described in any one of the above is implemented.
[0016] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements a test method for a heat dissipation control program as described in any one of the above.
[0017] The test method, device, electronic device and storage medium of the heat dissipation control program provided by the present invention obtain test environment parameters, and based on the test environment parameters and the pre-built simulation test environment system, simulate the simulated test environment scene of the heat dissipation control program to be tested on the virtual machine; and simulate the heat dissipation control program to be tested on the virtual machine to obtain the simulated heat dissipation control program; run the simulated heat dissipation control program in the simulated test environment scene to obtain the simulated control result output by the simulated heat dissipation control program; and determine the test result of the heat dissipation control program to be tested according to the target control result and the simulated control result. Since the simulated heat dissipation control program is run in the simulated test environment scene obtained by simulating the virtual machine, the simulated control results in various simulated test environment scenes can be obtained at low cost and in all aspects, and then the test result of the heat dissipation control program to be tested can be determined according to the simulated control result, so that the comprehensive test of the heat dissipation control program can be completed under the premise of reducing the test cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 It is a flow chart of a method for testing a heat dissipation control program provided by the present invention;
[0020] Figure 2 It is a flow chart of determining the test result of the heat dissipation control program to be tested according to the target control result and the simulation control result provided by the present invention;
[0021] Figure 3 It is a flow chart of re-optimizing the control program to be tested according to the simulated test environment scenario provided by the present invention to obtain the optimized control program to be tested;
[0022] Figure 4 It is a structural schematic diagram of the test system provided by the present invention;
[0023] Figure 5 It is a schematic diagram of an application scenario of the test method of the heat dissipation control program provided by the present invention;
[0024] Figure 6 It is a structural schematic diagram of a testing device for a heat dissipation control program provided by the present invention;
[0025] Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0027] Like other hardware electronic devices, white box switches also need to ensure good heat dissipation conditions when working to maintain the normal operation of each device. The temperature control program of the switch can adjust the fan speed according to the temperature sensor and fan status data to ensure the best heat dissipation effect and reduce fan energy consumption. However, as the heat dissipation power of each period in the white box switch increases, higher requirements are placed on the reliability, scenarios, exception handling and other performance of the heat dissipation control program, which requires more comprehensive testing.
[0028] The testing method of the heat dissipation control program provided by the present invention can realize low-cost, efficient and comprehensive testing of the heat dissipation control program of the white box switch by using a virtual machine to build the environment required for testing the heat dissipation control program of the switch.
[0029] Figure 1 It is a flow chart of a testing method of a heat dissipation control program provided by the present invention.
[0030] The following will be combined Figure 1 The process of the testing method of the heat dissipation control program provided by the present invention is described.
[0031] In an exemplary embodiment of the present invention, the testing method of the heat dissipation control program can be applied to a virtual machine, wherein the virtual machine can run on a physical machine. A virtual machine (VM) is a software that uses computer software to simulate computer hardware and runs software such as an operating system on the simulated hardware. It can implement multiple isolated virtual machines on the same physical computer (also called a physical machine). These virtual machines can simulate different hardware environments through software, thereby reducing the cost of software adaptation development. Figure 1 It can be known that the test method of the heat dissipation control program may include steps 110 to 140, and each step will be introduced below.
[0032] In step 110, test environment parameters are obtained, and based on the test environment parameters and a pre-built simulated test environment system, a simulated test environment scenario of the heat dissipation control program to be tested is simulated.
[0033] In one embodiment, the test environment parameters can be obtained, wherein the test environment parameters can be considered as the test environment parameters under the test scenario. It can be immediately implanted into the pre-built simulation test environment system to simulate the specific simulation test environment scenario of the heat dissipation control program to be tested.
[0034] In another embodiment, the heat dissipation control program to be tested may be a heat dissipation control program to be tested for a black-and-white interactive machine, or may be a heat dissipation control program to be tested for other hardware electronic devices, such as a processor, etc. For ease of description, in this application document, the heat dissipation control program to be tested for a black-and-white interactive machine will be used as an example for description.
[0035] In step 120, the heat dissipation control program to be tested is simulated to obtain a simulated heat dissipation control program.
[0036] In step 130, a simulated post-heat dissipation control program is run in a simulated test environment scenario to obtain a simulated control result output by the simulated post-heat dissipation control program.
[0037] In one embodiment, the heat dissipation control program to be tested can be simulated on a virtual machine, that is, the operating system running on the heat dissipation control program to be tested of the white box switch can be simulated on the virtual machine, so that a simulated heat dissipation control program can be obtained on the virtual machine. The simulated heat dissipation control program can be used as a heat dissipation control program running in a simulated test environment scenario, so that the heat dissipation control program to be tested can be tested without the aid of a real black and white switch.
[0038] In another embodiment, the simulated heat dissipation control program can be run in a simulated test environment scenario, so that the simulated control result output by the simulated heat dissipation control program can be obtained based on the virtual machine. It can be understood that since the simulated test environment scenario is an environment that needs to be tested, and the simulated heat dissipation control program is a heat dissipation control program that needs to be tested, the simulated control result output by the simulated heat dissipation control program can be simulated as the control result of the heat dissipation control program that needs to be tested in the environment that needs to be tested.
[0039] Since the simulation test environment scenario is simulated, it is possible to simulate environments that are difficult to simulate in the original test plan, and even simulate real environmental changes, to achieve a more comprehensive and thorough test heat dissipation strategy.
[0040] In step 140, the test result of the heat dissipation control program to be tested is determined according to the target control result and the simulation control result.
[0041] The target control result is the control result of the heat dissipation control program to be tested that matches the test environment parameters.
[0042] In another embodiment, the target control result is predetermined, that is, when the test environment parameters are determined, the corresponding target control result is also determined. During the application process, the test result of the heat dissipation control program to be tested can be determined based on the target control result and the simulation control result. Among them, the test results may include two situations: test passed and test failed. In this embodiment, since the simulated heat dissipation control program is run in a simulated test environment scenario obtained by virtual machine simulation, the simulated control results in various simulated test environment scenarios can be obtained at low cost and in all aspects, and then the test result of the heat dissipation control program to be tested can be determined based on the simulation control result, which realizes that the comprehensive test of the heat dissipation control program can be completed under the premise of reducing the test cost.
[0043] The test method of the heat dissipation control program provided by the present invention obtains the test environment parameters, and based on the test environment parameters and the pre-built simulation test environment system, simulates the simulation test environment scene of the heat dissipation control program to be tested on the virtual machine; and simulates the heat dissipation control program to be tested on the virtual machine to obtain the simulated heat dissipation control program; runs the simulated heat dissipation control program in the simulated test environment scene to obtain the simulated control result output by the simulated heat dissipation control program; and determines the test result of the heat dissipation control program to be tested according to the target control result and the simulation control result. Since the simulated heat dissipation control program is run in the simulated test environment scene obtained by simulating the virtual machine, the simulation control results in various simulated test environment scenes can be obtained at low cost and in all aspects, and then the test result of the heat dissipation control program to be tested can be determined according to the simulation control result, so that the comprehensive test of the heat dissipation control program can be completed under the premise of reducing the test cost.
[0044] In an exemplary embodiment of the present invention, the above-mentioned embodiment is continued to be used as an example for explanation, wherein, according to the target control result and the simulation control result, the test result of the heat dissipation control program to be tested is determined, which can be implemented in the following manner:
[0045] When the difference between the target control result and the simulated control result is less than or equal to the difference threshold, determining that the test result of the control program to be tested is passed;
[0046] When the difference between the target control result and the simulated control result is greater than the difference threshold, it is determined that the test result of the control program to be tested is failed.
[0047] It should be noted that the target control result can be understood as the expected control result in the test scenario corresponding to the test environment parameters, or as an ideal control result. In the application process, the target control result can be used as a standard to determine whether the simulated control result passes the test. In one example, the difference between the target control result and the simulated control result can be compared, wherein, when the difference is less than or equal to the difference threshold, the test result of the control program to be tested is determined to be passed; when the difference is greater than the difference threshold, the test result of the control program to be tested is determined to be failed. Among them, the difference threshold can be adjusted according to the actual situation. In this embodiment, the difference threshold is not specifically limited.
[0048] Figure 2 It is a flow chart of determining the test result of the heat dissipation control program to be tested according to the target control result and the simulation control result provided by the present invention.
[0049] The following will be combined Figure 2The operating steps after determining that the test result of the control program to be tested is failed are explained.
[0050] In an exemplary embodiment of the present invention, Figure 2 It can be seen that, according to the target control result and the simulation control result, determining the test result of the heat dissipation control program to be tested may include steps 210 to 250, and each step will be introduced below.
[0051] In step 210 , when the difference between the target control result and the simulated control result is greater than the difference threshold, it is determined that the test result of the control program to be tested is failed.
[0052] In step 220, the simulation post-heat dissipation control program is suspended in the simulation test environment scenario, and the simulation test environment scenario is recorded.
[0053] In step 230, the control program to be tested is re-optimized according to the simulated test environment scenario to obtain an optimized control program to be tested.
[0054] In one embodiment, when the difference between the target control result and the simulated control result is greater than the difference threshold, the test result of the control program to be tested is determined to be failed. Further, when the test result of the control program to be tested is failed, the operation of the simulated post-heat dissipation control program in the simulated test environment scenario can be timely suspended, and the simulated test environment scenario can be recorded.
[0055] In yet another embodiment, the control program to be tested may be re-optimized according to a simulated test environment scenario, thereby obtaining an optimized control program to be tested.
[0056] In this embodiment, by pausing the test at any time and retaining the environment, it is convenient to locate the problems found; it is also convenient to optimize and modify the heat dissipation control program after the problem is found, and the test can be started immediately after the modification without relying on the actual external environment.
[0057] In step 240, the control program to be tested is simulated and optimized to obtain the heat dissipation control program after simulation and optimization.
[0058] In step 250, the simulated optimized heat dissipation control program is used as the simulated heat dissipation control program, and the simulated heat dissipation control program is restarted to run in the simulated test environment scenario, and the steps of pausing the running of the simulated heat dissipation control program in the simulated test environment scenario and recording the simulated test environment scenario are repeated until the simulated optimized heat dissipation control program is used as the simulated heat dissipation control program and the running of the simulated heat dissipation control program in the simulated test environment scenario is restarted, until the difference between the target control result and the simulated control result obtained after restarting the running of the simulated post-heat dissipation control program in the simulated test environment scenario is less than or equal to the difference threshold.
[0059] In another embodiment, the optimized controlled vehicle to be tested can be simulated on a virtual machine, so as to obtain a simulated optimized heat dissipation control program, which is convenient for simulating and testing the simulated optimized heat dissipation control program.
[0060] In another embodiment, the simulated optimized heat dissipation control program can be used as the simulated optimized heat dissipation control program described above, and the step of running the simulated heat dissipation control program in the simulated test environment scenario is restarted. The simulated optimized heat dissipation control program in this scenario is actually the simulated optimized heat dissipation control program after subsequent optimization.
[0061] Further, the execution of pausing the running of the simulated heat dissipation control program in the simulated test environment scenario and recording the simulated test environment scenario step (corresponding to step 220) can be repeated until the simulated optimized heat dissipation control program is used as the simulated heat dissipation control program, and the step of running the simulated heat dissipation control program in the simulated test environment scenario is restarted (corresponding to step 250), until the difference between the target control result and the simulated control result obtained after restarting the running of the simulated heat dissipation control program in the simulated test environment scenario is less than or equal to the difference threshold. In this embodiment, the optimized control program to be tested is obtained by iteratively re-optimizing the control program to be tested, and the simulated optimized heat dissipation control program corresponding to the optimized control program to be tested is simulated and tested, until the difference between the target control result and the simulated control result is less than or equal to the difference threshold, thereby achieving effective optimization of the control program to be tested.
[0062] Figure 3 It is a flow chart of re-optimizing the control program to be tested according to the simulated test environment scenario provided by the present invention to obtain the optimized control program to be tested.
[0063] The following will be combined Figure 3 The process of re-optimizing the control program to be tested according to the simulated test environment scenario to obtain the optimized control program to be tested is described.
[0064] In an exemplary embodiment of the present invention, Figure 3 It can be seen that the control program to be tested is re-optimized according to the simulated test environment scenario, and the optimized control program to be tested may include step 310 and step 320, and each step will be introduced below.
[0065] In step 310 , a heat dissipation control curve is generated based on the target control result and the simulation control result.
[0066] In step 320, the control program to be tested is re-optimized according to the heat dissipation control curve and the simulated test environment scenario to obtain an optimized control program to be tested.
[0067] In one embodiment, a heat dissipation control curve can be generated according to the difference between the target control result and the simulated control result. Then, the control program to be tested is re-optimized according to the heat dissipation control curve and the corresponding simulated test environment scenario to obtain the optimized control program to be tested. In this embodiment, the control program to be tested is re-optimized in combination with the heat dissipation control curve and the simulated test environment scenario to quickly obtain the optimized control program to be tested.
[0068] In an exemplary embodiment of the present invention, obtaining the test environment parameters may be implemented in the following manner:
[0069] Acquire a test environment parameter file transmitted by the physical machine, wherein the test environment parameter file is determined according to a configuration file parsed by the physical machine, the configuration file is a configuration file corresponding to a user instruction acquired by the physical machine, and the user instruction is used to represent an instruction indicating a test environment parameter;
[0070] Mount the test environment parameter file to obtain the test environment parameters.
[0071] In one embodiment, a test environment parameter file transmitted by a physical machine may be obtained, and the test environment parameter file may be mounted to obtain test environment parameters. The test environment parameter file may be determined based on a configuration file parsed by the physical machine, and the configuration file is a configuration file corresponding to a user instruction obtained by the physical machine, and the user instruction is used to characterize instructions indicating test environment parameters. In this embodiment, since the test environment parameter file is determined based on user instructions, the corresponding test environment parameters may be obtained conveniently and flexibly based on the user's instructions, thereby enabling comprehensive testing of the heat dissipation control program.
[0072] In another exemplary embodiment of the present invention, the configuration file can also be generated by a pre-written script, wherein the script can be determined according to the user's instructions. In one example, the user's instructions can be instructions for dynamically adjusting the test environment parameters according to a preset time. In this embodiment, in order to automatically form a configuration file corresponding to the dynamically adjusted test environment parameters, a script can be written in advance and run on a physical machine to obtain a test environment parameter file corresponding to the script having the feature of dynamically adjusting the test environment parameters according to a preset time. Further, the test environment parameter file is mounted, so that the test environment parameters that are dynamically adjusted according to the preset time can be obtained. Through this embodiment, the fully automatic acquisition of the test environment parameters that are dynamically adjusted according to the preset time is realized, laying the foundation for comprehensive testing of the heat dissipation control program.
[0073] In yet another exemplary embodiment of the present invention, the test environment parameters may include dynamic test environment parameters that continuously change within a preset time period;
[0074] Among them, based on the test environment parameters and the pre-built simulation test environment system, the simulation test environment scenario of the heat dissipation control program to be tested can be simulated and implemented in the following ways:
[0075] Based on the dynamic test environment parameters and the pre-built simulation test environment system, a simulated dynamic test environment scenario of the heat dissipation control program to be tested is simulated;
[0076] Run the simulation post-heat dissipation control program in the simulation test environment scenario to obtain the simulation control result output by the simulation post-heat dissipation control program. This can be achieved in the following ways:
[0077] The simulated heat dissipation control program is run in a simulated dynamic test environment scenario, and the simulated control results output by the simulated heat dissipation control program are obtained in real time and dynamically.
[0078] In one embodiment, in order to realize continuous testing of the heat dissipation control program to be tested, a simulated dynamic test environment scenario of the heat dissipation control program to be tested can be simulated based on dynamic test environment parameters and a pre-built simulation test environment system; wherein, the dynamic test environment parameters can also be obtained in the script writing manner as described above.
[0079] Furthermore, the simulated heat dissipation control program is run in a simulated dynamic test environment scenario, and the simulated control results output by the simulated heat dissipation control program are obtained in real time. Since the dynamic test environment parameters can dynamically correspond to the target control results, the test results of the heat dissipation control program to be tested can be determined based on the simulated control results and the corresponding target control results at each moment.
[0080] In yet another exemplary embodiment of the present invention, the simulated control result may include a simulated fan control result and a simulated water pump control result.
[0081] Among them, running the simulated heat dissipation control program in the simulated test environment scenario to obtain the simulated control result output by the simulated heat dissipation control program can be achieved in the following ways:
[0082] Running the simulated heat dissipation control program in the simulated test environment scenario, obtaining the simulated fan control result output by the simulated heat dissipation control program based on the first file node of the virtual machine, and
[0083] A simulated water pump control result output by a simulated heat dissipation control program is obtained based on a second file node of the virtual machine, wherein the first file node and the second file node are different file nodes.
[0084] In one embodiment, a simulated post-heat dissipation control program can be run in a simulated test environment scenario, and a simulated fan control result output by the simulated post-heat dissipation control program is obtained based on the first file node of the virtual machine, and a simulated water pump control result output by the simulated post-heat dissipation control program is obtained based on the second file node of the virtual machine, that is, the simulated fan control result and the simulated water pump control result output by the virtual machine are monitored, wherein the simulated fan control result and the simulated water pump control result can represent the simulated control result, and the test result of the heat dissipation control program to be tested is judged from the dimensions of fan control and water pump control.
[0085] Figure 4 It is a structural schematic diagram of the test system provided by the present invention. Figure 5 It is a schematic diagram of an application scenario of the testing method of the heat dissipation control program provided by the present invention.
[0086] The following will be combined Figure 4 and Figure 5 The process of the testing method of the heat dissipation control program provided by the present invention is described.
[0087] In one embodiment, in combination Figure 4 It can be seen that in the process of applying the test method of the heat dissipation control program, it can be used Figure 4 In the form described above, the virtual machine runs on the physical machine. During the application process, the heat dissipation control program will be simulated in the virtual machine, that is, the simulated heat dissipation control program will be obtained. Further, the physical machine can use the test program to implement the test environment parameter file (which can correspond to Figure 4The simulation file node in the simulation file is transmitted to the virtual machine. Further, the virtual machine mounts the test environment parameter file to obtain the test environment parameters. Then, the simulated heat dissipation control program is run in the simulated test environment scenario to obtain the simulated control result output by the simulated heat dissipation control program, and the test result of the heat dissipation control program to be tested is determined based on the target control result and the simulated control result.
[0088] In yet another embodiment, the test result of the heat dissipation control program to be tested may be presented in the form of a test report output on a physical machine.
[0089] in, Figure 4 The scene simulation data in can be considered as the scene simulation data initiated by user instructions (which can correspond to the configuration file in the previous text), and the test environment parameter file can be obtained by parsing the scene simulation data.
[0090] Combination Figure 5 It can be seen that during the application of the test method of the heat dissipation control program, the configuration file can be read, and a set of environmental parameters (corresponding to the test environment parameter file) and expected control values can be obtained, where the expected control values can correspond to the target control results.
[0091] Furthermore, the environment parameters are written into the virtual driver file node of the physical machine or provided to an interface accessible to the virtual machine, so that the virtual machine can mount the test environment parameter file to obtain the test environment parameters.
[0092] In another embodiment, the heat dissipation control program simulated by the virtual machine can be waited for to complete the current round of control, that is, the heat dissipation control program after simulation is run in the simulated test environment scenario to obtain the simulated control result output by the heat dissipation control program after simulation. The heat dissipation control output result can be obtained by reading the virtual drive node. Among them, the heat dissipation control output result may include the simulated fan control result and the simulated water pump control result. In one example, the heat dissipation control program after simulation can be run in the simulated test environment scenario, and the simulated fan control result output by the heat dissipation control program after simulation is obtained based on the first file node of the virtual machine (corresponding to the virtual drive node), and the simulated water pump control result output by the heat dissipation control program after simulation is obtained based on the second file node of the virtual machine (corresponding to another virtual drive node).
[0093] Determine whether the heat dissipation control output result (corresponding to the simulation control result) meets expectations, that is, whether the simulation control result meets the target control result. If the simulation control result meets the target control result, determine that the test result of the control program to be tested is passed, and determine whether there is a next set of environmental configurations. If not, end. If so, re-execute the step of reading the configuration file until the test result is obtained. If the simulation control result does not meet the target control result, determine that the test result of the control program to be tested is not passed, that is, the test fails, and retain the test environment information for optimizing the control program to be tested.
[0094] In the aforementioned embodiment, the test can be performed without actual switch hardware and test equipment that can actually control environmental changes, thereby saving the cost of testing the heat dissipation control program and improving the test efficiency.
[0095] According to the above description, the test method of the heat dissipation control program provided by the present invention obtains the test environment parameters, and based on the test environment parameters and the pre-built simulation test environment system, simulates the simulated test environment scenario of the heat dissipation control program to be tested on the virtual machine; and simulates the heat dissipation control program to be tested on the virtual machine to obtain the simulated heat dissipation control program; runs the simulated heat dissipation control program in the simulated test environment scenario to obtain the simulated control result output by the simulated heat dissipation control program; and determines the test result of the heat dissipation control program to be tested according to the target control result and the simulated control result. Since the simulated heat dissipation control program is run in the simulated test environment scenario obtained by simulating the virtual machine, the simulated control results in various simulated test environment scenarios can be obtained at low cost and in all aspects, and then the test result of the heat dissipation control program to be tested can be determined according to the simulated control result, so that the comprehensive test of the heat dissipation control program can be completed under the premise of reducing the test cost.
[0096] Based on the same concept, the present invention also provides a testing device for a heat dissipation control program.
[0097] The testing device of the heat dissipation control program provided by the present invention is described below. The testing device of the heat dissipation control program described below and the testing method of the heat dissipation control program described above can be referred to each other.
[0098] Figure 6 It is a structural schematic diagram of a testing device for a heat dissipation control program provided by the present invention.
[0099] In an exemplary embodiment of the present invention, the testing device of the heat dissipation control program can be applied to a virtual machine, wherein the virtual machine runs on a physical machine. Figure 6It can be known that the testing device of the heat dissipation control program may include an acquisition module 610, a simulation module 620, a processing module 630 and a generation module 640, and each module will be introduced below.
[0100] The acquisition module 610 may be configured to acquire test environment parameters, and simulate the test environment scenario of the heat dissipation control program to be tested based on the test environment parameters and a pre-built simulated test environment system;
[0101] The simulation module 620 may be configured to simulate the heat dissipation control program to be tested to obtain a simulated heat dissipation control program;
[0102] The processing module 630 may be configured to run the post-simulation heat dissipation control program in the simulated test environment scenario to obtain a simulated control result output by the post-simulation heat dissipation control program;
[0103] The generation module 640 can be configured to determine the test result of the heat dissipation control program to be tested according to the target control result and the simulation control result, wherein the target control result is the control result of the heat dissipation control program to be tested that matches the test environment parameters.
[0104] In an exemplary embodiment of the present invention, the generation module 640 may determine the test result of the heat dissipation control program to be tested according to the target control result and the simulation control result in the following manner:
[0105] In a case where the difference between the target control result and the simulated control result is less than or equal to a difference threshold, determining that the test result of the control program to be tested is passed;
[0106] When the difference between the target control result and the simulated control result is greater than a difference threshold, it is determined that the test result of the control program to be tested is failed.
[0107] In an exemplary embodiment of the present invention, the generating module 640 may also be configured to:
[0108] Pause the running of the post-simulation heat dissipation control program in the simulated test environment scenario, and record the simulated test environment scenario;
[0109] Re-optimizing the control program to be tested according to the simulated test environment scenario to obtain an optimized control program to be tested;
[0110] Simulating the optimized control program to be tested to obtain a simulated optimized heat dissipation control program;
[0111] using the simulated optimized heat dissipation control program as the simulated heat dissipation control program, and restarting the simulated heat dissipation control program in the simulated test environment scenario, and
[0112] Repeat the execution of pausing the running of the simulated post-heat dissipation control program in the simulated test environment scenario, and recording the simulated test environment scenario steps, until the simulated optimized post-heat dissipation control program is used as the simulated post-heat dissipation control program, and restarting the running of the simulated post-heat dissipation control program in the simulated test environment scenario, until the difference between the target control result and the simulated control result obtained after restarting the running of the simulated post-heat dissipation control program in the simulated test environment scenario is less than or equal to the difference threshold.
[0113] In an exemplary embodiment of the present invention, the generating module 640 may also be configured to:
[0114] Based on the target control result and the simulation control result, generating a heat dissipation control curve;
[0115] The generation module 640 may re-optimize the control program to be tested according to the simulated test environment scenario to obtain the optimized control program to be tested in the following manner:
[0116] The control program to be tested is re-optimized according to the heat dissipation control curve and the simulated test environment scenario to obtain an optimized control program to be tested.
[0117] In an exemplary embodiment of the present invention, the acquisition module 610 may acquire the test environment parameters in the following manner:
[0118] Acquire the test environment parameter file transmitted by the physical machine, wherein the test environment parameter file is determined according to a configuration file parsed by the physical machine, the configuration file is a configuration file corresponding to a user instruction acquired by the physical machine, and the user instruction is used to represent an instruction indicating the test environment parameter;
[0119] The test environment parameter file is mounted to obtain the test environment parameters.
[0120] In an exemplary embodiment of the present invention, the test environment parameters include dynamic test environment parameters that continuously change within a preset time period;
[0121] The acquisition module 610 can be implemented in the following manner to simulate and obtain the simulated test environment scenario of the heat dissipation control program to be tested based on the test environment parameters and the pre-built simulated test environment system:
[0122] Based on the dynamic test environment parameters and the pre-built simulation test environment system, a simulated dynamic test environment scenario of the heat dissipation control program to be tested is simulated;
[0123] The processing module 630 may implement running the post-simulation heat dissipation control program in the simulated test environment scenario to obtain the simulated control result output by the post-simulation heat dissipation control program in the following manner:
[0124] The post-simulation heat dissipation control program is run in the simulated dynamic test environment scenario to obtain the simulated control result output by the post-simulation heat dissipation control program in real time and dynamically.
[0125] In an exemplary embodiment of the present invention, the simulation control result includes a simulation fan control result and a simulation water pump control result;
[0126] The processing module 630 may implement running the post-simulation heat dissipation control program in the simulated test environment scenario to obtain the simulated control result output by the post-simulation heat dissipation control program in the following manner:
[0127] Running the post-simulation heat dissipation control program in the simulated test environment scenario, obtaining a simulated fan control result output by the post-simulation heat dissipation control program based on the first file node of the virtual machine, and
[0128] A simulated water pump control result output by the simulated heat dissipation control program is obtained based on the second file node of the virtual machine, wherein the first file node and the second file node are different file nodes.
[0129] Figure 7 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 7As shown, the electronic device may include: a processor 710, a communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720 and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute the test method of the heat dissipation control program, which is applied to a virtual machine, wherein the virtual machine runs on a physical machine, and the method includes: obtaining test environment parameters, and based on the test environment parameters and a pre-built simulation test environment system, simulating a simulated test environment scene of the heat dissipation control program to be tested; simulating the heat dissipation control program to be tested to obtain a simulated heat dissipation control program; running the simulated heat dissipation control program in the simulated test environment scene to obtain a simulated control result output by the simulated heat dissipation control program; determining the test result of the heat dissipation control program to be tested according to the target control result and the simulated control result, wherein the target control result is the control result of the heat dissipation control program to be tested that matches the test environment parameters.
[0130] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0131] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the test method of the heat dissipation control program provided by the above-mentioned methods, and apply it to a virtual machine, wherein the virtual machine runs on a physical machine, and the method includes: obtaining test environment parameters, and based on the test environment parameters and a pre-built simulation test environment system, simulating a simulated test environment scenario of the heat dissipation control program to be tested; simulating the heat dissipation control program to be tested to obtain a simulated heat dissipation control program; running the simulated heat dissipation control program under the simulated test environment scenario to obtain a simulated control result output by the simulated heat dissipation control program; determining the test result of the heat dissipation control program to be tested according to the target control result and the simulation control result, wherein the target control result is the control result of the heat dissipation control program to be tested that matches the test environment parameters.
[0132] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the test method for executing the heat dissipation control program provided by the above-mentioned methods, and is applied to a virtual machine, wherein the virtual machine runs on a physical machine, and the method comprises: obtaining test environment parameters, and based on the test environment parameters and a pre-built simulation test environment system, simulating a simulated test environment scenario of the heat dissipation control program to be tested; simulating the heat dissipation control program to be tested to obtain a simulated heat dissipation control program; running the simulated heat dissipation control program under the simulated test environment scenario to obtain a simulated control result output by the simulated heat dissipation control program; determining the test result of the heat dissipation control program to be tested according to the target control result and the simulation control result, wherein the target control result is the control result of the heat dissipation control program to be tested that matches the test environment parameters.
[0133] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0134] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0135] It is further understood that, although the operations are described in a specific order in the accompanying drawings in the embodiments of the present invention, it should not be understood as requiring the operations to be performed in the specific order or serial order shown, or requiring the execution of all the operations shown to obtain the desired results. In certain environments, multitasking and parallel processing may be advantageous.
[0136] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for testing a heat dissipation control program, characterized in that: Applied to a virtual machine, wherein the virtual machine runs on a physical machine, the method comprises: Acquire test environment parameters, and simulate the test environment scenario of the heat dissipation control program to be tested based on the test environment parameters and a pre-built simulated test environment system; Simulating the heat dissipation control program to be tested to obtain a simulated heat dissipation control program; Running the post-simulation heat dissipation control program in the simulated test environment scenario to obtain a simulated control result output by the post-simulation heat dissipation control program; The test result of the heat dissipation control program to be tested is determined according to the target control result and the simulation control result, wherein the target control result is the control result of the heat dissipation control program to be tested that matches the test environment parameters.
2. The method for testing the heat dissipation control program according to claim 1, characterized in that: Determining the test result of the heat dissipation control program to be tested according to the target control result and the simulation control result specifically includes: In a case where the difference between the target control result and the simulated control result is less than or equal to a difference threshold, determining that the test result of the control program to be tested is passed; When the difference between the target control result and the simulated control result is greater than a difference threshold, it is determined that the test result of the control program to be tested is failed.
3. The method for testing the heat dissipation control program according to claim 2, characterized in that: After determining that the test result of the control program to be tested is failed, the method further includes: Pause the running of the post-simulation heat dissipation control program in the simulated test environment scenario, and record the simulated test environment scenario; Re-optimizing the control program to be tested according to the simulated test environment scenario to obtain an optimized control program to be tested; Simulating the optimized control program to be tested to obtain a simulated optimized heat dissipation control program; using the post-simulation optimization heat dissipation control program as the post-simulation heat dissipation control program, and restarting the post-simulation heat dissipation control program in the simulated test environment scenario, and Repeat the execution of pausing the running of the simulated post-heat dissipation control program in the simulated test environment scenario, and recording the simulated test environment scenario steps, until the simulated optimized post-heat dissipation control program is used as the simulated post-heat dissipation control program, and restarting the running of the simulated post-heat dissipation control program in the simulated test environment scenario, until the difference between the target control result and the simulated control result obtained after restarting the running of the simulated post-heat dissipation control program in the simulated test environment scenario is less than or equal to the difference threshold.
4. The method for testing the heat dissipation control program according to claim 3, characterized in that: Before re-optimizing the control program to be tested according to the simulated test environment scenario to obtain the optimized control program to be tested, the method further includes: Based on the target control result and the simulation control result, generating a heat dissipation control curve; The step of re-optimizing the control program to be tested according to the simulated test environment scenario to obtain the optimized control program to be tested specifically includes: The control program to be tested is re-optimized according to the heat dissipation control curve and the simulated test environment scenario to obtain an optimized control program to be tested.
5. The method for testing the heat dissipation control program according to claim 1, characterized in that: The test environment parameters are obtained in the following way: Acquire the test environment parameter file transmitted by the physical machine, wherein the test environment parameter file is determined according to a configuration file parsed by the physical machine, the configuration file is a configuration file corresponding to a user instruction acquired by the physical machine, and the user instruction is used to represent an instruction indicating the test environment parameter; The test environment parameter file is mounted to obtain the test environment parameters.
6. The method for testing the heat dissipation control program according to claim 1, characterized in that: The test environment parameters include dynamic test environment parameters that change continuously within a preset time period; The step of simulating the test environment scenario of the heat dissipation control program to be tested based on the test environment parameters and the pre-built simulated test environment system specifically includes: Based on the dynamic test environment parameters and the pre-built simulation test environment system, a simulated dynamic test environment scenario of the heat dissipation control program to be tested is simulated; The step of running the post-simulation heat dissipation control program in the simulated test environment scenario to obtain the simulated control result output by the post-simulation heat dissipation control program specifically includes: The post-simulation heat dissipation control program is run in the simulated dynamic test environment scenario to obtain the simulated control result output by the post-simulation heat dissipation control program in real time and dynamically.
7. The method for testing the heat dissipation control program according to claim 1, characterized in that: The simulation control results include simulation fan control results and simulation water pump control results; The step of running the post-simulation heat dissipation control program in the simulated test environment scenario to obtain the simulated control result output by the post-simulation heat dissipation control program specifically includes: Running the post-simulation heat dissipation control program in the simulated test environment scenario, obtaining a simulated fan control result output by the post-simulation heat dissipation control program based on the first file node of the virtual machine, and A simulated water pump control result output by the simulated heat dissipation control program is obtained based on the second file node of the virtual machine, wherein the first file node and the second file node are different file nodes.
8. A test device for a heat dissipation control program, characterized in that: Applied to a virtual machine, wherein the virtual machine runs on a physical machine, the device comprises: An acquisition module is used to acquire test environment parameters, and based on the test environment parameters and a pre-built simulated test environment system, simulate the simulated test environment scenario of the heat dissipation control program to be tested; A simulation module, used for simulating the heat dissipation control program to be tested to obtain a simulated heat dissipation control program; A processing module, used for running the post-simulation heat dissipation control program in the simulated test environment scenario to obtain a simulated control result output by the post-simulation heat dissipation control program; A generation module is used to determine the test result of the heat dissipation control program to be tested according to the target control result and the simulation control result, wherein the target control result is the control result of the heat dissipation control program to be tested that matches the test environment parameters.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the test method of the heat dissipation control program according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the test method of the heat dissipation control program according to any one of claims 1 to 7 is implemented.
