Test method for supporting silent upgrade of wireless router
Technical Field
The invention relates to the field of router upgrade and update, in particular to a test method for supporting silent upgrade of a wireless router.
Background
If some independent files or functional modules of the current router equipment need to be updated, the whole system needs to be upgraded, the whole system is troublesome and inefficient to maintain, the module functions do not support the personalized customization of customers, and the product software is not flexible.
The silent upgrade function can only upgrade a single file or a function module and then dynamically load, the whole system is not required to be upgraded, the files needing to be maintained regularly in the system can be quickly replaced, the function of the module is optimized, and the user experience is improved.
Disclosure of Invention
The invention provides a test method for a wireless router to support silent upgrade, which aims to solve the problem that the current router equipment needs to be upgraded in the whole system.
The invention provides a test method for a wireless router to support silent upgrade, which comprises the following steps:
s1, dividing an independent silent upgrade partition in a memory, and storing an independent file or a functional module;
s2, carrying out silent upgrade operation on the individual files or the functional modules;
s3, combing application scenes of silent upgrade, dynamically loading individual files or functional modules and performing acceptance test;
s4, analyzing a basic test point according to logic realization and function association in wireless router software;
s5, adding test cases by combining the application scene and the basic test points to obtain a complete case set;
and S6, executing by adopting an automatic test tool to complete the automatic test.
As a further improvement of the present invention, the operation process of the silent upgrade in step S2 includes:
reading: reading the file content, and checking whether the file is damaged or not before reading;
writing: writing a file into the partition, and if the file originally has the file name, overwriting the original file;
and (3) deleting: deleting the file, and deleting the file from the partition;
formatting: erasing the whole partition, and emptying the content of the whole partition;
checking: and checking the file by using a CRC algorithm, and checking the integrity of the file.
As a further improvement of the present invention, in step S3, the logic of the 4 application scenarios is developed by an upper layer, and modes including cloud-down automatic update, background direct update, and user-selected update are supported.
As a further improvement of the present invention, in the step S5, the use case set includes a use case for verifying the basic function of the silent upgrade, verifying the integrated function of the system upgrade with other modes, verifying the reliability of repeatedly operating the silent upgrade partition, loading a file from the silent upgrade partition, and verifying the stability of the system during long-time operation.
As a further improvement of the present invention, in step S6, the automated testing tool is developed by compiling and completing the testing steps according to the interface and command designed by the wireless router software.
As a further improvement of the present invention, the automated testing process in step S6 includes:
a1. entering a specified directory to load an individual file or a functional module;
a2. downloading and storing the correct file, testing by adopting the correct file, and accumulating the testing error times of the correct file;
a3. downloading and storing an error file, testing by adopting the error file, and accumulating the testing error times of the error file;
a4. and after the test of the correct file and the wrong file is finished, accumulating the complete test times, judging whether the test is interrupted, if so, directly printing the counted complete test times, and otherwise, repeatedly executing the step a2.
As a further improvement of the present invention, the specific process of step a2 includes:
a21. downloading a correct file, and executing and saving the file;
a22. acquiring a CRC value of correct file content, verifying the CRC value calculated by the current file content of the wireless router before storing the file, and executing the step a23 if the verification is successful; if the verification fails, accumulating the error times of the once verified correct file, and then executing the step a 23;
a23. the CRC check value calculated by the acquired file content is compared with the CRC value of the saved file, if the comparison is consistent, the step a24 is executed; if the comparison is inconsistent, accumulating the error times of acquiring the correct file once, and then executing the step a 24;
a24. deleting the files in the silent upgrade partition in the wireless router, if the deletion is successful, executing the step a3, if the deletion is unsuccessful, accumulating the error 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 step a3 includes:
a31. downloading an error file, and executing and saving the file;
a32. acquiring a CRC value of the content of the error file, verifying the CRC value calculated by the content of the current file of the wireless router before storing the file, and executing the step a33 if the verification is successful; if the verification fails, accumulating the error times of the file with the error once verified, and then executing the step a 33;
a33. unloading and erasing the silent upgrade partition, and judging whether the silent upgrade partition is mounted again, if so, executing step a 4; if not, the number of erasure partition errors is accumulated, and step a4 is executed again.
The invention has the beneficial effects that: the method for testing the wireless router product supporting the silent upgrade function provides method guidance for actual work, is simple and feasible, and can be repeatedly used for case design and test of the silent upgrade function of other network products.
Drawings
FIG. 1 is a flow chart of an automated testing process in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments.
The invention provides a test method for supporting silent upgrade of a wireless router, wherein the silent upgrade function can only upgrade individual files and functional modules and then dynamically load, so that the test method comprises the following steps:
s1, dividing a separate silent upgrade partition in a flash memory, wherein the size of the partition is 2M and the partition is used for storing related independent files or function modules.
S2, carrying out silent upgrade operation on the individual files or the functional modules; the operation of upgrading the silence comprises the following steps:
reading: the file content can be read, and verification is carried out before reading to check whether the file is damaged or not;
writing: writing a file into the partition, and if the file originally has the file name, overwriting the original file;
and (3) deleting: deleting the file, and deleting the file from the partition;
formatting: erasing the whole partition, and emptying the content of the whole partition;
checking: and checking the file by using a CRC algorithm, and checking the integrity of the file.
S3, combing several scenes of silent upgrading used by a user, for example, scenes that the user selects a file locally and loads the file into a router, and a cloud automatically sends the file and loads the file into the router, and performing acceptance test by file loading, wherein logic implementation of an application scene is developed by an upper layer, and cloud sending automatic updating, background direct updating, user selection updating and the like are supported.
And S4, analyzing the basic test points according to logic implementation and function association in the wireless router software.
And S5, combining the scene and the basic test points, increasing reliability and stability test cases to obtain a complete case set, wherein the case set comprises the verification of the basic function of the silent upgrade, the verification of the integrated function of the system upgrade in other modes, the verification of the reliability of the repeatedly operated silent upgrade partition, the loading of files from the silent upgrade partition, and the verification of the stability of the system in long-time operation.
And S6, compiling the testing steps according to the related interfaces and commands of the software design, developing related automatic testing tools, and executing and completing the automatic testing by adopting the automatic testing tools.
The software operation process of the test method comprises the following steps:
b1. opening a tftp server, and placing scripts to be used on a computer desktop;
b2. a serial port inputs a command to enter a/var directory, the directory is readable and writable, and other directories are read-only; downloading a test.sh script to a DUT, adding an executable right to the test.sh script file, and executing the test.sh script;
ctrl + c stop script to get the test result.
As shown in fig. 1, the automated testing process includes:
a1. and entering a specified directory to load a separate file or a functional module.
a2. Downloading and storing the correct file, testing by adopting the correct file, and accumulating the testing error times of the correct file; the method specifically comprises the following steps:
a21. downloading a correct file, and executing and saving the file;
a22. before saving the file, performing file check, wherein the header of the file has a CRC value of the file content, before saving the file, acquiring the value of the correct file and checking the value with the CRC calculated by the current file content, and if the check is successful, executing the step a 23; if the verification fails, accumulating the error times of the once verified correct file, and then executing the step a 23;
a23. acquiring file contents for comparison, wherein the stored files have independent CRC (cyclic redundancy check) values, the acquired file contents are calculated to calculate the CRC value and compare the CRC value with the CRC value, and if the comparison is correct, the step a24 is executed; if the comparison fails, accumulating the error times of obtaining the correct file once, and then executing the step a 24;
a24. deleting the files, deleting the files in the silent upgrade partition in the wireless router, executing the step a3 if the deletion is successful, and accumulating the error times of deleting the correct files once if the deletion is failed, and then executing the step a3.
And (4) performing +1 accumulation on error times in the checking, obtaining and deleting processes of the correct file, and counting the processes after the correct file is downloaded to ensure the success rate of verification operation and the reliability of the system.
a3. Downloading and storing an error file, testing by adopting the error file, and accumulating the testing error times of the error file; the method specifically comprises the following steps:
a31. downloading an error file, and executing and saving the file;
a32. carrying out file check before saving the file, wherein the head of the file has a CRC value of the file content, acquiring the value of an error file before saving the file and checking the value with the CRC calculated by the current file content, and if the check is successful, executing a step a 33; if the verification fails, accumulating the error times of the file with the error once verified, and then executing the step a 33;
a33. unloading and erasing the silent upgrade partition, and judging whether the silent upgrade partition is mounted again, if so, executing step a 4; if not, the number of erasure partition errors is accumulated, and step a4 is executed again.
And (4) performing +1 accumulation on error times generated in the error file verification and partition erasure error processes, and counting the processes after the error files are downloaded to ensure the success rate of verification operation and the fault tolerance and reliability of the system.
a4. And after the test of the correct file and the wrong file is finished, accumulating the complete test times, judging whether the test is interrupted, if so, directly printing the counted complete test times, and otherwise, repeatedly executing the step a2.
In the automatic test process, after the correct files are checked and stored, the wrong files are checked and stored, and the correctness of a program, the fault tolerance of a system and the reliability are verified by covering different types of files.
The foregoing is a more detailed description of the invention in connection with specific preferred embodiments and it is not intended that the invention be limited to these specific details. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.