Disclosure of Invention
The invention provides a test method for supporting silent upgrading of a wireless router, which aims to solve the problem that the whole system of the current router equipment is required to be upgraded.
The invention provides a test method for supporting silent upgrading by a wireless router, which comprises the following steps:
s1, dividing an independent silent upgrading partition in a memory, and storing an independent file or a functional module;
s2, performing silent upgrading operation on the independent files or the functional modules;
s3, carding application scenes of silence upgrading, dynamically loading individual files or functional modules and carrying out acceptance test;
s4, analyzing a basic test point according to logic implementation and functional association in the wireless router software;
S5, combining the application scene and the basic test points, and adding test cases to obtain a complete case set;
s6, executing by adopting an automatic testing tool to complete automatic testing.
As a further improvement of the present invention, the operation procedure of silent upgrade in step S2 includes:
reading: reading the file content, checking before reading, and checking whether the file is damaged;
Writing: writing a file into the partition, and covering the original file if the original file name exists;
deletion: deleting the file, and deleting the file from the partition;
formatting: erasing the whole partition, and emptying the content of the whole partition;
And (3) checking: and checking the file by using a CRC algorithm, and checking the integrity of the file.
In step S3, the logic of the 4 application scenario is developed by the upper layer, and the method including cloud delivery automatic update, background direct update and user selection update is supported.
As a further improvement of the present invention, in the step S5, the use case set includes use cases of silent upgrade basic function verification, integrated function verification of system upgrade in other modes, reliability verification of repeatedly operating silent upgrade partition, loading file from silent upgrade partition, and long-time running stability verification of system.
In step S6, the automated test tool is written and developed for completing the test steps according to the interface and command designed by the wireless router software.
As a further improvement of the present invention, the automated test procedure in step S6 includes:
a1. Loading individual files or functional modules by entering a designated directory;
a2. downloading and storing correct files, testing by adopting the correct files, and accumulating the testing error times of the correct files;
a3. downloading and storing error files, testing by adopting the error files, and accumulating the testing error times of the error files;
a4. After the testing of the correct file and the error file is completed, the complete testing times are accumulated once, whether the testing is interrupted or not is judged, if yes, the counted complete testing times are directly printed, and if not, the step a2 is repeatedly executed.
As a further improvement of the present invention, the specific process of the step a2 includes:
a21. downloading a correct file, and executing a stored file;
a22. acquiring a CRC value of correct file content, checking the CRC value calculated by the file content before storing the file and the current file content of the wireless router, and executing the step a23 if the check is successful; if the verification fails, accumulating the number of times of checking the correct file errors once, and executing the step a23;
a23. c, obtaining file content, calculating a CRC value, comparing the CRC value with a CRC value of a stored file, and executing step a24 if the CRC values are consistent; if the comparison is inconsistent, accumulating the error times of acquiring the correct file once, and executing the step a24;
a24. and (3) deleting the files in the silent upgrading partition in the wireless router, if the deletion is successful, executing the step a3, if the deletion is failed, accumulating the number of times of deleting the correct files once, and then executing the step a3.
As a further improvement of the present invention, the specific process of the step a3 includes:
a31. downloading an error file and executing a saved file;
a32. Acquiring a CRC value of the error file content, checking the CRC value calculated by the file content before storing the file and the current file content of the wireless router, and executing the step a33 if the check is successful; if the verification fails, accumulating the number of times of checking the error file once, and executing the step a33;
a33. unloading and erasing the silent upgrade partition, judging whether to mount the silent upgrade partition again, and if so, executing the step a4; if not, the number of times of erasing partition errors once is accumulated, and then the step a4 is executed.
The beneficial effects of the invention are as follows: the test method for supporting the silent upgrading function of the wireless router product provides method guidance for actual work, is simple and feasible, and can be reused for use case design and test of the silent upgrading function of other network products.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent.
The invention provides a test method for supporting silent upgrading by a wireless router, wherein the silent upgrading function can only upgrade individual files and functional modules and then be dynamically loaded, so that the test method comprises the following steps:
s1, dividing an independent silent upgrading partition in a flash memory, wherein the size of the partition is 2M, and the partition is used for storing related independent files or functional modules.
S2, performing silent upgrading operation on the independent files or the functional modules; the operation of silence upgrading comprises the following steps:
Reading: the file content can be read out, and checking can be performed before reading to check whether the file is damaged or not;
Writing: writing a file into the partition, and covering the original file if the original file name exists;
deletion: deleting the file, and deleting the file from the partition;
formatting: erasing the whole partition, and emptying the content of the whole partition;
And (3) checking: and checking the file by using a CRC algorithm, and checking the integrity of the file.
S3, combing a plurality of silent upgrading scenes used by a user, for example, a scene that the user locally selects a file to be loaded into a router and a scene that a cloud end automatically issues the file to be loaded into the router, and performing acceptance test by using the file loading, wherein logic implementation of an application scene is developed by an upper layer, and cloud end issuing automatic update, background direct update, user selection update and the like are supported.
S4, analyzing the basic test points according to logic implementation and functional association in the wireless router software.
S5, combining the scene and the basic test point, adding reliability and stability test cases, and obtaining a complete case set, wherein the case set comprises silent upgrading basic function verification, integrated function verification of system upgrading in other modes, reliability verification of repeatedly operating silent upgrading partitions, loading files from the silent upgrading partitions, and long-time running stability verification of the system.
S6, writing test steps according to related interfaces and commands of software design, developing related automatic test tools, and executing and completing automatic tests by adopting the automatic test tools.
The software operation process of the test method is as follows:
b1. Opening a tftp server, and placing a script to be used on a computer desktop;
b2. A serial port inputs a command, and enters a/var directory, wherein the directory is readable and writable, and the other directories are read-only; downloading a test.sh script to the DUT, adding executable permission to the test.sh script file, and executing the test.sh script;
b3.Ctrl+c stops script, obtaining test result.
As shown in fig. 1, the automated test procedure includes:
a1. and loading the individual files or the functional modules by entering the designated directory.
A2. Downloading and storing correct files, testing by adopting the correct files, and accumulating the testing error times of the correct files; the method specifically comprises the following steps:
a21. downloading a correct file, and executing a stored file;
a22. Checking the file before storing the file, wherein the header of the file has a CRC check value of the file content, acquiring the value of the correct file before storing the file and checking the CRC calculated by the current file content, and executing the step a23 if the check is successful; if the verification fails, accumulating the number of times of checking the correct file errors once, and executing the step a23;
a23. Acquiring file contents for comparison, wherein the stored file has an independent CRC check value, acquiring the file contents, calculating the CRC check value, comparing the CRC check value with the value, and executing step a24 if the comparison is correct; if the comparison fails, accumulating the error times of acquiring the correct file once, and executing the step a24;
a24. And (3) deleting the file, namely deleting the file in the silent upgrading partition in the wireless router, if the deletion is successful, executing the step a3, and if the deletion is failed, accumulating the error times of deleting the correct file once, and then executing the step a3.
And carrying out +1 accumulation on the error times in the process of checking, acquiring and deleting the correct file, wherein the step is used for counting the process after downloading the correct file, and ensuring the success rate of verification operation and the reliability of the system.
A3. Downloading and storing error files, testing by adopting the error files, and accumulating the testing error times of the error files; the method specifically comprises the following steps:
a31. downloading an error file and executing a saved file;
a32. Checking the file before storing the file, wherein the header of the file has a CRC check value of the file content, acquiring the value of the error file before storing the file and checking with the CRC calculated by the current file content, and executing the step a33 if the check is successful; if the verification fails, accumulating the number of times of checking the error file once, and executing the step a33;
a33. unloading and erasing the silent upgrade partition, judging whether to mount the silent upgrade partition again, and if so, executing the step a4; if not, the number of times of erasing partition errors once is accumulated, and then the step a4 is executed.
And carrying out +1 accumulation on error times in the process of checking and erasing the partition errors of the error file, wherein the step is used for counting the process after downloading the error file, so as to ensure the success rate of verification operation, and the fault tolerance and reliability of the system.
A4. After the testing of the correct file and the error file is completed, the complete testing times are accumulated once, whether the testing is interrupted or not is judged, if yes, the counted complete testing times are directly printed, and if not, the step a2 is repeatedly executed.
In the automatic test process, correct files are checked and stored firstly, then error files are checked and stored, and the correctness of a program and the fault tolerance and reliability of a system are verified by covering different types of files.
The foregoing is a further detailed description of the invention in connection with the preferred embodiments, and it is not intended that the invention be limited to the specific embodiments described. It will be apparent to those skilled in the art that several simple deductions or substitutions may be made without departing from the spirit of the invention, and these should be considered to be within the scope of the invention.