File damage critical time determination method, test equipment and system

By using delayed power-down, hash value matching, and time precision adjustment, the problem of insufficient control precision in power-down timing during traditional power-down testing is solved. This enables accurate reproduction and automated testing of critical times for file system corruption, improving the efficiency and accuracy of file system stability testing.

CN121326657APending Publication Date: 2026-01-13SHENZHEN EMDOOR DIGITAL TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511305427.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-12
Publication Date
2026-01-13

AI Technical Summary

Technical Problem

Traditional power-off testing lacks precision in controlling the timing of power outages, making it difficult to reproduce the critical conditions for file system corruption. Existing automated testing tools lack dedicated power-off testing modules, making it impossible to simulate complex scenarios, resulting in low efficiency in verifying file system stability.

Method used

The power-off operation is performed by delaying for a preset duration, and the hash value is checked for matching upon power-on. The preset duration is adjusted to achieve time accuracy. The critical time for file corruption is determined by combining hash value matching and time accuracy. The test parameters are dynamically adjusted, and automated equipment is used for precise control.

Benefits of technology

It enables precise reproduction of the critical time of file system corruption, improves the automation and accuracy of testing, solves the problem of insufficient control precision at the time of power failure, and enhances the efficiency and coverage of file system stability testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121326657A_ABST
    Figure CN121326657A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of reliability testing of Android equipment without a built-in battery, and discloses a file damage critical time determining method, testing equipment and a system.The method comprises the steps that after a testing file is received, power-off operation is executed by delaying a preset duration, and power-on is conducted again after power-off to detect a hash value of the file, so that whether the file is damaged or not is judged; if the current hash value is matched with the original hash value, further detecting the time precision of the preset duration, adjusting the preset duration when the time precision does not reach a set value, repeating the test, and taking the preset duration at the moment as the file damage critical time after the time precision reaches the standard; the technical means of delaying the preset time length for power-off, detecting the file state in combination with the Hash value matching and then adjusting the preset time length according to the time precision is adopted, so that the problem that the control precision of the power-off time of the traditional power-off test is insufficient is solved, and compared with the prior art, the effect of accurately reproducing the damage critical time of the file system is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of reliability testing technology for Android devices without built-in batteries, and in particular to a method, testing equipment and system for determining the critical time of file corruption. Background Technology

[0002] In the field of traditional power outage testing, the accurate simulation and verification of power outage scenarios has always been a core technical challenge. Currently, traditional power outage testing still widely relies on manual plugging and unplugging of power supplies. This method has significant drawbacks: timing accuracy errors are as high as ±1 second, which is far from meeting the requirements for capturing critical states of file reading and writing, making it difficult to reproduce critical faults such as file system corruption.

[0003] Meanwhile, while mainstream automated testing tools (such as Monkey Test) can automate processes, they lack a dedicated power-off testing module for file systems, making it impossible to focus on verifying the power-off stability of core components such as file reading and writing and data caching. Publicly available ADB testing solutions also have functional limitations, only able to detect the integrity of file transfer under normal conditions, unable to simulate real and complex scenarios such as sudden power outages and voltage drops, and thus failing to expose potential data loss or file corruption risks.

[0004] The aforementioned technological status quo directly leads to three core problems: First, the control precision for power outage timing is insufficient, making it difficult to reproduce the critical conditions for file system corruption; second, the testing process lacks an automated verification mechanism, requiring manual comparison of file hash values, which is inefficient and prone to errors; and third, existing solutions cannot dynamically adjust test parameters such as latency increments, resulting in limited test coverage and low efficiency, which seriously restricts the accuracy and large-scale advancement of file system stability testing. Summary of the Invention

[0005] The purpose of this application is to provide a method, testing equipment and system for determining the critical time of file corruption, which aims to solve the technical problem that the control accuracy of the power failure timing in traditional power failure testing is insufficient and it is difficult to reproduce the critical conditions of file system corruption.

[0006] To achieve the above objectives, this application proposes a method for determining the critical time of file corruption, the method comprising:

[0007] If a test file is received at the critical time of file corruption, a power-off operation is performed after a preset delay.

[0008] After power-down is complete, power on again and check the current hash value of the test file;

[0009] Match the current hash value with the original hash value of the test file;

[0010] If the current hash value and the original hash value match, the time precision of the preset duration is detected;

[0011] If the time accuracy does not reach the set accuracy, adjust the preset duration and re-execute the step of performing the power-off operation after a preset delay when the test file is received at the critical time of file corruption.

[0012] If the duration accuracy reaches the set accuracy, the preset duration will be used as the critical time for the test file to become corrupted.

[0013] In one embodiment, after the step of matching the current hash value with the original hash value of the test file, the method further includes:

[0014] If the current hash value and the original hash value do not match, the preset duration is increased linearly according to the time precision of the preset duration.

[0015] The procedure of performing a power-down operation after a preset delay when a test file is received that is at the critical time of file corruption is re-executed.

[0016] In one embodiment, the step of adjusting the preset duration when the time accuracy does not reach the set accuracy includes:

[0017] If the time accuracy does not reach the set accuracy, the time accuracy is adjusted step by step according to the preset accuracy level.

[0018] The preset duration is increased linearly based on the adjusted time accuracy.

[0019] The direction of adjusting the time accuracy step by step according to the preset accuracy level is the time accuracy towards the set accuracy.

[0020] In one embodiment, the step of powering back on and detecting the current hash value of the test file includes:

[0021] The power-on / off status is checked in a polling manner at preset time intervals.

[0022] When the power-on state is detected, the current hash value of the test file is detected.

[0023] In one embodiment, before the step of powering on again and detecting the current hash value of the test file after power-down is complete, the method further includes:

[0024] Set the power-off duration according to the discharge rate;

[0025] If the power-down operation takes a certain amount of time, the power-down is considered complete.

[0026] In addition, to achieve the above objectives, this application also proposes a testing device, which includes: a memory, a processor, and an image data automatic annotation program stored in the memory and executable on the processor. When the testing program is executed by the processor, it implements the file corruption critical time determination method as described above.

[0027] In addition, to achieve the above objectives, this application also proposes a testing system, which includes the testing equipment described above.

[0028] In one embodiment, the test system further includes: a host, a relay, and a power control module;

[0029] The host is connected to the power control module and the test equipment respectively; the test equipment is also connected to the power control module through the relay;

[0030] The host is used to generate test files and raw hash values ​​and transmit them to the test device;

[0031] The host is also configured to control the power control module to close the relay when the test equipment is powered on, and to control the power control module to open the relay when the test equipment is powered off.

[0032] In one embodiment, the testing system further includes: a communication module;

[0033] The communication module is connected to the host and the test equipment respectively;

[0034] The communication module is used to poll and check the power-on / off status of the test equipment at preset time intervals.

[0035] In one embodiment, the testing system further includes: a log recording module;

[0036] The log recording module is connected to the host;

[0037] The log recording module is used to record the critical time when historical files are corrupted.

[0038] This application provides a method, testing equipment, and system for determining the critical time of file corruption. The method includes: upon receiving a test file at the critical time of file corruption, performing a power-down operation after a preset delay; after power-down, powering on again and detecting the current hash value of the test file; matching the current hash value with the original hash value of the test file; if the current hash value and the original hash value match, detecting the time accuracy of the preset delay; if the time accuracy does not reach the set accuracy, adjusting the preset delay and re-executing the step of performing a power-down operation after a preset delay upon receiving the test file at the critical time of file corruption; if the time accuracy reaches the set accuracy, using the preset delay as the critical time of file corruption. By delaying the power-off operation for a preset duration after receiving the test file, and then powering it back on to check the file's hash value, the system determines whether the file is corrupted. If the current hash value matches the original hash value, the system further checks the time accuracy of the preset duration. If the time accuracy does not meet the set value, the preset duration is adjusted and the test is repeated until the time accuracy meets the standard. This preset duration is then used as the critical time for file corruption. By employing a technique that combines a preset power-off delay with hash value matching to check the file status, and then adjusting the preset duration based on time accuracy, the system solves the problem of insufficient precision in controlling the power-off timing in traditional power-off tests. Compared with existing technologies, this method achieves the effect of accurately reproducing the critical time for file system corruption. Attached Figure Description

[0039] Figure 1 A flowchart illustrating an embodiment of the method for determining the critical time of document damage in this application.

[0040] Figure 2 A flowchart illustrating Embodiment 2 of the method for determining the critical time of damage to the documents in this application;

[0041] Figure 3 This is a schematic diagram of the modules in Embodiment 3 of the test system of this application.

[0042] Explanation of icon numbers:

[0043] label name label name 100 host 400 Test equipment 200 relay 500 Communication module 300 Power control module 600 Log recording module

[0044] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0045] It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.

[0046] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0047] It should be noted that all directional indicators (such as up, down, left, right, front, back, etc.) in the embodiments of this application are only used to explain the relative positional relationship and movement of each component in a certain specific posture (as shown in the figure). If the specific posture changes, the directional indicator will also change accordingly.

[0048] Furthermore, the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. Additionally, the technical solutions of the various embodiments can be combined with each other, but only on the basis of being achievable by those skilled in the art. When the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed in this application.

[0049] Reference Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the method for determining the critical time of document damage in this application. Based on Figure 1 This application presents a first embodiment of the method for determining the critical time of damage.

[0050] In this embodiment, the method for determining the critical time of file corruption includes steps S10 to S50:

[0051] Step S10: Upon receiving a test file that is at the critical time of file corruption, perform a power-off operation after a preset delay.

[0052] It should be understood that this step is the starting point of the entire testing process. Its purpose is to simulate a specific scenario—a power outage on the file system—to explore under what circumstances files will be corrupted, thereby determining the critical time for file corruption. By introducing a preset duration, the timing of the power outage can be artificially controlled, laying the foundation for subsequent accurate testing.

[0053] It should be noted that when the system receives a specific test file used to test the critical time for file corruption, it does not immediately perform a power-down operation. Instead, it starts a timer to begin a delay for a preset duration. This preset duration is an adjustable parameter, and its initial value can be set based on experience or other relevant test data. During the delay, the file system operates normally, and the test file is in a normal read / write or storage state. When the delay reaches the preset duration, the system triggers a power-down operation, causing the file system to suddenly lose power, simulating an unexpected power outage in real-world scenarios.

[0054] Step S20: After power-down is complete, power on again and check the current hash value of the test file.

[0055] It should be understood that a power-down operation may corrupt files in the file system. Checking the hash value of a test file after power-on is to determine whether the file was corrupted during the power-down process. A hash value is a numerical value that uniquely identifies the content of a file; if the file content changes, its hash value will change accordingly. Therefore, by comparing the hash values ​​of the file before and after power-down, it is possible to accurately determine whether the file is corrupted.

[0056] It should be noted that after the power-down operation is completed, the system restores power and initiates the power-on process. The file system is reinitialized and relevant data is loaded. After power-on stabilization, the system uses a specific hash algorithm (such as MD5, SHA-1, etc.) to calculate the current hash value of the test file. This hash value reflects the actual content state of the file after the power-down operation.

[0057] Step S30: Match the current hash value with the original hash value of the test file.

[0058] It should be understood that by matching the current hash value with the original hash value, it is determined whether the test file retained its integrity during power-off, i.e., whether it was corrupted. If the two match, it means that the file content has not changed and the file is not corrupted; if the two do not match, it indicates that the file was corrupted during power-off.

[0059] It should be noted that the system compares the current hash value calculated in the previous step with the original hash value of the pre-stored test file bit by bit. If every bit of the two hash values ​​is exactly the same, the match is considered successful, meaning the file is not corrupted; if any bit is different, the match is considered unsuccessful, and the file is corrupted.

[0060] Step S40: If the current hash value and the original hash value match, detect the time precision of the preset duration.

[0061] It should be understood that when the file is not corrupted, it means that the current preset duration may be close to the critical time when the file will become corrupted. However, to determine this critical time more accurately, it is necessary to test the time accuracy of the preset duration. Time accuracy reflects the accuracy and stability of the preset duration. If the time accuracy is insufficient, it may lead to large errors in the test results, making it impossible to accurately find the critical point of file corruption.

[0062] It should be noted that the system uses high-precision time measurement tools or methods to accurately measure the preset duration of the actual delay. The measured actual duration is compared with the preset duration, and the deviation between the two is calculated. Based on the preset accuracy standard, it is determined whether the time accuracy of the current preset duration meets the requirements.

[0063] Step S50: If the time accuracy does not reach the set accuracy, adjust the preset duration and re-execute the step of performing the power-off operation after a preset delay when the test file is received at the critical time of file corruption.

[0064] It should be understood that if the time accuracy does not reach the set value, it indicates that the current preset duration is not accurate enough and needs to be adjusted to improve the test accuracy. By repeatedly adjusting the preset duration and retesting, the true critical time of file corruption can be gradually approached.

[0065] It should be noted that, based on the time accuracy detection results, the system adjusts the preset duration according to certain rules. For example, if the actual duration is longer than the preset duration and the deviation exceeds the set accuracy, the preset duration is appropriately reduced; conversely, if the actual duration is shorter than the preset duration and the deviation exceeds the set accuracy, the preset duration is appropriately increased. After adjusting the preset duration, the system returns to the first step, receives the test file again, delays for the new preset duration, and then performs a power-off operation to start a new round of testing.

[0066] Step S60: If the duration accuracy reaches the set accuracy, the preset duration is used as the critical time for the test file to be corrupted.

[0067] It should be understood that when the time precision of the preset duration reaches the set value, it means that the preset duration is accurate enough to represent the critical time when a file will be corrupted under specific conditions. Determining this preset duration as the critical time for file corruption can provide important reference for the design and optimization of the file system, helping developers take appropriate measures to improve the stability and reliability of the file system.

[0068] It should be noted that after the system detects that the time accuracy of the preset duration has reached the set precision, it records the current preset duration and stores and manages it as the critical time for test file corruption. This critical time can be used for subsequent file system testing, performance evaluation, and fault prediction.

[0069] In this embodiment, the method for determining the critical time of file corruption includes: upon receiving a test file with a critical time of file corruption, performing a power-down operation after a preset delay; after the power-down is completed, powering on again and detecting the current hash value of the test file; matching the current hash value with the original hash value of the test file; if the current hash value and the original hash value match successfully, detecting the time precision of the preset time; if the time precision does not reach the set precision, adjusting the preset time and re-executing the step of performing a power-down operation after a preset delay upon receiving a test file with a critical time of file corruption; if the time precision reaches the set precision, using the preset time as the critical time of file corruption. By delaying the power-off operation for a preset duration after receiving the test file, and then powering it back on to check the file's hash value, the system determines whether the file is corrupted. If the current hash value matches the original hash value, the system further checks the time accuracy of the preset duration. If the time accuracy does not meet the set value, the preset duration is adjusted and the test is repeated until the time accuracy meets the standard. This preset duration is then used as the critical time for file corruption. By employing a technique that combines a preset power-off delay with hash value matching to check the file status, and then adjusting the preset duration based on time accuracy, the system solves the problem of insufficient precision in controlling the power-off timing in traditional power-off tests. Compared with existing technologies, this method achieves the effect of accurately reproducing the critical time for file system corruption.

[0070] Reference Figure 2 , Figure 2 This is a flowchart illustrating a second embodiment of the method for determining the critical time of document corruption in this application. Based on the first embodiment of the method for determining the critical time of document corruption described above, a second embodiment of the method for determining the critical time of document corruption in this application is proposed. After step S30, the method further includes:

[0071] Step S301: If the current hash value and the original hash value do not match, the preset duration is linearly increased according to the time precision of the preset duration.

[0072] It's important to note that the system first evaluates the time accuracy of the preset duration. Time accuracy can be measured in various ways, such as by measuring the deviation between the actual delay and the preset duration; the smaller the deviation, the higher the time accuracy. Let's assume time accuracy is represented by a numerical value between 0 and 1, with values ​​closer to 1 indicating higher accuracy. Then, based on this time accuracy value, the required increase in duration is calculated according to a linear increment rule. Linear increment means that the increase in duration has a certain linear relationship with the time accuracy. For example, a base increment is set, and then this base increment is adjusted based on the time accuracy. If the time accuracy is high, the increase in duration may be relatively small; if the time accuracy is low, the increase in duration may be relatively large. Assuming the base increment is Δt0 and the time accuracy is p, then the actual increase in duration Δt = k × (1-p) × Δt0 (where k is an adjustment coefficient that can be adjusted according to the actual situation). Finally, the calculated increase in duration Δt is added to the original preset duration to obtain the new preset duration T_new = T_old + Δt, where T_old is the original preset duration.

[0073] Step S302: Re-execute the step of performing a power-off operation after a preset delay when a test file is received that is at the critical time of file corruption.

[0074] It should be noted that the system returns to its initial state of receiving test files, waiting to receive a specific test file to test the critical timeout for file corruption. Upon receiving the test file, the system starts a timer for a new preset duration T_new, beginning the delay. During this delay, the file system operates normally, and the test file is in a normal read / write or storage state. When the delay reaches the new preset duration T_new, the system triggers a power-down operation, causing the file system to suddenly lose power, simulating a real-world unexpected power outage. After the power-down operation is complete, the system powers on again and, following the previous procedure, checks the current hash value of the test file, then matches it with the original hash value. Based on the matching result, it determines the subsequent operation: whether to continue adjusting the preset duration or determine the critical timeout for file corruption.

[0075] Step S50 includes:

[0076] Step S501: If the time accuracy does not reach the set accuracy, adjust the time accuracy level by level according to the preset accuracy level.

[0077] It should be understood that time precision reflects the accuracy of the preset duration in actual operation. When the time precision does not reach the set precision, it means that the current preset duration is not precise enough in controlling the power-off timing, which may lead to the inability to accurately find the critical time for file corruption. Adjusting the time precision step by step according to the preset precision level is to gradually improve the accuracy of time control in an orderly and controllable manner, avoiding the impact on testing efficiency and the reliability of results due to excessive or insufficient adjustment. In this way, it is possible to more systematically approach the set precision, thereby laying the foundation for accurately determining the critical time for file corruption in the future.

[0078] It's important to note that the system first pre-sets a series of precision levels, which serve as steps for adjusting time accuracy. For example, precision levels can be set to 0.1, 0.01, 0.001, etc., with specific values ​​determined based on actual testing requirements and system capabilities. The system then determines the difference between the current time accuracy and the set precision. Based on this difference, it adjusts the precision level progressively according to the preset levels. If the current time accuracy is significantly lower than the set precision, the system will initially adjust with a larger precision level (e.g., 0.1); as the time accuracy gradually approaches the set precision, it will then fine-tune using smaller precision levels (e.g., 0.01, 0.001). The adjustment direction is always to bring the time accuracy closer to the set precision. For example, if the set precision is 0.95 and the current time accuracy is 0.8, the adjustment will increase the time accuracy value; if the current time accuracy is 0.98, exceeding the set precision (this is theoretically rare, but if it occurs, it may be due to previous over-adjustment or other factors), the adjustment will decrease the time accuracy value to ensure that the final time accuracy meets the set requirements.

[0079] Step S502: Linearly increase the preset duration according to the adjusted time accuracy.

[0080] It should be understood that after adjusting the time precision, the system obtains the adjusted time precision value. Based on this new time precision value, the required increase in preset duration is calculated according to a linear increase rule. Linear increase usually means that there is a fixed proportional relationship between the increase in duration and the adjusted time precision. For example, a basic proportional coefficient k is set, and the increase in duration Δt = k × (set precision - adjusted time precision). Here, the difference between the set precision and the adjusted time precision reflects the room for improvement in time control. By multiplying this difference by the proportional coefficient, a reasonable increase in duration is obtained. Finally, the calculated increase in duration Δt is added to the original preset duration to obtain a new preset duration T_new = T_old + Δt, where T_old is the original preset duration. This new preset duration will be used for subsequent testing, i.e., re-executing the step of delaying the power-off operation after the preset duration when a test file with a critical time of file corruption is received, to continue exploring the critical time of file corruption.

[0081] It should be noted that the direction of adjusting the time accuracy step by step according to the preset accuracy level is from the time accuracy towards the set accuracy. Assume that in a test scenario, the set accuracy is 0.98, used to measure the accuracy of controlling the power-off timing for a preset duration, and the preset accuracy level is set to 0.01. After the first test, the current time accuracy is 0.90. Since 0.90 is less than the set accuracy of 0.98, the adjustment direction is to increase the time accuracy. According to the preset accuracy level of 0.01, the current time accuracy is increased by 0.01, resulting in a new time accuracy of 0.90 + 0.01 = 0.91. Continuing the test, if the new current time accuracy is 0.93, which is still less than the set accuracy of 0.98, the time accuracy is increased again according to the preset accuracy level, resulting in 0.93 + 0.01 = 0.94. This process of testing and adjustment is repeated continuously, adjusting towards the set accuracy level each time based on the comparison between the current time accuracy and the set accuracy, until the time accuracy reaches or is sufficiently close to the set accuracy of 0.98.

[0082] Step S20 includes:

[0083] Step S201: Poll and check the power-on / off status at preset time intervals.

[0084] It should be noted that in the file corruption critical time test scenario, the power-on and power-off operations simulate actual unexpected power outages, and the file state will change due to these operations. By polling and checking the power-on and power-off status at preset time intervals, and detecting the current hash value of the test file upon power-on, the system can promptly capture the file's state changes after power outages and power-on, ensuring a complete record of all file state information during the test process. This provides a comprehensive basis for accurately determining whether the file is corrupted and identifying the corruption critical time.

[0085] It should be understood that real-time and regular checks of power-on / off status and file hash values ​​can prevent the omission of critical information due to untimely detection. For example, if a file is corrupted upon power-on after a power outage, but the hash value is not checked in time, the exact moment of corruption may not be accurately recorded, affecting the reliability of the test results. Polling checks at preset time intervals effectively solves this problem, making the testing process more rigorous and reliable.

[0086] It should be understood that the preset time interval is determined comprehensively based on factors such as test requirements and system performance. If the time interval is set too long, some key state changes will be missed, leading to inaccurate test results; if the time interval is set too short, it will increase the system load and reduce test efficiency. For example, in a test with high time accuracy requirements, the preset time interval would be set to 5 seconds to ensure that rapid changes in power-on and power-off states can be detected in a timely manner.

[0087] It should be noted that the system periodically sends query commands to the hardware or relevant modules at preset time intervals to obtain the current power-on / off status information. This process is cyclical and repeats continuously until the test ends. For example, the system starts a timer that triggers a query operation every preset time interval. The query operation communicates with the hardware through a specific interface or protocol to obtain power-on / off status data.

[0088] It should be understood that when the system receives the power-on / off status information returned from the hardware, it compares it with the preset power-on status identifier. If the returned status information matches the power-on status identifier, it is determined that the system is currently in a power-on state; otherwise, it is determined to be in a non-power-on state (such as a power-off state). For example, if the preset power-on status identifier is "1" and the power-off status identifier is "0", when the returned status value is "1", it is determined that the system is in a power-on state.

[0089] It's important to note that when a power-on state is detected, the system records the time of this power-on event. This time information is crucial for analyzing the relationship between file corruption and power-on / off times, helping to determine the specific moment the file became corrupted. Simultaneously, the system also marks this power-on event for subsequent review and analysis of the testing process.

[0090] Step S202: When the power-on state is detected, the current hash value of the test file is detected.

[0091] It should be understood that a hash value is an algorithm that maps data of arbitrary length to a fixed-length hash value, possessing uniqueness and irreversibility. For a test file, once its content changes, its hash value will also change. By calculating the current hash value of the test file and comparing it with the original hash value, it's possible to determine whether the file was corrupted during power-on / power-off processes. Common hash algorithms such as MD5 and SHA-1 can be used for this purpose.

[0092] It's important to note that upon detecting a power-on state, the system invokes the file reading module to read the contents of the test file. Then, it calculates the current hash value using a pre-selected hash algorithm. Next, it compares the current hash value with the stored original hash value. If they match, the file is not corrupted; if they differ, the file has been corrupted during the power-on / off process. For example, the system stores the calculated current hash value in a variable and then compares it with the original hash value variable using a conditional statement. Based on the comparison result, it performs appropriate operations, such as recording corruption information or stopping the test.

[0093] Before step S20, the following are included:

[0094] Step S210: Set the power-off duration according to the discharge rate.

[0095] It should be understood that measuring discharge rate requires specialized measuring tools, such as voltmeters and ammeters, combined with specific measuring circuits to measure the discharge rate of the device during the power-off process. For example, when the device is first powered off, the initial voltage value is recorded, and then the voltage value is recorded at regular time intervals. The discharge rate is calculated based on the voltage changes and time intervals. Alternatively, specialized power monitoring equipment can be used to directly acquire relevant data during the discharge process, and then the discharge rate can be calculated.

[0096] It should be noted that the formula for calculating the power-down time is established based on the relationship between the discharge rate and the time required for the device to fully discharge. Generally, the power-down time is related to factors such as the initial charge of the device and the discharge rate. For example, assuming the initial charge of the device is Q and the discharge rate is v (the amount of discharge per unit time), the power-down time t can be approximately expressed as t = Q / v. However, in actual situations, factors such as the characteristics of the device and safety margins need to be considered, and the formula needs to be appropriately modified.

[0097] It should be understood that the measured discharge rate and other relevant parameters (such as the initial charge of the device) are substituted into the power-down duration calculation formula to calculate the specific power-down duration. For example, if the initial charge of the device is measured to be 1000 mA and the discharge rate is 50 mA / s, considering factors such as safety margin, the corrected power-down duration calculation formula is t = Q / v × 1.2 (where 1.2 is the safety factor), then the power-down duration t = 1000 / 50 × 1.2 = 24 seconds.

[0098] Step S220: If the power-down operation execution time reaches the power-down duration, the power-down is deemed complete.

[0099] It should be noted that at the instant the power-down operation begins, the system starts a timer to record the execution duration of the operation. The timer can be a hardware timer or a software timer. Hardware timers offer higher accuracy but are relatively more expensive; software timers are simpler to implement and less expensive, but their accuracy may be affected by factors such as the system's operating status. The timer continuously updates the execution duration data of the power-down operation at regular time intervals (e.g., 1 millisecond) and stores the updated data in a specific variable for the system to read and analyze at any time.

[0100] It should be understood that the system periodically reads the power-down operation execution duration data recorded by the timer and compares it with the preset power-down duration. For example, the system reads the timer data every 100 milliseconds and then compares it with the power-down duration. When the power-down operation execution duration is greater than or equal to the preset power-down duration, the system determines that the power-down is complete. For example, if the preset power-down duration is 24 seconds, the system determines that the power-down operation is complete when the timer records 24 seconds of power-down operation execution duration. Once the power-down is determined to be complete, the system will trigger subsequent operations according to a preset process. For example, in a file corruption critical time test, after completing the power-down, the system will wait for a period of time, then perform a power-on operation and continue with related test steps such as file status detection.

[0101] In this embodiment, by detecting the time precision of a preset duration, the preset duration is adjusted when the set precision is not reached. The time precision is adjusted incrementally according to preset precision levels, and the preset duration is increased linearly. This allows for more accurate reproduction of the critical conditions for file system corruption, solving the problem of insufficient precision in power-off timing control in existing technologies. Upon power-on, the current hash value of the test file is automatically detected and matched with the original hash value, eliminating the need for manual comparison and avoiding the inefficiency and error-prone nature of manual operations, thus improving testing efficiency and accuracy. The preset duration can be dynamically adjusted based on the time precision and hash value matching, overcoming the limitations of existing solutions that cannot dynamically adjust test parameters, resulting in limited test coverage and low efficiency. This is beneficial for improving the accuracy and scalability of file system stability testing. The power-down duration is set according to the discharge rate, and power-down is considered complete when the power-down operation execution time reaches the set duration, ensuring the accurate execution of the power-down operation.

[0102] In addition, this application also proposes a testing device 400, which includes: a memory, a processor, and an image data automatic annotation program stored in the memory and executable on the processor. When the testing program is executed by the processor, it implements the file corruption critical time determination method as described above.

[0103] Since the testing equipment 400 adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought about by the technical solutions of the above embodiments, which will not be repeated here.

[0104] In addition, this application also proposes a testing system, which includes the testing equipment 400 as described above.

[0105] Since the testing system adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought about by the technical solutions of the above embodiments, which will not be repeated here.

[0106] Reference Figure 3 , Figure 3 This is a schematic diagram of the modules in Embodiment 3 of the test system of this application. Based on the first and second embodiments of the above-described method for determining the critical time for file corruption, a third embodiment of the test system of this application is proposed.

[0107] The testing system also includes: a host 100, a relay 200, and a power control module 300;

[0108] The host 100 is connected to the power control module 300 and the test equipment 400 respectively; the test equipment 400 is also connected to the power control module 300 through the relay 200.

[0109] It should be noted that the host 100 and the power control module 300 are directly connected. This connection allows the host 100 to directly control the power control module 300, enabling information exchange and command transmission. The host 100 is also directly connected to the test device 400. Through this connection, the host 100 can transmit the generated test files and raw hash values ​​to the test device 400, providing necessary data support for subsequent testing. The test device 400 is connected to the power control module 300 via a relay 200. The relay 200 plays a crucial switching role here; its on / off state is controlled by the power control module 300, thereby realizing the connection and disconnection between the test device 400 and the power supply, simulating the power-on and power-off process of the device.

[0110] The host 100 is used to generate test files and original hash values ​​and transmit them to the test device 400;

[0111] The host 100 is also used to control the power control module 300 to close the relay 200 when the test equipment 400 is powered on, and to control the power control module 300 to open the relay 200 when the test equipment 400 is powered off.

[0112] It should be understood that the host 100 is responsible for generating the test files and their corresponding raw hash values, and transmitting these data to the test device 400. The test files are the core object of the entire testing process, while the raw hash values ​​serve as an important basis for subsequent verification of whether the test files are corrupted. Based on the testing requirements, the host 100 sends a command to the power control module 300 when the test device 400 is powered on, controlling it to close relay 200 to connect the power to the test device 400; when the test device 400 is powered off, it sends a command to the power control module 300 to open relay 200 to disconnect the power to the test device 400. In this way, the host 100 achieves precise control over the power-on and power-off processes of the test device 400.

[0113] It should be noted that relay 200, acting as a connection bridge between power control module 300 and test equipment 400, is itself an electromagnetic switch. Under the control of power control module 300, relay 200 can switch between on and off states, thereby controlling the power supply to test equipment 400, simulating sudden power outages and power-on events in actual use, and providing necessary test conditions for testing the critical time of document corruption.

[0114] It should be understood that the power control module 300 receives instructions from the host 100 and controls the closing and opening of the relay 200 according to the instructions. It accurately executes the power-on and power-off commands issued by the host 100, ensuring that the test equipment 400 can be powered on or off at the correct time, thus guaranteeing the accuracy and reliability of the test process.

[0115] The testing system also includes: a communication module 500;

[0116] The communication module 500 is connected to the host 100 and the test device 400 respectively;

[0117] The communication module 500 is used to poll and check the power-on / off status of the test device 400 at preset time intervals.

[0118] It should be noted that the host 100 can make corresponding decisions and control operations based on the power-on / off status information of the test device 400 fed back by the communication module 500. For example, when it is detected that the test device 400 has completed the power-off operation, the host 100 can control the power control module 300 to perform the subsequent power-on operation, or record key time points in the test process based on the changes in the power-on / off status for analysis of the critical time for file corruption.

[0119] It should be understood that by monitoring the power-on and power-off status of the test equipment 400 in real time, the communication module 500 can promptly detect any abnormalities that may occur during the test, such as the test equipment 400 failing to power on or off normally. Upon receiving this abnormal information, the host 100 can take timely measures to handle the situation, such as resending control commands or issuing alarm prompts, thereby ensuring the smooth progress of the test process and improving the reliability and stability of the test system.

[0120] It's important to understand that the polling and checking function of the communication module 500 enables the host 100 to automatically obtain the status information of the test equipment 400 without manual intervention. This significantly improves the automation level of the testing process, reduces the impact of human factors on the test results, and also improves testing efficiency, making it particularly suitable for large-scale, long-term testing tasks.

[0121] The testing system also includes: a log recording module 600;

[0122] The log recording module 600 is connected to the host 100;

[0123] The log recording module 600 is used to record the critical time when historical files are corrupted.

[0124] It should be understood that the host 100 sends the acquired file corruption threshold time and related information to the logging module 600, which is responsible for receiving and storing this data. The host 100 can send data to the logging module 600 in real-time or periodically as needed for testing. The host 100 can configure the logging module 600, such as setting the logging level (e.g., debug level, information level, warning level, error level), the storage path of the log files, and the storage period. Through appropriate configuration, the logging needs of different testing scenarios can be met. The host 100 can send query requests to the logging module 600 to obtain log records within a specific time period or under specific conditions. Based on the host 100's request, the logging module 600 retrieves relevant information from the stored log data and returns it to the host 100. The host 100 can then analyze and process this log data to generate test reports or visualizations.

[0125] In this embodiment, the host 100 controls the power control module 300 to close or open the relay 200, thereby precisely controlling the power-on and power-off processes of the test equipment 400. This control method can simulate various power outages and power-on situations that may occur in actual use, such as sudden power outages and timed power outages and restarts, providing a comprehensive testing environment for the stability of the test file system under different power outage scenarios and helping to discover potential problems of the file system under complex power change conditions. The communication module 500 polls and checks the power-on and power-off status of the test equipment 400 at preset time intervals and feeds the information back to the host 100. This allows the host 100 to monitor the operating status of the test equipment 400 in real time and promptly detect any abnormalities that may occur during the test, such as the test equipment 400 failing to power on or off normally. Once an abnormality is detected, the host 100 can quickly take measures, such as resending control commands or issuing alarm prompts, thereby ensuring the smooth progress of the test process and improving the reliability and stability of the test system. Through real-time monitoring of the status of the test equipment 400, the system can better cope with various emergencies. For example, if a power fluctuation causes an unexpected power outage of the test device 400 during testing, the communication module 500 can detect this change in a timely manner. The host 100 can then handle the situation according to a preset strategy, such as recording the power outage time and waiting for the power to stabilize before resuming testing. This prevents test interruptions or data loss due to unexpected situations and enhances the system's fault tolerance. The host 100 generates test files and their original hash values ​​and transmits them to the test device 400. The original hash values ​​provide an accurate basis for subsequent verification of whether the test files are corrupted. During testing, by comparing the hash values ​​of the test files before and after power-on / off, it is possible to accurately determine whether the files have been corrupted, thereby determining the critical time for file corruption. This hash-based verification method has high accuracy and reliability, eliminating interference from other factors in determining file integrity and providing a solid data foundation for the test results. The log recording module 600 records historical file corruption critical times, as well as related test file information, test time information, and test environment information. These detailed log records provide rich material for subsequent data analysis and troubleshooting. By analyzing historical data, trends and patterns in file corruption threshold times can be identified, file system performance can be evaluated, performance bottlenecks can be identified, and targeted optimizations and improvements can be made. Simultaneously, in the event of a failure, logging helps developers and testers quickly pinpoint the root cause of the problem, improving problem-solving efficiency. Throughout the testing process, host 100 can automatically generate test files, control the power supply and shutdown of test device 400, receive device status information from communication module 500, and record logs, all without manual intervention. This automated testing method significantly improves testing efficiency and reduces the impact of human factors on test results, making it particularly suitable for large-scale, long-term testing tasks.The collaborative work between the system modules makes the testing process more compact and efficient. The host 100 can automatically adjust the testing strategy and schedule based on the device status information fed back by the communication module 500. For example, after the test device 400 completes one power-on / off cycle, it automatically starts the next test without waiting for manual intervention. At the same time, the automatic recording function of the log recording module 600 saves time and effort in manually recording data, allowing testers to devote more energy to the analysis and optimization of test results.

[0126] The above are only some embodiments of this application and do not limit the scope of implementation of this application. Any equivalent structural or procedural transformations made based on the content of this application specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the protection scope of this application.

Claims

1. A method for determining the critical time for file corruption, characterized in that, The method for determining the critical time for file corruption includes: If a test file is received at the critical time of file corruption, a power-off operation is performed after a preset delay. After power-down is complete, power on again and check the current hash value of the test file; Match the current hash value with the original hash value of the test file; If the current hash value and the original hash value match, the time precision of the preset duration is detected; If the time accuracy does not reach the set accuracy, adjust the preset duration and re-execute the step of performing the power-off operation after a preset delay when the test file is received at the critical time of file corruption. If the duration accuracy reaches the set accuracy, the preset duration will be used as the critical time for the test file to become corrupted.

2. The method for determining the critical time of file corruption as described in claim 1, characterized in that, After the step of matching the current hash value with the original hash value of the test file, the method further includes: If the current hash value and the original hash value do not match, the preset duration is increased linearly according to the time precision of the preset duration. The procedure of performing a power-down operation after a preset delay when a test file is received that is at the critical time of file corruption is re-executed.

3. The method for determining the critical time of file corruption as described in claim 1, characterized in that, The step of adjusting the preset duration when the time accuracy does not reach the set accuracy includes: If the time accuracy does not reach the set accuracy, the time accuracy is adjusted step by step according to the preset accuracy level. The preset duration is increased linearly based on the adjusted time accuracy. The direction of adjusting the time accuracy step by step according to the preset accuracy level is the time accuracy towards the set accuracy.

4. The method for determining the critical time of file corruption as described in claim 1, characterized in that, The step of powering back on and detecting the current hash value of the test file includes: The power-on / off status is checked in a polling manner at preset time intervals. When the power-on state is detected, the current hash value of the test file is detected.

5. The method for determining the critical time of file corruption as described in claim 1, characterized in that, Before the step of powering on again and detecting the current hash value of the test file after the power-down is completed, the method further includes: Set the power-off duration according to the discharge rate; If the power-down operation takes a certain amount of time, the power-down is considered complete.

6. A testing device, characterized in that, The testing device includes: a memory, a processor, and an automatic image data annotation program stored in the memory and executable on the processor. When the testing program is executed by the processor, it implements the file corruption critical time determination method as described in any one of claims 1 to 5.

7. A testing system, characterized in that, The testing system includes the testing equipment as described in claim 6.

8. The testing system as described in claim 7, characterized in that, The testing system also includes: a host, relays, and a power control module; The host is connected to the power control module and the test equipment respectively; the test equipment is also connected to the power control module through the relay; The host is used to generate test files and raw hash values ​​and transmit them to the test device; The host is also configured to control the power control module to close the relay when the test equipment is powered on, and to control the power control module to open the relay when the test equipment is powered off.

9. The testing system as described in claim 8, characterized in that, The testing system also includes: a communication module; The communication module is connected to the host and the test equipment respectively; The communication module is used to poll and check the power-on / off status of the test equipment at preset time intervals.

10. The testing system as described in claim 8, characterized in that, The testing system also includes: a log recording module; The log recording module is connected to the host; The log recording module is used to record the critical time when historical files are corrupted.