CN112306954A - File system testing method and device - Google Patents

File system testing method and device Download PDF

Info

Publication number
CN112306954A
CN112306954A CN202011179909.XA CN202011179909A CN112306954A CN 112306954 A CN112306954 A CN 112306954A CN 202011179909 A CN202011179909 A CN 202011179909A CN 112306954 A CN112306954 A CN 112306954A
Authority
CN
China
Prior art keywords
access
interval
random
file system
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011179909.XA
Other languages
Chinese (zh)
Inventor
程锦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202011179909.XA priority Critical patent/CN112306954A/en
Publication of CN112306954A publication Critical patent/CN112306954A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/11File system administration, e.g. details of archiving or snapshots
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files

Abstract

The application relates to a method and a device for testing a file system, wherein the method comprises the following steps: generating a plurality of first access intervals corresponding to a target interval of first random capacity in a file system to be tested, wherein the plurality of first access intervals correspond to a plurality of random input modes of the target interval one by one; performing an overwrite test on each of the plurality of first access intervals; under the condition that the file system passes the overlay write test, generating a plurality of second access intervals corresponding to each first access interval, wherein the plurality of second access intervals correspond to the plurality of random output modes of each first access interval one by one; and performing a random read test on each of the plurality of second access intervals, wherein the file system is determined to pass the random read test when the plurality of second access intervals are tested successfully. The method and the device solve the technical problem that the testing efficiency of the file system is low.

Description

File system testing method and device
Technical Field
The present application relates to the field of computers, and in particular, to a method and an apparatus for testing a file system.
Background
With the expansion of data size, a single file system cannot meet the demand of people on the read storage capacity, so that the demand on a distributed file system is more and more strong. The read-write modes of file storage are mainly divided into two categories: sequential read and write and random read and write. Random writing is divided into overwriting and additional writing, and the overwriting is the most difficult to realize, so that the requirement on the correctness check of the overwriting is high, and the overwriting test method is very important. The test mode of the distributed file storage randomly written in the current industry is mainly that a general benchmark tool is used for testing, the method only provides a running tool, on one hand, a tester needs to perform complex configuration according to options in the tool, on the other hand, the test tool can only simply check whether a request result is successful, and the test on the aspects of data integrity, read-write operation cross validation and the like cannot be performed.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The application provides a method and a device for testing a file system, which are used for at least solving the technical problem of low testing efficiency of the file system in the related technology.
According to an aspect of an embodiment of the present application, there is provided a method for testing a file system, including:
generating a plurality of first access intervals corresponding to a target interval of first random capacity in a file system to be tested, wherein the plurality of first access intervals correspond to a plurality of random input modes of the target interval one by one;
performing an overwrite test on each of the plurality of first access intervals, wherein the file system is determined to pass the overwrite test when the plurality of first access intervals are tested successfully;
generating a plurality of second access intervals corresponding to each first access interval under the condition that the file system passes an overlay write test, wherein the plurality of second access intervals correspond to a plurality of random output modes of each first access interval in a one-to-one mode;
and performing a random read test on each of the plurality of second access intervals, wherein the file system is determined to pass the random read test when the plurality of second access intervals are tested successfully.
Optionally, generating a plurality of first access intervals corresponding to a target interval of the first random capacity in the file system to be tested includes:
determining a first full set state corresponding to a target interval, wherein the first full set state is used for indicating all states allowed to exist between the target interval and the first access interval;
and generating an access area with each first set state in the first all set states between the access area and the target interval in the file system to be tested to obtain the plurality of first access areas.
Optionally, the first full set state comprises: an intersection state, a non-intersection state, an included state, and an included state; wherein the intersection status is used for indicating that the target interval intersects the first access region, the non-intersection status is used for indicating that the target interval does not intersect the first access region, the included status is used for indicating that the first access region is included by the target interval, and the included status is used for indicating that the first access region includes the target interval.
Optionally, performing an overwrite test on each of the plurality of first access intervals comprises:
traversing each of the plurality of first access intervals in a random order;
performing an overwrite operation on each of the first access intervals;
under the condition that the writing of each first access interval is successful, performing content verification on the file where each first access interval is located;
and under the condition that the content of the file where each first access interval is located is successfully verified, determining that the test of each first access interval is successful.
Optionally, generating a plurality of second access intervals corresponding to each first access interval includes:
determining a second full set state corresponding to each first access interval, wherein the second full set state is used for indicating all states allowed to exist between the first access interval and the second access interval;
and generating an access area with each second set state in the second all set states between the access area and each first access interval to obtain the plurality of second access areas.
Optionally, the second full set state comprises at least one of: a partial intersection state, a left boundary intersection state, a right boundary intersection state, a no intersection state, an included state, a fully included state, a left boundary included state, and a right boundary included state; wherein the partially-intersected state is to indicate that the first access interval partially intersects the second access region, the left-boundary-intersected state is to indicate that the second access interval intersects a left boundary of the first access region, the right-boundary-intersected state is to indicate that the second access interval intersects a right boundary of the first access region, the non-intersected state is to indicate that the first access interval does not intersect a portion of the second access region, the included state is to indicate that the second access region is included by the first access region, the fully-included state is to indicate that the second access region fully includes the first access region, the left-boundary-included state is to indicate that the second access region includes the first access region and the first access region is the same as the first access region left boundary, the right border inclusion status is used to indicate that the second access region includes the first access region and that the first access region is the same as the first access region right border.
Optionally, performing a random read test on each of the plurality of second access intervals comprises:
traversing each of the plurality of second access intervals in a random order;
sending a random read request to each second access interval;
under the condition that the request for each second access interval is successful, performing content verification on response data returned by each second access interval in response to the random read request and write-in data written in the coverage write test of each second access interval;
and determining that the test of each second access interval is successful under the condition that the response data corresponding to each second access interval is consistent with the content of the written data.
Optionally, 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, the method further includes:
generating a second random-size storage file in the file system, wherein the second random-size is greater than or equal to the first random-size;
and generating the random blocks with the first random capacity in the storage file as the target interval.
According to another aspect of the embodiments of the present application, there is also provided a testing apparatus for a file system, including:
the file system to be tested comprises a first generation module, a second generation module and a third generation module, wherein the first generation module is used for generating a plurality of first access intervals corresponding to a target interval of first random capacity in the file system to be tested, and the plurality of first access intervals correspond to a plurality of random input modes of the target interval one to one;
the first testing module is used for performing an overwriting test on each first access interval in the plurality of first access intervals, wherein the file system is determined to pass the overwriting test under the condition that the plurality of first access intervals are tested successfully;
a second generating module, configured to generate a plurality of second access intervals corresponding to each first access interval when the file system passes an overwrite test, where the plurality of second access intervals correspond to a plurality of random output patterns of each first access interval in a one-to-one manner;
and the second testing module is used for performing random read testing on each second access interval in the plurality of second access intervals, wherein the file system is determined to pass the random read testing under the condition that the testing of the plurality of second access intervals is successful.
According to another aspect of the embodiments of the present application, there is also provided a storage medium including a stored program which, when executed, performs the above-described method.
According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the above method through the computer program.
In the embodiment of the application, a plurality of first access intervals corresponding to a target interval for generating first random capacity in a file system to be tested are adopted, wherein the plurality of first access intervals correspond to a plurality of random input modes of the target interval one by one; performing an overlay write test on each first access interval in the plurality of first access intervals, wherein the file system is determined to pass the overlay write test under the condition that the test of each first access interval is successful; under the condition that the file system passes the overlay write test, generating a plurality of second access intervals corresponding to each first access interval, wherein the plurality of second access intervals correspond to the plurality of random output modes of each first access interval one by one; performing random read test on each second access interval in the plurality of second access intervals, wherein under the condition that the plurality of second access intervals are tested successfully, determining that the file system generates a plurality of first access intervals corresponding to random input modes of a plurality of target intervals by taking a target interval with first random capacity in the file system to be tested as a test target of the file system in a random read test mode, performing overwrite test on each first access interval, if the plurality of first access intervals are tested successfully, determining that the file system passes the overwrite test, so that overwrite operation of the target interval in various random input modes can be tested, and if the file system passes the overwrite test, continuing performing random read test of various random output modes on the file system, so as to achieve the purpose of verifying whether the file system covers all possible read-write modes of random IO, and cross validation between the writing-in interval and the reading-out interval can be realized, so that the technical effect of improving the testing efficiency of the file system is realized, and the technical problem of lower testing efficiency of the file system in the related technology is solved.
Drawings
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.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a schematic diagram of a hardware environment for a method of testing a file system according to an embodiment of the present application;
FIG. 2 is a flow chart of an alternative testing method for a file system according to an embodiment of the present application;
FIG. 3 is a schematic diagram of an alternative file system testing apparatus according to an embodiment of the present application;
fig. 4 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of embodiments of the present application, there is provided an embodiment of a method for testing a file system.
Alternatively, in this embodiment, the test method of the file system may be applied to a hardware environment formed by the terminal 101 and the server 103 as shown in fig. 1. As shown in fig. 1, a server 103 is connected to a terminal 101 through a network, which may be used to provide services (such as game services, application services, etc.) for the terminal or a client installed on the terminal, and a database may be provided on the server or separately from the server for providing data storage services for the server 103, and the network includes but is not limited to: the terminal 101 is not limited to a PC, a mobile phone, a tablet computer, and the like. The testing method of the file system in the embodiment of the present application may be executed by the server 103, the terminal 101, or both the server 103 and the terminal 101. The terminal 101 may execute the test method of the file system according to the embodiment of the present application by a client installed thereon.
Fig. 2 is a flowchart of an alternative testing method for a file system according to an embodiment of the present application, and as shown in fig. 2, the method may include the following steps:
step S202, generating a plurality of first access intervals corresponding to a target interval of first random capacity in a file system to be tested, wherein the plurality of first access intervals correspond to a plurality of random input modes of the target interval one by one;
step S204, performing an overlay write test on each first access interval in the plurality of first access intervals, wherein the file system is determined to pass the overlay write test under the condition that the test of each first access interval is successful;
step S206, under the condition that 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 to a plurality of random output modes of each first access interval one by one;
step S208, performing a random read test on each of the plurality of second access intervals, wherein the file system is determined to pass the random read test when the tests of the plurality of second access intervals are successful.
By the steps S202 to S208, the target interval with the first random capacity in the file system to be tested is used as the test target of the file system, a plurality of first access intervals of random input modes corresponding to a plurality of target intervals are generated, coverage write test is carried out on each first access interval, if the test of the plurality of first access intervals is successful, the file system is determined to pass the coverage write test, so that the coverage write operation of the target interval in various random input modes can be tested, if the file system passes the coverage write test, the random read test of various random output modes is continuously carried out on the file system, the purpose of verifying whether the file system covers all possible random IO read-write modes is achieved, the cross verification of the write-in and read intervals can be realized, and the technical effect of improving the test efficiency of the file system is realized, and the technical problem of lower test efficiency of the file system in the related technology is solved.
Optionally, in this embodiment, the test method of the file system may be, but is not limited to, applied in a scenario where an overwriting test is performed on the file system in a file system test stage. The testing method of the file system can be packaged into a testing plug-in, a testing program, a testing tool and the like, a tester connects the testing tool to the file system to be tested to run, the testing tool can automatically perform the overwriting test on the file system, and a corresponding testing result is given.
In the technical solution provided in step S202, the file system may be, but is not limited to, a distributed file system.
Optionally, in this embodiment, the target interval of the first random capacity is a storage interval of a random capacity randomly generated in the file system, such as: and randomly taking the storage interval of [500MB, 600MB ] as a target interval in the file system to carry out an overwriting test.
Optionally, in this embodiment, a plurality of first access intervals corresponding to the target interval correspond to a plurality of random input modes of the target interval one to one, that is, each first access interval corresponds to one random input mode of the target interval, and all possible random input modes of the target interval can be covered.
In the technical solution provided in step S204, if all the first access intervals are tested successfully, it is determined that the file system passes the overwrite test. And if any one of the first access intervals fails to be tested, determining that the file system fails the overwriting test.
Optionally, in this embodiment, for the first access interval in which the test fails, the reason for the failure may be presented through the prompt information, that is, the random input mode corresponding to the first access interval in which the test fails may be presented, so that a tester can intuitively know which random input mode of the file system may have a problem, and thus perform targeted repair.
In the technical solution provided in step S206, after the file system passes the overwrite test, the random read test is continuously performed on the file system, so as to implement the cross-validation between the write and read intervals.
Optionally, in this embodiment, the plurality of second access intervals correspond to the plurality of random output patterns of each first access interval in a one-to-one manner, that is, each second access interval corresponds to one random output pattern of the first access interval, and all possible random output patterns of the first access interval can be covered.
In the technical solution provided in step S208, if the plurality of second access intervals are tested successfully, it is determined that the file system passes the random read test. And if any one of the second access intervals fails to be tested, determining that the file system fails the overwriting test.
Optionally, in this embodiment, for the second access interval in which the test fails, the reason for the failure may be presented through the prompt information, that is, the random output mode corresponding to the second access interval in which the test fails may be presented, so that a tester can intuitively know which random output mode of the file system may have a problem, and thus perform targeted repair.
As an alternative 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:
s11, determining a first all-set state corresponding to a target interval, wherein the first all-set state is used for indicating all states allowed to exist between the target interval and the first access interval;
s12, generating an access area with each first aggregation state in the first all aggregation states between the access area and the target interval in the file system to be tested, and obtaining a plurality of first access areas.
Optionally, in this embodiment, the first full set state includes: an intersection state to indicate that the target interval intersects the first access region, a non-intersection state to indicate that the target interval does not intersect the first access region, an included state to indicate that the first access region is included by the target interval, and an included state to indicate that the first access region includes the target interval.
In an alternative embodiment, taking [50MB, 60MB ] as the target interval, four possible first access intervals for performing the overwrite test may be generated for the interval range of the target interval and the four states that may occur for the two sets: the first access section [30MB, 50MB ] of the intersection state, the first access section [70MB, 80MB ] of the non-intersection state, the first access section [52MB, 55MB ] of the included state, and the first access section [45MB, 70MB ] of the included state.
Optionally, in this embodiment, the intersection state includes: and in the process of randomly generating the first access interval of the intersection state, the three intersection states are all possible to generate. In the first all-set state, which intersection states are generated may be set, or one of the intersection states may be randomly generated without setting the types of the generated intersection states.
Optionally, in this embodiment, the inclusion state includes: the full inclusion state, the left boundary inclusion state and the right boundary inclusion state are all possible to be generated in the process of randomly generating the first access interval including the states. In the first all-set state, it may be set which inclusion states are generated, or one of the generated inclusion states may be randomly generated without setting the types of the generated inclusion states.
Optionally, in this embodiment, the first all-aggregation state is used to indicate all states allowed to exist between the target interval and the first access interval, and different types of target intervals may correspond to different first all-aggregation states. Such as: the target interval is [0MB, 50MB ], and its corresponding first full set state may include: partial intersection state, right boundary intersection state, no intersection state, contained state, and left boundary contained state. For a 500MB file system, the target interval is [400MB, 500MB ], and the corresponding first full aggregate state may include: partial intersection state, left boundary intersection state, no intersection state, contained state, and right boundary contained state.
As an alternative embodiment, performing the overwrite test on each of the plurality of first access intervals comprises:
s21, traversing each of the plurality of first access intervals in a random order;
s22, executing the covering write operation to each first access interval;
s23, when the writing of each first access interval is successful, the content of the file in which each first access interval is located is checked;
and S24, determining that the test of each first access interval is successful under the condition that the content of the file where each first access interval is located is successfully verified.
Optionally, in this embodiment, the first access interval is randomly selected from the multiple first access intervals to perform the overwrite test, and the test result is output until all the tests of the multiple first access intervals are completed, or the test may be stopped immediately when the test fails, and the failure reason is prompted.
Optionally, in this embodiment, after performing the overwriting operation on each first access interval and successfully writing, content verification may be performed on the written content to verify the integrity of the written data, so that integrity verification of data in the process of verifying the random IO mode is achieved.
Optionally, in this embodiment, if a first access interval passes both the overwrite operation and the content check, it is determined that the overwrite test of the first access interval is successful.
In the above optional embodiment, the first access interval [70MB, 80MB ] is selected to perform the overwriting operation to write the new data, and if the writing fails, the program bug is described to exit; and if the writing is successful, initiating content verification on the whole file, if the verification fails, exiting, indicating that the program bug continues to test the next first access interval if the verification succeeds. Selecting a first access interval [52MB, 55MB ] to execute an overwriting operation to write new data, if the writing fails, exiting, and indicating a program bug; and if the writing is successful, initiating content verification on the whole file, if the verification fails, exiting, indicating that the program bug continues to test the next first access interval if the verification succeeds. Selecting a first access interval [45MB, 70MB ] to execute an overwriting operation to write new data, if the writing fails, exiting, and indicating a program bug; and if the writing is successful, initiating content verification on the whole file, if the verification fails, exiting, indicating that the program bug continues to test the next first access interval if the verification succeeds. Selecting a first access interval [30MB, 50MB ] to execute an overwriting operation to write new data, if the writing fails, exiting, and indicating a program bug; and if the writing is successful, initiating content verification on the whole file, if the verification fails, exiting to show the program bug, and if the verification is successful, determining that the file system passes the overwriting test.
As an optional embodiment, generating a plurality of second access intervals corresponding to each first access interval includes:
s31, determining a second all-set state corresponding to each first access interval, wherein the second all-set state is used for indicating all states allowed to exist between the first access interval and the second access interval;
s32, generating an access area having each second aggregation state in the second all aggregation states between each first access interval, and obtaining the plurality of second access areas.
Optionally, in this embodiment, the second full set state includes at least one of: a partial intersection state, a left boundary intersection state, a right boundary intersection state, a no intersection state, an included state, a fully included state, a left boundary included state, and a right boundary included state; wherein the partially-intersected state is to indicate that the first access interval partially intersects the second access region, the left-boundary-intersected state is to indicate that the second access interval intersects a left boundary of the first access region, the right-boundary-intersected state is to indicate that the second access interval intersects a right boundary of the first access region, the non-intersected state is to indicate that the first access interval does not intersect a portion of the second access region, the included state is to indicate that the second access region is included by the first access region, the fully-included state is to indicate that the second access region fully includes the first access region, the left-boundary-included state is to indicate that the second access region includes the first access region and the first access region is the same as the first access region left boundary, the right border inclusion status is used to indicate that the second access region includes the first access region and that the first access region is the same as the first access region right border.
In the above optional embodiment, taking the first access interval [30MB, 50MB ] as an example, the second access interval of 8 states is generated according to the states that may appear in two sets: a second access interval [20MB, 40MB ] of partially intersecting state, a second access interval [20MB, 30MB ] of left boundary intersecting state, a second access interval [50MB, 60MB ] of right boundary intersecting state, a second access interval [10MB, 20MB ] of non-intersecting state, a second access interval [35MB, 45MB ] of contained state, a second access interval [30MB, 60MB ] of state contained in left boundary, a second access interval [20MB, 50MB ] of state contained in right boundary, and a second access interval [10MB, 70MB ] of full contained state.
Optionally, in this embodiment, the second all-set state is used to indicate all states allowed to exist between the first access interval and the second access interval, and the first access intervals of different types may correspond to different second all-set states. Such as: the first access interval is [0MB, 50MB ], and its corresponding second full set state may include: partial intersection state, right boundary intersection state, no intersection state, contained state, and left boundary contained state. For a 500MB file system, the target interval is [400MB, 500MB ], and the corresponding second full aggregate state may include: partial intersection state, left boundary intersection state, no intersection state, contained state, and right boundary contained state.
As an alternative embodiment, performing the random read test on each of the plurality of second access intervals includes:
s41, traversing each of the plurality of second access intervals in a random order;
s42, sending a random read request to each second access interval;
s43, when the request for each second access interval is successful, performing content verification on response data returned by responding to the random read request for each second access interval and write data written in the coverage write test for each second access interval;
s44, determining that the test of each second access interval is successful when the response data corresponding to each second access interval is consistent with the content of the write data.
Optionally, in this embodiment, the second access interval is randomly selected from the plurality of second access intervals corresponding to each first access interval to perform a random read test, and a test result is output until all the plurality of first access intervals are tested, or the test may be stopped immediately when a test failure occurs, and a failure reason is prompted.
Optionally, in this embodiment, after a random read request is initiated to each second access interval and the read is successful, content verification may be performed on the read content to verify consistency between the read data and the write data, so that consistency verification of data in the process of verifying the random IO mode is achieved.
Optionally, in this embodiment, if a second access interval passes both the random read request and the content check, it is determined that the random read test is successful.
In the above optional embodiment, 8 types of second access intervals generated for the first access interval [30MB, 50MB ] are respectively selected in a random order to initiate a random read request, and if the request fails, the program bug is exited, which indicates that the program bug; and if the request is successful, continuously checking the consistency of the read content and the write content, if the contents are not consistent, exiting to indicate the program bug, and if the contents are consistent, continuously testing the next first access interval.
As an optional embodiment, before generating, in the file system to be tested, a plurality of first access intervals corresponding to a target interval of the first random capacity, the method further includes:
s51, generating a storage file with a second random capacity in the file system, wherein the second random capacity is larger than or equal to the first random capacity;
s52, generating the random block with the first random size as the target interval in the storage file.
Alternatively, in this embodiment, a random-size storage file may be generated in the file system first, and then a random block may be generated in the storage file as a target interval for testing. For example: a random-size storage file is generated in a file system, for example, the size of the storage file is 100MB, a random block is generated in a [0,100MB ] interval of the storage file, for example, 50MB, 60MB, and the random block is used as a target interval targetLock.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling an electronic device (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.
According to another aspect of the embodiments of the present application, there is also provided a file system testing apparatus for implementing the file system testing method. Fig. 3 is a schematic diagram of an alternative testing apparatus for a file system according to an embodiment of the present application, and as shown in fig. 3, the apparatus may include:
the first generating module 32 is configured to generate, in a file system to be tested, a plurality of first access intervals corresponding to a target interval of a first random capacity, where the plurality of first access intervals correspond to a plurality of random input modes of the target interval one to one;
a first testing module 34, configured to perform an overwrite test on each of the first access intervals, where, when the tests of all the first access intervals are successful, it is determined that the file system passes the overwrite test;
a second generating module 36, configured to generate, when the file system passes an overwrite test, a plurality of second access intervals corresponding to each first access interval, where the plurality of second access intervals are in one-to-one correspondence with the plurality of random output patterns of each first access interval;
a second testing module 38, configured to perform a random read test on each of the multiple second access intervals, where, when the multiple second access intervals are tested successfully, it is determined that the file system passes the random read test.
It should be noted that the first generating module 32 in this embodiment may be configured to execute step S202 in this embodiment, the first testing module 34 in this embodiment may be configured to execute step S204 in this embodiment, the second generating module 36 in this embodiment may be configured to execute step S206 in this embodiment, and the second testing module 38 in this embodiment may be configured to execute step S208 in this embodiment.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may operate in a hardware environment as shown in fig. 1, and may be implemented by software or hardware.
By the 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, a plurality of first access intervals of random input modes corresponding to a plurality of target intervals are generated, performing an overwrite test on each of the first access intervals, if a plurality of the first access intervals are tested successfully, determining that the file system passes the overwrite test, so that the overwrite operation of the target interval in various random input modes can be tested, if the file system passes the overlay write test, the random read test of various random output modes is continuously carried out on the file system, the purpose of verifying whether the file system covers all possible random IO read-write modes is achieved, the cross verification of the write-in and read intervals can be realized, therefore, the technical effect of improving the testing efficiency of the file system is achieved, and the technical problem that the testing efficiency of the file system is low in the related technology is solved.
As an alternative embodiment, the first generating module comprises:
a first determining unit, configured to determine a first all-set state corresponding to a target interval, where the first all-set state is used to indicate all states allowed to exist between the target interval and the first access interval;
the first generating unit is configured to generate, in the file system to be tested, an access area in which each of the first total aggregation states exists between the target interval and the access area, and obtain the plurality of first access areas.
As an alternative embodiment, the first all-sets state includes: an intersection state, a non-intersection state, an included state, and an included state; wherein the intersection status is used for indicating that the target interval intersects the first access region, the non-intersection status is used for indicating that the target interval does not intersect the first access region, the included status is used for indicating that the first access region is included by the target interval, and the included status is used for indicating that the first access region includes the target interval.
As an alternative embodiment, the first test module comprises:
a first traversal unit configured to traverse each of the plurality of first access intervals in a random order;
the execution unit is used for executing the covering write operation on each first access interval;
the first checking unit is used for checking the content of the file in each first access interval under the condition that the writing of each first access interval is successful;
and a second determining unit, configured to determine that the test of each first access interval is successful when the content of the file in which the each first access interval is located is successfully verified.
As an alternative embodiment, the second generating module includes:
a third determining unit, configured to determine a second all-set state corresponding to each first access interval, where the second all-set state is used to indicate all states allowed to exist between the first access interval and the second access interval;
a second generating unit, configured to generate an access area in which each of the second all-aggregation states exists between the first access section and each of the first access sections, and obtain the plurality of second access areas.
As an alternative embodiment, the second full set state includes at least one of: a partial intersection state, a left boundary intersection state, a right boundary intersection state, a no intersection state, an included state, a fully included state, a left boundary included state, and a right boundary included state; wherein the partially-intersected state is to indicate that the first access interval partially intersects the second access region, the left-boundary-intersected state is to indicate that the second access interval intersects a left boundary of the first access region, the right-boundary-intersected state is to indicate that the second access interval intersects a right boundary of the first access region, the non-intersected state is to indicate that the first access interval does not intersect a portion of the second access region, the included state is to indicate that the second access region is included by the first access region, the fully-included state is to indicate that the second access region fully includes the first access region, the left-boundary-included state is to indicate that the second access region includes the first access region and the first access region is the same as the first access region left boundary, the right border inclusion status is used to indicate that the second access region includes the first access region and that the first access region is the same as the first access region right border.
As an alternative embodiment, the second test module comprises:
a second traversal unit, configured to traverse each second access interval in the plurality of second access intervals in a random order;
a sending unit, configured to send a random read request to each second access interval;
a second checking unit, configured to, when the request for each second access interval is successful, perform content verification on response data returned by responding to the random read request for each second access interval and write data that is subjected to overwrite test writing for each second access interval;
and a fourth determining unit, configured 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 content of the write data.
As an alternative embodiment, the apparatus further comprises:
the third generation module is used for generating a storage file with a second random capacity in the file system 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 larger than or equal to the first random capacity;
and a fourth generating module, configured to generate a random block with the first random capacity in the storage file as the target interval.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may be operated in a hardware environment as shown in fig. 1, and may be implemented by software, or may be implemented by hardware, where the hardware environment includes a network environment.
According to another aspect of the embodiment of the present application, there is also provided an electronic device for implementing the test method of the file system.
Fig. 4 is a block diagram of an electronic device according to an embodiment of the present application, and as shown in fig. 4, the electronic device may include: one or more processors 401 (only one of which is shown), a memory 403, and a transmission device 405. as shown in fig. 4, the electronic device may further include an input-output device 407.
The memory 403 may be used to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for testing a file system in the embodiment of the present application, and the processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 403, so as to implement the above-mentioned method for testing a file system. The memory 403 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 403 may further include memory located remotely from processor 401, which may be connected to an electronic device through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmitting device 405 is used for receiving or sending data via a network, and may also be used for data transmission between the processor and the memory. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 405 includes a Network adapter (NIC) that can be connected to a router via a Network cable and other Network devices to communicate with the internet or a local area Network. In one example, the transmission device 405 is a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
In particular, the memory 403 is used for storing application programs.
The processor 401 may call the application stored in the memory 403 via the transmission means 405 to perform the following steps:
generating a plurality of first access intervals corresponding to a target interval of first random capacity in a file system to be tested, wherein the plurality of first access intervals correspond to a plurality of random input modes of the target interval one by one;
performing an overwrite test on each of the plurality of first access intervals, wherein the file system is determined to pass the overwrite test when the plurality of first access intervals are tested successfully;
generating a plurality of second access intervals corresponding to each first access interval under the condition that the file system passes an overlay write test, wherein the plurality of second access intervals correspond to a plurality of random output modes of each first access interval in a one-to-one mode;
and performing a random read test on each of the plurality of second access intervals, wherein the file system is determined to pass the random read test when the plurality of second access intervals are tested successfully.
By adopting the embodiment of the application, a scheme for testing the file system is provided. Taking a target interval of first random capacity in a file system to be tested as a test target of the file system, generating a plurality of first access intervals of random input modes corresponding to a plurality of target intervals, performing an overwrite test on each of the first access intervals, if a plurality of the first access intervals are tested successfully, determining that the file system passes the overwrite test, so that the overwrite operation of the target interval in various random input modes can be tested, if the file system passes the overlay write test, the random read test of various random output modes is continuously carried out on the file system, the purpose of verifying whether the file system covers all possible random IO read-write modes is achieved, the cross verification of the write-in and read intervals can be realized, therefore, the technical effect of improving the testing efficiency of the file system is achieved, and the technical problem that the testing efficiency of the file system is low in the related technology is solved.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
It will be understood by those skilled in the art that the structure shown in fig. 4 is merely an illustration, and the electronic device may be a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, and a Mobile Internet Device (MID), a PAD, etc. Fig. 4 is a diagram illustrating the structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 4, or have a different configuration than shown in FIG. 4.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program for instructing hardware associated with an electronic device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
Embodiments of the present application also provide a storage medium. Alternatively, in this embodiment, the storage medium may be a program code for executing a test method of a file system.
Optionally, in this embodiment, the storage medium may be located on at least one of a plurality of network devices in a network shown in the above embodiment.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:
generating a plurality of first access intervals corresponding to a target interval of first random capacity in a file system to be tested, wherein the plurality of first access intervals correspond to a plurality of random input modes of the target interval one by one;
performing an overwrite test on each of the plurality of first access intervals, wherein the file system is determined to pass the overwrite test when the plurality of first access intervals are tested successfully;
generating a plurality of second access intervals corresponding to each first access interval under the condition that the file system passes an overlay write test, wherein the plurality of second access intervals correspond to a plurality of random output modes of each first access interval in a one-to-one mode;
and performing a random read test on each of the plurality of second access intervals, wherein the file system is determined to pass the random read test when the plurality of second access intervals are tested successfully.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a storage medium, and including instructions for causing one or more computer devices (which may be personal computers, servers, network devices, or the like) to execute all or part of the steps of the method described in the embodiments of the present application.
In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (11)

1. A method for testing a file system, comprising:
generating a plurality of first access intervals corresponding to a target interval of first random capacity in a file system to be tested, wherein the plurality of first access intervals correspond to a plurality of random input modes of the target interval one by one;
performing an overwrite test on each of the plurality of first access intervals, wherein the file system is determined to pass the overwrite test when the plurality of first access intervals are tested successfully;
generating a plurality of second access intervals corresponding to each first access interval under the condition that the file system passes an overlay write test, wherein the plurality of second access intervals correspond to a plurality of random output modes of each first access interval in a one-to-one mode;
and performing a random read test on each of the plurality of second access intervals, wherein the file system is determined to pass the random read test when the plurality of second access intervals are tested successfully.
2. The method of claim 1, wherein generating a plurality of first access intervals in the file system under test corresponding to the target interval of the first random capacity comprises:
determining a first full set state corresponding to a target interval, wherein the first full set state is used for indicating all states allowed to exist between the target interval and the first access interval;
and generating an access area with each first set state in the first all set states between the access area and the target interval in the file system to be tested to obtain the plurality of first access areas.
3. The method of claim 2, wherein the first full set state comprises: an intersection state, a non-intersection state, an included state, and an included state; wherein the intersection status is used for indicating that the target interval intersects the first access region, the non-intersection status is used for indicating that the target interval does not intersect the first access region, the included status is used for indicating that the first access region is included by the target interval, and the included status is used for indicating that the first access region includes the target interval.
4. The method of claim 1, wherein performing an overwrite test on each of the plurality of first access intervals comprises:
traversing each of the plurality of first access intervals in a random order;
performing an overwrite operation on each of the first access intervals;
under the condition that the writing of each first access interval is successful, performing content verification on the file where each first access interval is located;
and under the condition that the content of the file where each first access interval is located is successfully verified, determining that the test of each first access interval is successful.
5. The method of claim 1, wherein generating a plurality of second access intervals corresponding to each first access interval comprises:
determining a second full set state corresponding to each first access interval, wherein the second full set state is used for indicating all states allowed to exist between the first access interval and the second access interval;
and generating an access area with each second set state in the second all set states between the access area and each first access interval to obtain the plurality of second access areas.
6. The method of claim 5, wherein the second full set state comprises at least one of: a partial intersection state, a left boundary intersection state, a right boundary intersection state, a no intersection state, an included state, a fully included state, a left boundary included state, and a right boundary included state; wherein the partially-intersected state is to indicate that the first access interval partially intersects the second access region, the left-boundary-intersected state is to indicate that the second access interval intersects a left boundary of the first access region, the right-boundary-intersected state is to indicate that the second access interval intersects a right boundary of the first access region, the non-intersected state is to indicate that the first access interval does not intersect a portion of the second access region, the included state is to indicate that the second access region is included by the first access region, the fully-included state is to indicate that the second access region fully includes the first access region, the left-boundary-included state is to indicate that the second access region includes the first access region and the first access region is the same as the first access region left boundary, the right border inclusion status is used to indicate that the second access region includes the first access region and that the first access region is the same as the first access region right border.
7. The method of claim 1, wherein performing a random read test on each of the plurality of second access intervals comprises:
traversing each of the plurality of second access intervals in a random order;
sending a random read request to each second access interval;
under the condition that the request for each second access interval is successful, performing content verification on response data returned by each second access interval in response to the random read request and write-in data written in the coverage write test of each second access interval;
and determining that the test of each second access interval is successful under the condition that the response data corresponding to each second access interval is consistent with the content of the written data.
8. The method of claim 1, wherein prior to generating a plurality of first access intervals in the file system under test corresponding to the target interval of the first random capacity, the method further comprises:
generating a second random-size storage file in the file system, wherein the second random-size is greater than or equal to the first random-size;
and generating the random blocks with the first random capacity in the storage file as the target interval.
9. A test apparatus for a file system, comprising:
the file system to be tested comprises a first generation module, a second generation module and a third generation module, wherein the first generation module is used for generating a plurality of first access intervals corresponding to a target interval of first random capacity in the file system to be tested, and the plurality of first access intervals correspond to a plurality of random input modes of the target interval one to one;
the first testing module is used for performing an overwriting test on each first access interval in the plurality of first access intervals, wherein the file system is determined to pass the overwriting test under the condition that the plurality of first access intervals are tested successfully;
a second generating module, configured to generate a plurality of second access intervals corresponding to each first access interval when the file system passes an overwrite test, where the plurality of second access intervals correspond to a plurality of random output patterns of each first access interval in a one-to-one manner;
and the second testing module is used for performing random read testing on each second access interval in the plurality of second access intervals, wherein the file system is determined to pass the random read testing under the condition that the testing of the plurality of second access intervals is successful.
10. A storage medium, characterized in that the storage medium comprises a stored program, wherein the program when executed performs the method of any of the preceding claims 1 to 8.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the method of any of the preceding claims 1 to 8 by means of the computer program.
CN202011179909.XA 2020-10-29 2020-10-29 File system testing method and device Pending CN112306954A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011179909.XA CN112306954A (en) 2020-10-29 2020-10-29 File system testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011179909.XA CN112306954A (en) 2020-10-29 2020-10-29 File system testing method and device

Publications (1)

Publication Number Publication Date
CN112306954A true CN112306954A (en) 2021-02-02

Family

ID=74331937

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011179909.XA Pending CN112306954A (en) 2020-10-29 2020-10-29 File system testing method and device

Country Status (1)

Country Link
CN (1) CN112306954A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115543720A (en) * 2022-11-30 2022-12-30 湖南国科亿存信息科技有限公司 File system read-write correctness testing method and device and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115543720A (en) * 2022-11-30 2022-12-30 湖南国科亿存信息科技有限公司 File system read-write correctness testing method and device and storage medium

Similar Documents

Publication Publication Date Title
US10013330B2 (en) Automated mobile application verification
CN107885656B (en) Automatic product algorithm testing method and application server
CN105573902B (en) The test method and system of a kind of application program
CN108717393A (en) A kind of applied program testing method and mobile terminal
CN104765678A (en) Method and device for testing applications on mobile terminal
CN105144074A (en) Block storage using a hybrid memory device
CN115184764A (en) Chip testing method and device, electronic equipment and storage medium
CN111813495A (en) Node testing method and device, storage medium and electronic device
CN111723020A (en) Method, device and equipment for testing electric energy meter testing software
CN107679423A (en) Partition integrity inspection method and device
CN112306954A (en) File system testing method and device
CN114115724A (en) Solid state disk safe erasing method and device
CN113312205B (en) Data verification method and device, storage medium and computer equipment
CN113191114A (en) Method and apparatus for authenticating a system
CN112133357A (en) eMMC testing method and device
CN110111188B (en) Business handling method and equipment
CN111124772A (en) Cloud platform storage performance testing method, system, terminal and storage medium
CN106708445A (en) Link selection method and device
CN109933479B (en) Fault simulation and emulation method and related equipment
CN113535580B (en) CTS test method, CTS test device and test equipment
CN115599618A (en) Register dynamic relocation verification method and device, storage medium and processor
CN111210863B (en) Method, device and equipment for testing embedded memory and computer storage medium
CN107392010A (en) Perform method and device, terminal device, the storage medium of Root operations
CN115391168A (en) Sandbox testing method, sandbox testing device, sandbox testing equipment and storage medium
CN113051178A (en) Test data construction method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination