A file system testing method and device

By generating multiple random access intervals in the file system and performing coverage write and random read tests, the problem of low efficiency of coverage write testing in the existing technology is solved, comprehensive testing and cross-validation of the distributed file system are achieved, and the efficiency is improved Test efficiency and accuracy.

CN112306954BActive Publication Date: 2024-09-13BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202011179909.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-29
Publication Date
2024-09-13
Estimated Expiration
2040-10-29

AI Technical Summary

Technical Problem

The coverage and write testing methods for distributed file systems in the existing technology are inefficient and cannot effectively verify the integrity of data and the intersection of read and write operations, resulting in incomplete test results.

Method used

By generating multiple random access intervals in the file system and performing overwrite and random read tests on them, we ensure the correctness of the file system under various random input and output modes and achieve cross-validation of overwrite and random reads.

Benefits of technology

It improves the efficiency and accuracy of file system testing, ensures comprehensive testing of the file system, can verify and cover all possible random IO read and write patterns, and solves the problem of low testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112306954B
    Figure CN112306954B
Patent Text Reader

Abstract

The present application relates to a method and device for testing a file system, wherein the method comprises: generating a plurality of first access intervals corresponding to a target interval of a first random capacity in a file system to be tested, wherein the plurality of first access intervals correspond one-to-one to a plurality of random input modes of the target interval; performing an overwrite test on each of the plurality of first access intervals; if the file system passes the overwrite test, generating a plurality of second access intervals corresponding to each first access interval, wherein the plurality of second access intervals correspond one-to-one to a plurality of random output modes of each first access interval; performing a random read test on each of the plurality of second access intervals, wherein if the plurality of second access intervals are all tested successfully, it is determined that the file system passes the random read test. The present application solves the technical problem of low efficiency in testing a file system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a method and device for testing a file system. Background Art

[0002] As the scale of data increases, the file system of a single machine can no longer meet people's demand for read and storage, so the demand for distributed file systems is becoming increasingly strong. The reading and writing methods of file storage are mainly divided into two categories: sequential reading and writing and random reading and writing. Among them, random writing is divided into overwrite writing and append writing, and overwrite writing is the most difficult to implement, so the demand for correctness checking of overwrite writing is high, and the testing method for overwrite writing is very important. The current testing method for random writing in the industry's distributed file storage is mainly tested by general benchmark tools. This method simply provides a running tool. On the one hand, it requires testers to perform complex configurations according to the options in the tool. On the other hand, the test tool can only simply check whether the request result is successful, and cannot test data integrity, cross-validation of read and write operations, etc.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] The present application provides a method and device for testing a file system, so as to at least solve the technical problem of low efficiency in testing a file system in the related art.

[0005] According to one aspect of an embodiment of the present application, a method for testing a file system is provided, comprising:

[0006] Generating a plurality of first access intervals corresponding to a target interval of a first random capacity in a file system to be tested, wherein the plurality of first access intervals correspond one-to-one to a plurality of random input modes of the target interval;

[0007] Performing an overwrite test on each of the plurality of first access intervals, wherein if the plurality of first access intervals are all tested successfully, determining that the file system passes the overwrite test;

[0008] In a case where the file system passes the overwrite test, generating a plurality of second access intervals corresponding to each of the first access intervals, wherein the plurality of second access intervals correspond one-to-one to the plurality of random output modes of each of the first access intervals;

[0009] A random read test is performed on each of the plurality of second access intervals, wherein when the plurality of second access intervals are all tested successfully, it is determined that the file system passes the random read test.

[0010] Optionally, generating a plurality of first access intervals corresponding to a target interval of a first random capacity in the file system to be tested includes:

[0011] Determine a first all-set state corresponding to a target interval, wherein the first all-set state is used to indicate all states allowed to exist between the target interval and the first access interval;

[0012] In the file system to be tested, access areas having each of the first set states in all the first set states between the target interval are generated to obtain the multiple first access areas.

[0013] Optionally, the first entire set state includes: an intersection state, a non-intersection state, a contained state and an inclusion state; wherein the intersection state is used to indicate that the target interval intersects with the first access area, the non-intersection state is used to indicate that the target interval has no intersection with the first access area, the contained state is used to indicate that the first access area is contained by the target interval, and the inclusion state is used to indicate that the first access area contains the target interval.

[0014] Optionally, performing an overwrite test on each first access interval in the plurality of first access intervals includes:

[0015] traversing each first access interval of the plurality of first access intervals in a random order;

[0016] Performing an overwrite operation on each of the first access intervals;

[0017] When each of the first access intervals is written successfully, performing content verification on the file where each of the first access intervals is located;

[0018] In the case where the content verification of the file in each first access interval is successful, it is determined that the test of each first access interval is successful.

[0019] Optionally, generating a plurality of second access intervals corresponding to each first access interval includes:

[0020] Determine a second all-set state corresponding to each of the first access intervals, wherein the second all-set state is used to indicate all states allowed to exist between the first access interval and the second access interval;

[0021] An access area having each second set state between the first access interval and the second access area is generated to obtain the plurality of second access areas.

[0022] Optionally, the second full set state includes at least one of the following: a partial intersection state, a left boundary intersection state, a right boundary intersection state, a no intersection state, a contained state, a fully contained state, a left boundary containing state and a right boundary containing state; wherein the partial intersection state is used to indicate that the first access interval partially intersects with the second access area, the left boundary intersection state is used to indicate that the second access interval intersects with the left boundary of the first access area, the right boundary intersection state is used to indicate that the second access interval intersects with the right boundary of the first access area, the no intersection state is used to indicate that the first access interval has no intersection with the second access area, the contained state is used to indicate that the second access area is contained by the first access area, the fully contained state is used to indicate that the second access area completely contains the first access area, the left boundary containing state is used to indicate that the second access area contains the first access area and the first access area has the same left boundary as the first access area, and the right boundary containing state is used to indicate that the second access area contains the first access area and the first access area has the same right boundary as the first access area.

[0023] Optionally, performing a random read test on each second access interval in the plurality of second access intervals includes:

[0024] traversing each second access interval of the plurality of second access intervals in a random order;

[0025] Sending a random read request to each second access interval;

[0026] In the case where the request to each second access interval is successful, performing content verification on the response data returned by each second access interval in response to the random read request and the write data written to each second access interval in the overwrite test;

[0027] When the response data corresponding to each second access interval is consistent with the written data content, it is determined that the test of each second access interval is successful.

[0028] Optionally, before generating a plurality of first access intervals corresponding to the target interval of the first random capacity in the file system to be tested, the method further includes:

[0029] Generating a storage file of a second random capacity in the file system, wherein the second random capacity is greater than or equal to the first random capacity;

[0030] A random block of the first random capacity is generated in the storage file as the target interval.

[0031] According to another aspect of an embodiment of the present application, a test device for a file system is also provided, including:

[0032] A first generating module, configured to generate a plurality of first access intervals corresponding to a target interval of a first random capacity in a file system to be tested, wherein the plurality of first access intervals correspond one-to-one to a plurality of random input modes of the target interval;

[0033] A first testing module, configured to perform an overwrite test on each of the plurality of first access intervals, wherein if the plurality of first access intervals are all tested successfully, it is determined that the file system passes the overwrite test;

[0034] A second generating module is used to generate a plurality of second access intervals corresponding to each of the first access intervals when the file system passes the overwrite test, wherein the plurality of second access intervals correspond to the plurality of random output modes of each of the first access intervals in a one-to-one manner;

[0035] The second testing module is configured to perform a random read test on each of the plurality of second access intervals, wherein if the plurality of second access intervals are all tested successfully, it is determined that the file system has passed the random read test.

[0036] According to another aspect of an embodiment of the present application, a storage medium is further provided, which includes a stored program, and the above method is executed when the program is run.

[0037] According to another aspect of an embodiment of the present application, an electronic device is further provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above method through the computer program.

[0038] In an embodiment of the present application, a plurality of first access intervals corresponding to a target interval of a first random capacity are generated in a file system to be tested, wherein the plurality of first access intervals correspond one-to-one to a plurality of random input modes of the target interval; an overwrite test is performed on each of the plurality of first access intervals, wherein, if the plurality of first access intervals are tested successfully, it is determined that the file system has passed the overwrite test; if the file system has passed the overwrite test, a plurality of second access intervals corresponding to each first access interval are generated, wherein the plurality of second access intervals correspond one-to-one to a plurality of random output modes of each first access interval; a random read test is performed on each of the plurality of second access intervals, wherein, if the plurality of second access intervals are tested successfully, it is determined that the file system has passed the random read test. The method adopts a method for testing a first random capacity target interval in a file system to be tested as a test target of the file system, generates multiple first access intervals of random input modes corresponding to multiple target intervals, performs an overwrite test on each first access interval, and determines that the file system passes the overwrite test if the multiple first access intervals are tested successfully, thereby being able to test the overwrite operation of the target interval under various random input modes; if the file system passes the overwrite test, then continues to perform random read tests of various random output modes on the file system, thereby achieving the purpose of verifying whether the file system covers all possible random IO read and write modes, and being able to realize cross-verification of write and read intervals, thereby achieving the technical effect of improving the test efficiency of the file system, thereby solving the technical problem of low test efficiency of the file system in the related art. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0041] Figure 1 is a schematic diagram of a hardware environment of a method for testing a file system according to an embodiment of the present application;

[0042] Figure 2 is a flowchart of an optional file system testing method according to an embodiment of the present application;

[0043] Figure 3 is a schematic diagram of an optional file system testing device according to an embodiment of the present application;

[0044] Figure 4 It is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0045] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0046] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0047] According to one aspect of an embodiment of the present application, a method embodiment of a file system test is provided.

[0048] Optionally, in this embodiment, the above file system testing method can be applied to Figure 1 In the hardware environment composed of the terminal 101 and the server 103 shown in FIG. Figure 1 As shown, the server 103 is connected to the terminal 101 through a network, and can be used to provide services (such as game services, application services, etc.) for the terminal or the client installed on the terminal. A database can be set on the server or independently of the server to provide data storage services for the server 103. The above network includes but is not limited to: a wide area network, a metropolitan area network or a local area network, and the terminal 101 is not limited to a PC, a mobile phone, a tablet computer, etc. The test method of the file system of the embodiment of the present application can be executed by the server 103, or by the terminal 101, or by the server 103 and the terminal 101. Among them, the terminal 101 executes the test method of the file system of the embodiment of the present application, and it can also be executed by the client installed thereon.

[0049] Figure 2is a flowchart of an optional file system testing method according to an embodiment of the present application, such as Figure 2 As shown, the method may include the following steps:

[0050] Step S202, generating a plurality of first access intervals corresponding to a target interval of a first random capacity in a file system to be tested, wherein the plurality of first access intervals correspond one-to-one to a plurality of random input modes of the target interval;

[0051] Step S204, performing an overwrite test on each of the plurality of first access intervals, wherein if the tests on the plurality of first access intervals are all successful, it is determined that the file system passes the overwrite test;

[0052] Step S206, when the file system passes the overwrite test, generating a plurality of second access intervals corresponding to each of the first access intervals, wherein the plurality of second access intervals correspond one-to-one to the plurality of random output modes of each of the first access intervals;

[0053] Step S208: performing a random read test on each of the plurality of second access intervals, wherein if the plurality of second access intervals are all tested successfully, it is determined that the file system passes the random read test.

[0054] Through the above steps S202 to S208, the target interval of the first random capacity in the file system to be tested is used as the test target of the file system, and multiple first access intervals of random input modes corresponding to multiple target intervals are generated. An overwrite test is performed on each first access interval. If the multiple first access intervals are tested successfully, it is determined that the file system passes the overwrite test, so that the overwrite operation of the target interval under various random input modes can be tested. If the file system passes the overwrite test, the random read test of various random output modes is continued to be performed on the file system, thereby achieving the purpose of verifying whether the file system covers all possible random IO read and write modes, and being able to achieve cross-verification of the write and read intervals, thereby achieving the technical effect of improving the test efficiency of the file system, and further solving the technical problem of low test efficiency of the file system in the related art.

[0055] Optionally, in this embodiment, the above-mentioned file system test method can be applied to, but not limited to, a scenario of performing an overwrite test on a file system during a file system test phase. The above-mentioned file system test method can be packaged as, but not limited to, a test plug-in, a test program, a test tool, etc. The tester connects the test tool to the file system to be tested to run it, and the test tool can automatically perform an overwrite test on the file system and give corresponding test results.

[0056] In the technical solution provided in step S202, the above-mentioned file system may be, but is not limited to, a distributed file system.

[0057] Optionally, in this embodiment, the first random capacity target interval is a storage interval with random capacity randomly generated in the file system, for example, the file system randomly uses a storage interval of [500MB, 600MB] as a target interval for overwrite test.

[0058] Optionally, in this embodiment, the multiple first access intervals corresponding to the target interval correspond one-to-one to the multiple random input modes of the target interval, that is, each first access interval corresponds to a random input mode of the target interval, which can cover all possible random input modes of the target interval.

[0059] In the technical solution provided in step S204, if the multiple first access intervals are tested successfully, it is determined that the file system passes the overwrite test. If any first access interval among the multiple first access intervals fails the test, it is determined that the file system fails the overwrite test.

[0060] Optionally, in this embodiment, for the first access interval where the test fails, the reason for the failure can be prompted through a prompt message, that is, the random input pattern corresponding to the first access interval where the test fails can be prompted, so that the tester can intuitively understand which random input pattern of the file system may have problems, and thus perform targeted repairs.

[0061] In the technical solution provided in step S206, after the file system passes the overwrite test, a random read test is continued to be performed on it, thereby achieving cross-verification of the write and read intervals.

[0062] Optionally, in this embodiment, multiple second access intervals correspond one-to-one to multiple random output modes of each first access interval, that is, each second access interval corresponds to a random output mode of the first access interval, which can cover all possible random output modes of the first access interval.

[0063] In the technical solution provided in step S208, if the multiple second access intervals are tested successfully, it is determined that the file system passes the random read test. If any second access interval among the multiple second access intervals fails the test, it is determined that the file system fails the overwrite test.

[0064] Optionally, in this embodiment, for the second access interval that fails the test, the reason for the failure can be prompted through a prompt message, that is, the random output mode corresponding to the second access interval that fails the test can be prompted, so that the tester can intuitively understand which random output mode of the file system may have problems, and thus perform targeted repairs.

[0065] As an optional embodiment, generating a plurality of first access intervals corresponding to a target interval of a first random capacity in a file system to be tested includes:

[0066] S11, determining a first all-set state corresponding to a target interval, wherein the first all-set state is used to indicate all states allowed to exist between the target interval and the first access interval;

[0067] S12, generating, in the file system to be tested, access areas having each of the first set states in all the first set states between the target interval and the target interval, to obtain the plurality of first access areas.

[0068] Optionally, in this embodiment, the first entire set state includes: an intersection state, a non-intersection state, a contained state and an inclusion state, wherein the intersection state is used to indicate that the target interval intersects with the first access area, the non-intersection state is used to indicate that the target interval has no intersection with the first access area, the contained state is used to indicate that the first access area is contained by the target interval, and the inclusion state is used to indicate that the first access area contains the target interval.

[0069] In an optional embodiment, taking [50MB, 60MB] as the target interval, four possible first access intervals for performing overwrite tests can be generated according to the interval range of the target interval and the four possible states of the two sets: the first access interval of the intersection state [30MB, 50MB], the first access interval of the non-intersection state [70MB, 80MB], the first access interval of the included state [52MB, 55MB], and the first access interval of the inclusion state [45MB, 70MB].

[0070] Optionally, in this embodiment, the above intersection states include: a partial intersection state, a left boundary intersection state, and a right boundary intersection state. In the process of randomly generating the first access interval of the intersection state, the above three intersection states may all be generated. In the first full set state, which intersection states are generated may be set, or the type of the generated intersection state may not be set, and one of them may be randomly generated.

[0071] Optionally, in this embodiment, the above-mentioned inclusion states include: a full inclusion state, a left boundary inclusion state, and a right boundary inclusion state. In the process of randomly generating the first access interval of the inclusion state, the above-mentioned three inclusion states may all be generated. In the first full set state, it is possible to set which inclusion states are generated, or it is possible not to set the type of the generated inclusion state, and it is sufficient to randomly generate one of them.

[0072] Optionally, in this embodiment, the first all-set state is used to indicate all states that are allowed to exist between the target interval and the first access interval, and different types of target intervals may correspond to different first all-set states. For example: if the target interval is [0MB, 50MB], then the corresponding first all-set state may include: partial intersection state, right boundary intersection state, no intersection state, included state, and left boundary included state. For a 500MB file system, if the target interval is [400MB, 500MB], then the corresponding first all-set state may include: partial intersection state, left boundary intersection state, no intersection state, included state, and right boundary included state.

[0073] As an optional embodiment, performing an overwrite test on each first access interval in the plurality of first access intervals includes:

[0074] S21, traversing each first access interval of the multiple first access intervals in a random order;

[0075] S22, performing an overwrite operation on each of the first access intervals;

[0076] S23, when each first access interval is written successfully, performing content verification on the file where each first access interval is located;

[0077] S24, when the content verification of the file in each first access interval is successful, determining that the test of each first access interval is successful.

[0078] Optionally, in this embodiment, a first access interval is randomly selected from multiple first access intervals for overwrite testing, and the test results are output after all the tests on the multiple first access intervals are completed. Alternatively, the test can be stopped immediately if a test failure occurs, and the reason for the failure is prompted.

[0079] Optionally, in this embodiment, after the overwrite operation is performed on each first access interval and the writing is successful, the written content can be checked to verify the integrity of the written data, thereby realizing the integrity check of the data during the random IO mode.

[0080] Optionally, in this embodiment, if a first access interval passes both the overwrite operation and the content verification, it is determined that the overwrite test is successful.

[0081] In the above optional implementation, the first access interval [70MB, 80MB] is selected to perform an overwrite operation to write new data. If the write fails, the program exits, indicating a program bug; if the write succeeds, a content check is initiated for the entire file. If the check fails, the program exits, indicating a program bug; if the check succeeds, the test of the next first access interval is continued. The first access interval [52MB, 55MB] is selected to perform an overwrite operation to write new data. If the write fails, the program exits, indicating a program bug; if the write succeeds, a content check is initiated for the entire file. If the check fails, the program exits, indicating a program bug; if the check succeeds, the test of the next first access interval is continued. The first access interval [45MB, 70MB] is selected to perform an overwrite operation to write new data. If the write fails, the program exits, indicating a program bug; if the write succeeds, a content check is initiated for the entire file. If the check fails, the program exits, indicating a program bug; if the check succeeds, the test of the next first access interval is continued. Select the first access interval [30MB, 50MB] to perform an overwrite operation to write new data. If the write fails, exit, indicating a program bug. If the write succeeds, initiate a content check on the entire file. If the check fails, exit, indicating a program bug. If the check succeeds, it is determined that the file system has passed the overwrite test.

[0082] As an optional embodiment, generating a plurality of second access intervals corresponding to each first access interval includes:

[0083] S31, determining a second all-set state corresponding to each first access interval, wherein the second all-set state is used to indicate all states allowed to exist between the first access interval and the second access interval;

[0084] S32: Generate an access area in which each second set state exists between each first access interval and the second set state, to obtain the plurality of second access areas.

[0085] Optionally, in this embodiment, the second full set state includes at least one of the following: a partial intersection state, a left boundary intersection state, a right boundary intersection state, a no intersection state, a contained state, a fully contained state, a left boundary containing state and a right boundary containing state; wherein the partial intersection state is used to indicate that the first access interval partially intersects with the second access area, the left boundary intersection state is used to indicate that the second access interval intersects with the left boundary of the first access area, the right boundary intersection state is used to indicate that the second access interval intersects with the right boundary of the first access area, the no intersection state is used to indicate that the first access interval has no intersection with the second access area, the contained state is used to indicate that the second access area is contained by the first access area, the fully contained state is used to indicate that the second access area completely contains the first access area, the left boundary containing state is used to indicate that the second access area contains the first access area and the first access area has the same left boundary as the first access area, and the right boundary containing state is used to indicate that the second access area contains the first access area and the first access area has the same right boundary as the first access area.

[0086] In the above optional implementation, taking the above first access interval [30MB, 50MB] as an example, according to the possible states of the two sets, the second access interval of 8 states is generated: the second access interval of partial intersection state [20MB, 40MB], the second access interval of left boundary intersection state [20MB, 30MB], the second access interval of right boundary intersection state [50MB, 60MB], the second access interval of non-intersection state [10MB, 20MB], the second access interval of included state [35MB, 45MB], the second access interval of left boundary inclusion state [30MB, 60MB], the second access interval of right boundary inclusion state [20MB, 50MB], the second access interval of full inclusion state [10MB, 70MB].

[0087] Optionally, in this embodiment, the second all-set state is used to indicate all states that are allowed to exist between the first access interval and the second access interval, and different types of first access intervals may correspond to different second all-set states. For example: if the first access interval is [0MB, 50MB], then the corresponding second all-set state may include: partial intersection state, right boundary intersection state, no intersection state, included state, and left boundary included state. For a 500MB file system, the target interval is [400MB, 500MB], then the corresponding second all-set state may include: partial intersection state, left boundary intersection state, no intersection state, included state, and right boundary included state.

[0088] As an optional embodiment, performing a random read test on each second access interval in the plurality of second access intervals includes:

[0089] S41, traversing each second access interval in the plurality of second access intervals in a random order;

[0090] S42, sending a random read request to each second access interval;

[0091] S43, when the request to each second access interval is successful, performing content verification on the response data returned by each second access interval in response to the random read request and the write data written to each second access interval in the overwrite test;

[0092] S44, when the response data corresponding to each second access interval is consistent with the written data content, determining that the test of each second access interval is successful.

[0093] Optionally, in this embodiment, a second access interval is randomly selected from multiple second access intervals corresponding to each first access interval to perform a random read test, and the test results are output after all multiple first access intervals are tested. Alternatively, the test can be stopped immediately if a test failure occurs, and the reason for the failure is prompted.

[0094] Optionally, in this embodiment, after a random read request is initiated to each second access interval and the read is successful, a content check may be performed on the read content to verify the consistency of the read data with the written data, thereby achieving consistency check of data during random IO mode.

[0095] Optionally, in this embodiment, if a second access interval passes both the random read request and the content verification, it is determined that the random read test is successful.

[0096] In the above optional implementation manner, 8 second access intervals generated for the first access interval [30MB, 50MB] are selected in random order to initiate a random read request. If the request fails, the program exits, indicating a program bug. If the request succeeds, the consistency of the read content and the written content is verified. If the content is inconsistent, the program exits, indicating a program bug. If the content is consistent, the program continues to test the next first access interval.

[0097] As an optional embodiment, before generating a plurality of first access intervals corresponding to the target interval of the first random capacity in the file system to be tested, the method further includes:

[0098] S51, generating a storage file of a second random capacity in the file system, wherein the second random capacity is greater than or equal to the first random capacity;

[0099] S52: Generate a random block of the first random capacity in the storage file as the target interval.

[0100] Optionally, in this embodiment, a storage file of random size may be first generated in the file system, and then a random block may be generated in the storage file as a target interval for testing. For example, a storage file of random size, such as 100MB, is generated in the file system, and a random block, such as [50MB, 60MB], is generated in the interval [0,100MB] of the storage file, and the random block is used as the target interval targetBlock.

[0101] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0102] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for an electronic device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0103] According to another aspect of the embodiments of the present application, a file system testing device for implementing the above-mentioned file system testing method is also provided. Figure 3 is a schematic diagram of an optional file system testing device according to an embodiment of the present application, such as Figure 3 As shown, the device may include:

[0104] A first generating module 32, configured to generate a plurality of first access intervals corresponding to a target interval of a first random capacity in a file system to be tested, wherein the plurality of first access intervals correspond one-to-one to a plurality of random input modes of the target interval;

[0105] A first testing module 34 is configured to perform an overwrite test on each of the plurality of first access intervals, wherein if the plurality of first access intervals are all tested successfully, it is determined that the file system passes the overwrite test;

[0106] A second generating module 36 is used to generate a plurality of second access intervals corresponding to each of the first access intervals when the file system passes the overwrite test, wherein the plurality of second access intervals correspond one-to-one to the plurality of random output modes of each of the first access intervals;

[0107] The second testing module 38 is configured to perform a random read test on each of the plurality of second access intervals, wherein if the plurality of second access intervals are all tested successfully, it is determined that the file system has passed the random read test.

[0108] It should be noted that the first generation module 32 in this embodiment can be used to execute step S202 in the embodiment of the present application, the first test module 34 in this embodiment can be used to execute step S204 in the embodiment of the present application, the second generation module 36 in this embodiment can be used to execute step S206 in the embodiment of the present application, and the second test module 38 in this embodiment can be used to execute step S208 in the embodiment of the present application.

[0109] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be run in Figure 1 In the hardware environment shown, it can be implemented by software or by hardware.

[0110] Through the above module, the target interval of the first random capacity in the file system to be tested is used as the test target of the file system, and multiple first access intervals of random input modes corresponding to multiple target intervals are generated. An overwrite test is performed on each first access interval. If the multiple first access intervals are tested successfully, it is determined that the file system passes the overwrite test, so that the overwrite operation of the target interval under various random input modes can be tested. If the file system passes the overwrite test, the random read test of various random output modes is continued to be performed on the file system, thereby achieving the purpose of verifying whether the file system covers all possible random IO read and write modes, and being able to realize cross-verification of write and read intervals, thereby achieving the technical effect of improving the test efficiency of the file system, and further solving the technical problem of low test efficiency of the file system in the related technology.

[0111] As an optional embodiment, the first generating module includes:

[0112] A first determining unit, configured to determine a first all-set state corresponding to a target interval, wherein the first all-set state is used to indicate all states allowed to exist between the target interval and the first access interval;

[0113] The first generating unit is used to generate, in the file system to be tested, an access area having each of the first set states in all the first set states between the target interval and the access area to obtain the multiple first access areas.

[0114] As an optional embodiment, the first entire set state includes: an intersection state, a non-intersection state, a contained state and a containing state; wherein the intersection state is used to indicate that the target interval intersects with the first access area, the non-intersection state is used to indicate that the target interval has no intersection with the first access area, the contained state is used to indicate that the first access area is contained by the target interval, and the containing state is used to indicate that the first access area contains the target interval.

[0115] As an optional embodiment, the first test module includes:

[0116] A first traversal unit, configured to traverse each first access interval of the plurality of first access intervals in a random order;

[0117] an execution unit, configured to perform an overwrite operation on each of the first access intervals;

[0118] A first verification unit, configured to verify the contents of the files in each first access interval if each first access interval is written successfully;

[0119] The second determination unit is configured to determine that the test of each first access interval is successful if the content verification of the file in each first access interval is successful.

[0120] As an optional embodiment, the second generating module includes:

[0121] a third determining unit, configured to determine a second all-set state corresponding to each first access interval, wherein the second all-set state is used to indicate all states allowed to exist between the first access interval and the second access interval;

[0122] The second generating unit is used to generate an access area having each second set state in the second all set states between each first access interval to obtain the plurality of second access areas.

[0123] As an optional embodiment, the second full set state includes at least one of the following: a partial intersection state, a left boundary intersection state, a right boundary intersection state, a no intersection state, a contained state, a fully contained state, a left boundary containing state and a right boundary containing state; wherein the partial intersection state is used to indicate that the first access interval partially intersects with the second access area, the left boundary intersection state is used to indicate that the second access interval intersects with the left boundary of the first access area, the right boundary intersection state is used to indicate that the second access interval intersects with the right boundary of the first access area, the no intersection state is used to indicate that the first access interval has no intersection with the second access area, the contained state is used to indicate that the second access area is contained by the first access area, the fully contained state is used to indicate that the second access area completely contains the first access area, the left boundary containing state is used to indicate that the second access area contains the first access area and the first access area has the same left boundary as the first access area, and the right boundary containing state is used to indicate that the second access area contains the first access area and the first access area has the same right boundary as the first access area.

[0124] As an optional embodiment, the second test module includes:

[0125] A second traversal unit, configured to traverse each second access interval of the plurality of second access intervals in a random order;

[0126] A sending unit, configured to send a random read request to each second access interval;

[0127] A second verification unit is used to verify the contents of the response data returned by each second access interval in response to the random read request and the write data written by the overwrite test to each second access interval when the request to each second access interval is successful;

[0128] The fourth determining unit is used to determine that the test of each second access interval is successful when the response data corresponding to each second access interval is consistent with the written data content.

[0129] As an optional embodiment, the device further includes:

[0130] a third generating module, configured to generate a storage file of a second random capacity in the file system to be tested before generating a plurality of first access intervals corresponding to a target interval of the first random capacity in the file system to be tested, wherein the second random capacity is greater than or equal to the first random capacity;

[0131] A fourth generating module is used to generate a random block of the first random capacity in the storage file as the target interval.

[0132] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the contents disclosed in the above embodiments. It should be noted that the above modules as part of the device can be run in Figure 1 In the hardware environment shown, it can be implemented by software or by hardware, wherein the hardware environment includes a network environment.

[0133] According to another aspect of the embodiments of the present application, an electronic device for implementing the above-mentioned file system testing method is also provided.

[0134] Figure 4 is a structural block diagram of an electronic device according to an embodiment of the present application, such as Figure 4 As shown, the electronic device may include: one or more (only one is shown in the figure) processors 401, a memory 403, and a transmission device 405, such as Figure 4 As shown, the electronic device may further include an input / output device 407 .

[0135] Among them, the memory 403 can be used to store software programs and modules, such as the program instructions / modules corresponding to the test method and device of the file system in the embodiment of the present application. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 403, that is, the test method of the above-mentioned file system is realized. The memory 403 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 403 may further include a memory remotely arranged relative to the processor 401, and these remote memories can be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0136] The above-mentioned transmission device 405 is used to receive or send data via a network, and can also be used for data transmission between a processor and a memory. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 405 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 405 is a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet wirelessly.

[0137] Specifically, the memory 403 is used to store application programs.

[0138] The processor 401 may call the application stored in the memory 403 through the transmission device 405 to perform the following steps:

[0139] Generating a plurality of first access intervals corresponding to a target interval of a first random capacity in a file system to be tested, wherein the plurality of first access intervals correspond one-to-one to a plurality of random input modes of the target interval;

[0140] Performing an overwrite test on each of the plurality of first access intervals, wherein if the plurality of first access intervals are all tested successfully, determining that the file system passes the overwrite test;

[0141] In a case where the file system passes the overwrite test, generating a plurality of second access intervals corresponding to each of the first access intervals, wherein the plurality of second access intervals correspond one-to-one to the plurality of random output modes of each of the first access intervals;

[0142] A random read test is performed on each of the plurality of second access intervals, wherein when the plurality of second access intervals are all tested successfully, it is determined that the file system passes the random read test.

[0143] By adopting the embodiment of the present application, a scheme for testing a file system is provided. The target interval of the first random capacity in the file system to be tested is used as the test target of the file system, multiple first access intervals of random input modes corresponding to multiple target intervals are generated, and an overwrite test is performed on each first access interval. If the multiple first access intervals are tested successfully, it is determined that the file system passes the overwrite test, so that the overwrite operation of the target interval under various random input modes can be tested. If the file system passes the overwrite test, the random read test of various random output modes is continued to be performed on the file system, so as to achieve the purpose of verifying whether the file system covers all possible random IO read and write modes, and can realize cross-verification of write and read intervals, thereby achieving the technical effect of improving the test efficiency of the file system, and further solving the technical problem of low test efficiency of the file system in the related technology.

[0144] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0145] It can be understood by those skilled in the art that Figure 4 The structure shown is for illustration only, and the electronic device may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, or other electronic devices. Figure 4The structure of the electronic device is not limited. Figure 4 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 4 Different configurations are shown.

[0146] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the electronic device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0147] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to execute the program code of the test method of the file system.

[0148] Optionally, in this embodiment, the storage medium may be located on at least one network device among a plurality of network devices in the network shown in the above embodiment.

[0149] Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:

[0150] Generating a plurality of first access intervals corresponding to a target interval of a first random capacity in a file system to be tested, wherein the plurality of first access intervals correspond one-to-one to a plurality of random input modes of the target interval;

[0151] Performing an overwrite test on each of the plurality of first access intervals, wherein if the plurality of first access intervals are all tested successfully, determining that the file system passes the overwrite test;

[0152] In a case where the file system passes the overwrite test, generating a plurality of second access intervals corresponding to each of the first access intervals, wherein the plurality of second access intervals correspond one-to-one to the plurality of random output modes of each of the first access intervals;

[0153] A random read test is performed on each of the plurality of second access intervals, wherein when the plurality of second access intervals are all tested successfully, it is determined that the file system passes the random read test.

[0154] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment will not be described in detail here.

[0155] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.

[0156] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0157] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0158] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0159] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0160] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0161] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0162] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for testing a file system, characterized in that: include: Generate multiple first access intervals corresponding to a target interval of a first random capacity in a file system to be tested, including: determining a first full set state corresponding to the target interval, the first full set state is used to indicate all states allowed to exist between the target interval and the first access interval, the first full set state includes an intersection state, a non-intersection state, a contained state and a containing state, the intersection state is used to indicate that the target interval intersects with the first access interval, the non-intersection state is used to indicate that the target interval has no intersection with the first access interval, the contained state is used to indicate that the first access interval is contained by the target interval, and the containing state is used to indicate that the first access interval contains the target interval; generate in the file system to be tested an access interval with each first set state in the first full set state between the target interval and the target interval, to obtain the multiple first access intervals, the multiple first access intervals correspond one-to-one to multiple random input modes of the target interval; Performing an overwrite test on each of the plurality of first access intervals, wherein if the tests on the plurality of first access intervals are all successful, determining that the file system passes the overwrite test; In a case where the file system passes the overwrite test, generating a plurality of second access intervals corresponding to each of the first access intervals, wherein the plurality of second access intervals correspond one-to-one to the plurality of random output modes of each of the first access intervals; A random read test is performed on each of the plurality of second access intervals, wherein when the plurality of second access intervals are all tested successfully, it is determined that the file system passes the random read test.

2. The method according to claim 1, characterized in that: Performing an overwrite test on each first access interval in the plurality of first access intervals includes: traversing each first access interval of the plurality of first access intervals in a random order; Performing an overwrite operation on each of the first access intervals; When each of the first access intervals is written successfully, performing content verification on the file where each of the first access intervals is located; In the case where the content verification of the file in each first access interval is successful, it is determined that the test of each first access interval is successful.

3. The method according to claim 1, characterized in that Generating a plurality of second access intervals corresponding to each first access interval includes: Determine a second all-set state corresponding to each first access interval, wherein the second all-set state is used to indicate all states allowed to exist between the first access interval and the second access interval; An access interval having each second set state in the second set states between each first access interval and the access interval is generated to obtain the plurality of second access intervals.

4. The method according to claim 3, characterized in that The second full set state includes at least one of the following: a partial intersection state, a left boundary intersection state, a right boundary intersection state, a non-intersection state, a contained state, a fully contained state, a left boundary containing state and a right boundary containing state; wherein the partial intersection state is used to indicate that the first access interval partially intersects with the second access interval, the left boundary intersection state is used to indicate that the second access interval intersects with the left boundary of the first access interval, the right boundary intersection state is used to indicate that the second access interval intersects with the right boundary of the first access interval, the non-intersection state is used to indicate that the first access interval and the second access interval have no intersection, the contained state is used to indicate that the second access interval is contained by the first access interval, the fully contained state is used to indicate that the second access interval completely contains the first access interval, the left boundary containing state is used to indicate that the second access interval contains the first access interval and the second access interval has the same left boundary as the first access interval, and the right boundary containing state is used to indicate that the second access interval contains the first access interval and the second access interval has the same right boundary as the first access interval.

5. The method according to claim 1, characterized in that Performing a random read test on each second access interval in the plurality of second access intervals includes: traversing each second access interval of the plurality of second access intervals in a random order; Sending a random read request to each second access interval; In the case where the request to each second access interval is successful, performing content verification on the response data returned by each second access interval in response to the random read request and the write data written to each second access interval in the overwrite test; When the response data corresponding to each second access interval is consistent with the written data content, it is determined that the test of each second access interval is successful.

6. The method according to claim 1, characterized in that Before generating a plurality of first access intervals corresponding to a target interval of a first random capacity in the file system to be tested, the method further includes: Generating a storage file of a second random capacity in the file system, wherein the second random capacity is greater than or equal to the first random capacity; A random block of the first random capacity is generated in the storage file as the target interval.

7. A testing device for a file system, characterized in that: include: A first generation module is used to generate multiple first access intervals corresponding to a target interval of a first random capacity in a file system to be tested, including: determining a first full set state corresponding to the target interval, the first full set state is used to indicate all states that are allowed to exist between the target interval and the first access interval, the first full set state includes an intersection state, a non-intersection state, a contained state and a containing state, the intersection state is used to indicate that the target interval intersects with the first access interval, the non-intersection state is used to indicate that the target interval has no intersection with the first access interval, the contained state is used to indicate that the first access interval is contained by the target interval, and the containing state is used to indicate that the first access interval contains the target interval; generating in the file system to be tested an access interval having each first set state in the first full set state between the target interval and the target interval, to obtain the multiple first access intervals, the multiple first access intervals corresponding one-to-one to multiple random input modes of the target interval; A first testing module, configured to perform an overwrite test on each of the plurality of first access intervals, wherein if the plurality of first access intervals are all tested successfully, it is determined that the file system passes the overwrite test; A second generating module is used to generate a plurality of second access intervals corresponding to each of the first access intervals when the file system passes the overwrite test, wherein the plurality of second access intervals correspond to the plurality of random output modes of each of the first access intervals in a one-to-one manner; The second testing module is configured to perform a random read test on each of the plurality of second access intervals, wherein if the plurality of second access intervals are all tested successfully, it is determined that the file system has passed the random read test.

8. A storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 6 when executed.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: The processor executes the method described in any one of claims 1 to 6 through the computer program.

Citation Information

Patent Citations

  • File access method and device

    CN105718589A

  • Function traversal testing method for high performance SoC FPGA

    CN105866665A

  • Method and device for testing logical model in chip

    CN110082672A

  • Interface testing method and device

    CN111324540A

  • Small program testing method, device and system, electronic equipment and storage medium

    CN111338925A