CN115048256B - Test method, test system, and computer-readable storage medium - Google Patents

Test method, test system, and computer-readable storage medium Download PDF

Info

Publication number
CN115048256B
CN115048256B CN202210978784.XA CN202210978784A CN115048256B CN 115048256 B CN115048256 B CN 115048256B CN 202210978784 A CN202210978784 A CN 202210978784A CN 115048256 B CN115048256 B CN 115048256B
Authority
CN
China
Prior art keywords
space
preset
parameter
occupied
determining
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.)
Active
Application number
CN202210978784.XA
Other languages
Chinese (zh)
Other versions
CN115048256A (en
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 Smartchip Microelectronics Technology Co Ltd
Beijing Smartchip Semiconductor Technology Co Ltd
Original Assignee
Beijing Smartchip Microelectronics Technology Co Ltd
Beijing Smartchip Semiconductor 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 Smartchip Microelectronics Technology Co Ltd, Beijing Smartchip Semiconductor Technology Co Ltd filed Critical Beijing Smartchip Microelectronics Technology Co Ltd
Priority to CN202210978784.XA priority Critical patent/CN115048256B/en
Publication of CN115048256A publication Critical patent/CN115048256A/en
Application granted granted Critical
Publication of CN115048256B publication Critical patent/CN115048256B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2268Logging of test results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2273Test methods

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The invention discloses a test method, a test system and a computer readable storage medium. The test method comprises the following steps: creating a preset object to occupy a target space, wherein the target space is at least part of a storage space of the Java card; acquiring a first space parameter, wherein the first space parameter is an available space amount in a target space before a test process is executed; after the target space is occupied, executing a test process to recover a preset object; acquiring a second space parameter, wherein the second space parameter is the available space amount in the target space after the test process is completed; and determining a test result according to the first space parameter and the second space parameter. According to the test method, a test environment is created by occupying space in the Java card, and a test result is obtained according to the change of space parameters of a corresponding target space before and after the test process is executed, so that the garbage recovery capability of the Java card is determined according to the test result, and the technical competitiveness of the Java card can be evaluated.

Description

Test method, test system, and computer-readable storage medium
Technical Field
The invention relates to the technical field of Java card testing, in particular to a testing method, a testing system and a computer readable storage medium.
Background
The Java card is a smart card capable of running Java programs, which not only can technically enable developers to develop smart card applications without understanding complex hardware technology so as to greatly reduce development time and development difficulty, but also is a very convenient technical implementation means for realizing a one-card multi-purpose service mode. In order to fully improve the technical competitiveness of the Java card, the Java card needs to be evaluated and analyzed more deeply.
Disclosure of Invention
The invention provides a test method, a test system and a computer readable storage medium.
The test method for the Java card comprises the following steps:
creating a preset object to occupy a target space, wherein the target space is at least part of a storage space of the Java card;
acquiring a first space parameter, wherein the first space parameter is an available space amount in the target space before the test process is executed;
after the target space is occupied, executing a test process to recover the preset object;
acquiring a second space parameter, wherein the second space parameter is the available space amount in the target space after the test process is completed;
and determining a test result according to the first space parameter and the second space parameter.
According to the test method, a test environment is created by occupying space in the Java card, and a test result is obtained according to the change of space parameters of a corresponding target space before and after the test process is executed, so that the garbage recovery capability of the Java card is determined according to the test result, and the technical competitiveness of the Java card can be evaluated.
In some embodiments, obtaining a first spatial parameter comprises:
determining the space amount which is not occupied by the preset object in the target space as the first space parameter for obtaining before executing preset operation;
after the occupation of the target space is completed, executing a test process to recover the preset object, including:
executing the preset operation under the condition of acquiring the first space parameter;
obtaining a second spatial parameter, comprising:
after the preset operation is completed, determining the space amount not occupied by the preset object in the target space as the second space parameter for obtaining. Therefore, the garbage recycling effect of the Java card can be conveniently tested.
In some embodiments, the preset operation comprises at least one of:
selecting the application instance for creating the preset object again; deactivating the Java card; and performing power-on and power-off processing on the Java card. Therefore, the Java card can automatically refresh the target space.
In some embodiments, the preset operations include three, three of the preset operations are a first preset operation, a second preset operation and a third preset operation,
under the condition that the first space parameter is obtained, executing the preset operation, wherein the preset operation comprises the following steps:
executing the first preset operation under the condition that the first preset operation is determined not to be executed;
executing the second preset operation under the condition that the first preset operation is determined to be executed and the second preset operation is determined not to be executed;
and executing the third preset operation under the condition that the second preset operation is determined to be executed and the third preset operation is not executed. Therefore, the test result can be more comprehensive.
In certain embodiments, the testing method comprises:
determining that the preset operation has been performed in a case where any one of the first preset operation, the second preset operation, and the third preset operation has been performed;
and after the second space parameters are obtained, initializing the target space under the condition that the current condition of not meeting the first test condition is determined, and recreating an objects to occupy the target space so as to execute the test process. Therefore, the test result can be more comprehensive.
In certain embodiments, the first test condition comprises at least one of:
the second spatial parameter is greater than the first spatial parameter; the target space is in a readable and writable state; all of the preset operations have been performed. Therefore, the effect of deep testing of the Java card can be ensured.
In some embodiments, determining a test result from the first spatial parameter and the second spatial parameter comprises:
determining that the Java card has a garbage recycling function under the condition that the second space parameter is larger than the first space parameter;
determining that the Java card has a garbage recovery function and has the maximum garbage recovery rate under the condition that the second spatial parameter is greater than the first spatial parameter and is equal to an available spatial parameter, wherein the available spatial parameter is the total spatial amount of the target space;
and determining that the Java card does not have a garbage collection function under the condition that the second space parameter is equal to the first space parameter. Therefore, the evaluation result of the garbage collection capability of the Java card can be refined according to the test result.
In some embodiments, creating the preset object to occupy the target space includes:
continuously creating a plurality of preset objects until the target space is completely occupied, wherein the space occupied by each preset object is less than a preset amount;
obtaining a first spatial parameter, comprising:
before executing recovery operation, determining the space amount which is not occupied by the preset object in the target space as the first space parameter for obtaining;
after the occupation of the target space is completed, executing a test process to recover the preset object, including:
after the target space is completely occupied, executing the recovery operation on all the preset objects;
obtaining a second spatial parameter, comprising:
after the recycling operation is completed, determining the space amount not occupied by the preset object in the target space as the second space parameter for obtaining. Therefore, the garbage recycling effect of the Java card can be conveniently tested.
In some embodiments, determining a test result from the first spatial parameter and the second spatial parameter comprises:
determining that the Java card has a garbage recycling function under the condition that the difference value between the second spatial parameter and the first spatial parameter is positive and equal to the space amount occupied by all the preset objects;
and determining that the Java card does not have a garbage collection function under the condition that the difference value between the second space parameter and the first space parameter is smaller than the space amount occupied by all the preset objects. Therefore, the garbage collection capability of the Java card under the limit condition can be evaluated.
In some embodiments, a plurality of physical memory pages form the target space, the testing method comprising:
after the recovery operation is finished, continuously creating a plurality of preset objects again until the target space is completely occupied again;
under the condition that the space amount occupied by the plurality of initially created preset objects is equal to the space amount occupied by the plurality of newly created preset objects, continuously creating the plurality of preset objects in the target space at intervals until the target space is completely occupied for the third time, wherein the space amount between every two adjacent preset objects is smaller than the maximum space amount of the physical storage page;
after the recovery operation is completed again, a plurality of preset objects are continuously created at intervals until the target space is completely occupied for the fourth time, and the space amount between every two adjacent preset objects is smaller than the maximum space amount of the physical storage page;
determining the space amount which is not occupied by the preset object in the target space as a new first space parameter under the condition that the target space is completely occupied for the third time;
after the recycling operation is completed again, determining the space amount which is not occupied by the preset object in the target space as a new second space parameter;
determining a test result according to the first spatial parameter and the second spatial parameter, including:
and determining the test result according to the new first space parameter and the new second space parameter. Therefore, the test strength of the Java card can be improved.
In some embodiments, determining a test result from the first spatial parameter and the second spatial parameter comprises:
determining that the Java card has a garbage recycling function under the condition that the difference value between the new second spatial parameter and the new first spatial parameter is positive and equal to the space amount occupied by all the preset objects;
and under the condition that the difference value between the new second spatial parameter and the new first spatial parameter is smaller than the space amount occupied by all the preset objects, determining that the Java card has a garbage recovery function, and the garbage recovery rate is smaller than a preset value. Therefore, the garbage collection capability of the Java card under the limit condition can be evaluated.
The invention provides a test system for a Java card, which is used for:
creating a preset object to occupy a target space, wherein the target space is at least part of a storage space of the Java card;
acquiring a first space parameter, wherein the first space parameter is an available space amount in the target space before the test process is executed;
after the target space is occupied, executing a test process to recover the preset object;
acquiring a second space parameter, wherein the second space parameter is the available space amount in the target space after the test process is completed;
and determining a test result according to the first space parameter and the second space parameter.
According to the test system, a test environment is created by occupying space in the Java card, and a test result is obtained according to the change of space parameters of a corresponding target space before and after the test process is executed, so that the garbage recovery capability of the Java card is determined according to the test result, and the technical competitiveness of the Java card can be evaluated.
In some embodiments, the test system is configured to:
determining the space amount which is not occupied by the preset object in the target space as the first space parameter for obtaining before executing preset operation;
executing the preset operation under the condition of acquiring the first space parameter;
after the preset operation is completed, determining the space amount not occupied by the preset object in the target space as the second space parameter for acquisition. Therefore, the garbage recycling effect of the Java card can be conveniently tested.
In some embodiments, the preset operation comprises at least one of: selecting the application instance for creating the preset object again; deactivating the Java card; and performing power-on and power-off processing on the Java card. Therefore, the Java card can automatically refresh the target space.
In some embodiments, the preset operations include three, and the three preset operations are a first preset operation, a second preset operation and a third preset operation, respectively, and the test system is configured to:
executing the first preset operation under the condition that the first preset operation is determined not to be executed;
executing the second preset operation under the condition that the first preset operation is determined to be executed and the second preset operation is not executed;
and executing the third preset operation under the condition that the second preset operation is determined to be executed and the third preset operation is not executed. Therefore, the test result can be more comprehensive.
In some embodiments, the test system is configured to:
determining that the preset operation has been performed in a case where any one of the first preset operation, the second preset operation, and the third preset operation has been performed;
and initializing the target space after the second space parameter is acquired and under the condition that the second space parameter does not meet the first test condition currently, and recreating an object to occupy the target space to execute the test process. Therefore, the test result can be more comprehensive.
In certain embodiments, the first test condition comprises at least one of:
the second spatial parameter is greater than the first spatial parameter;
the target space is in a readable and writable state;
all of the preset operations have been performed. Therefore, the effect of deep testing of the Java card can be ensured.
In some embodiments, the test system is configured to:
determining that the Java card has a garbage recycling function under the condition that the second space parameter is larger than the first space parameter;
determining that the Java card has a garbage recovery function and has the maximum garbage recovery rate under the condition that the second spatial parameter is greater than the first spatial parameter and is equal to an available spatial parameter, wherein the available spatial parameter is the total spatial amount of the target space;
and determining that the Java card does not have a garbage collection function under the condition that the second space parameter is equal to the first space parameter. Therefore, the evaluation result of the garbage collection capability of the Java card can be refined according to the test result.
In some embodiments, the test system is configured to:
continuously creating a plurality of preset objects until the target space is completely occupied, wherein the space occupied by each preset object is less than a preset amount;
before executing recovery operation, determining the space amount which is not occupied by the preset object in the target space as the first space parameter for obtaining;
after the target space is completely occupied, executing the recovery operation on all the preset objects;
after the recycling operation is completed, determining the space amount in the target space not occupied by the preset object as the second space parameter for acquisition. Therefore, the garbage recycling effect of the Java card can be conveniently tested.
In some embodiments, the test system is configured to:
determining that the Java card has a garbage recycling function under the condition that the difference value between the second space parameter and the first space parameter is positive and equal to the space amount occupied by all the preset objects;
and determining that the Java card does not have a garbage collection function under the condition that the difference value between the second space parameter and the first space parameter is smaller than the space amount occupied by all the preset objects. Therefore, the garbage collection capability of the Java card under the limit condition can be evaluated.
In some embodiments, a plurality of physical memory pages form the target space, the test system to:
after the recovery operation is finished, continuously creating a plurality of preset objects again until the target space is completely occupied again;
under the condition that the space occupied by the plurality of preset objects which are created for the first time is equal to the space occupied by the plurality of preset objects which are created again, the plurality of preset objects are created in the target space at intervals continuously until the target space is completely occupied for the third time, and the space between two adjacent preset objects is smaller than the maximum space of the physical storage page;
after the recovery operation is completed again, a plurality of preset objects are continuously created at intervals until the target space is completely occupied for the fourth time, and the space amount between every two adjacent preset objects is smaller than the maximum space amount of the physical storage page;
determining the space amount which is not occupied by the preset object in the target space as a new first space parameter under the condition that the target space is completely occupied for the third time;
after the recycling operation is completed again, determining the space amount which is not occupied by the preset object in the target space as a new second space parameter;
and determining the test result according to the new first space parameter and the new second space parameter. Therefore, the test strength of the Java card can be improved.
In some embodiments, the test system is configured to:
determining that the Java card has a garbage recycling function under the condition that the difference value between the new second spatial parameter and the new first spatial parameter is positive and equal to the space amount occupied by all the preset objects;
and under the condition that the difference value between the new second spatial parameter and the new first spatial parameter is smaller than the space amount occupied by all the preset objects, determining that the Java card has a garbage recovery function, and the garbage recovery rate is smaller than a preset value. Therefore, the garbage collection capability of the Java card under the limit condition can be evaluated.
The test system for the Java card according to an embodiment of the present invention includes a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the test method according to any one of the above embodiments when executing the computer program.
According to the test system, a test environment is created by occupying space in the Java card, and a test result is obtained according to the change of space parameters of a corresponding target space before and after the test process is executed, so that the garbage recovery capability of the Java card is determined according to the test result, and the technical competitiveness of the Java card can be evaluated.
A computer-readable storage medium of an embodiment of the present invention has a computer program stored thereon, which, when executed by a processor, implements the steps of the testing method of any of the above-described embodiments.
The computer readable storage medium creates a test environment by occupying space in the Java card, and obtains a test result according to the change of space parameters of a corresponding target space before and after the test process is executed, so that the garbage recovery capability of the Java card is determined according to the test result, and the technical competitiveness of the Java card can be evaluated.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a flow chart of a test method of an embodiment of the present invention;
FIG. 2 is a block schematic diagram of a test system according to an embodiment of the present invention;
FIGS. 3-7 are flow charts of testing methods of embodiments of the present invention;
FIG. 8 is a schematic diagram of a physical memory page of an embodiment of the present invention;
FIG. 9 is a flow chart of a testing method of an embodiment of the present invention.
Description of the main element symbols:
a test system 100;
memory 110, processor 120.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
Referring to fig. 1, a testing method for a Java card according to an embodiment of the present invention includes:
01: creating a preset object to occupy a target space, wherein the target space is at least part of a storage space of the Java card;
02: acquiring a first space parameter, wherein the first space parameter is an available space amount in a target space before a test process is executed;
03: after the occupation of the target space is finished, executing a test process to recover a preset object;
04: acquiring a second space parameter, wherein the second space parameter is the available space amount in the target space after the test process is completed;
06: and determining a test result according to the first space parameter and the second space parameter.
The test method according to the embodiment of the present invention can be implemented by the test system 100 according to the embodiment of the present invention. Specifically, referring to fig. 2, the test system 100 is configured to: creating a preset object to occupy a target space, wherein the target space is at least part of a storage space of the Java card; acquiring a first space parameter, wherein the first space parameter is an available space amount in a target space before a test process is executed; after the occupation of the target space is finished, executing a test process to recover a preset object; acquiring a second space parameter, wherein the second space parameter is the available space amount in the target space after the test process is completed; and determining a test result according to the first space parameter and the second space parameter.
According to the test method and the test system 100, a test environment is created by occupying space in the Java card, and a test result is obtained according to the change of space parameters of a corresponding target space before and after the test process is executed, so that the garbage recycling capability of the Java card is determined according to the test result, and the technical competitiveness of the Java card can be evaluated.
The creation of the preset object can be realized by referencing the existing data resource to the target space in the target space. The reference to the data resource can be implemented by a corresponding reference function. In one embodiment, the reference to the preset object may be implemented by the following function:
byte[] a = new byte[x]
where a is a preset object created in the target space and x is the byte length of the array of referenced data resources.
In addition, in some embodiments, a preset object created in the target space needs to be subjected to an emptying process before the test procedure is executed. Specifically, after the reference to the data resource is completed, a may be assigned to null, so that the preset object becomes a null reference, and garbage data is formed.
The target space may be a predetermined area within the storage space of the java card. The target space may be a specific partial region in the storage space or may be the entire storage space.
The testing process is to correspondingly execute one or more testing operations according to different conditions after the preset object is occupied in the target space. By performing the test operation, the preset objects within the occupied target space can be reclaimed. It should be noted that, in the case that the testing method according to the embodiment of the present invention mainly tests the garbage collection capability of the Java card, in the process of executing the testing procedure, when it is detected that there are no unrecovered preset objects in the target space, the testing operation is not executed again or kept to completely collect the preset objects.
After the first space parameter and the second space parameter are determined, the garbage recovery effect of the Java card can be determined through the corresponding changes of the first space parameter and the second space parameter, and then the corresponding garbage recovery capability can be tested, so that the test effect of better evaluating whether the Java card has technical competitiveness is achieved.
Referring to fig. 3, in some embodiments, the step 02 (obtaining the first spatial parameter) includes:
021: before executing the preset operation, determining the space amount which is not occupied by the preset object in the target space as a first space parameter for obtaining;
step 03 (after the occupation of the target space is completed, executing the test flow to recover the preset object), including:
031: executing preset operation under the condition of acquiring the first space parameter;
step 04 (obtaining a second spatial parameter), including:
041: after the preset operation is completed, determining the space amount not occupied by the preset object in the target space as a second space parameter for acquisition.
The test method according to the embodiment of the present invention may be implemented by the test system 100 according to the embodiment of the present invention. Specifically, referring to fig. 2, the test system 100 is configured to: before executing the preset operation, determining the space amount which is not occupied by the preset object in the target space as a first space parameter for obtaining; under the condition that the first space parameter is obtained, executing a preset operation on a preset object; after the preset operation is completed, determining the space amount not occupied by the preset object in the target space as a second space parameter for acquisition.
Therefore, the garbage recycling effect of the Java card can be conveniently tested.
The preset operation can be executed on a preset object and can also be executed on a Java card. The execution of the preset operation does not recover the preset object, but can refresh the target space, and for the Java card with automatic recovery capability, after the target space is refreshed, the preset object for empty reference can be recovered, so that the space amount of the target space is changed before and after the preset operation is executed, and then the garbage recovery effect of the Java card is tested according to the change of the space amount of the target space.
In some embodiments, the preset operation comprises at least one of:
selecting the application example for creating the preset object again; deactivating the Java card; and performing power-on and power-off processing on the Java card.
Therefore, the Java card can automatically refresh the target space.
For the Java card, the preset object is located in the corresponding application instance, and the Java card can refresh the preset object in the target space by reselecting the application instance in which the preset object is created. By deactivating the Java card, the hot reset operation of the Java card can be realized, so that the Java card can clear the application variables in the target space in a software mode to refresh the preset object. By powering on and off the Java card, the cold reset operation of the Java card can be realized, so that the Java card can clear the application variables in the target space in a hardware mode to refresh the preset object.
In some embodiments, the preset operation includes three. The three preset operations are respectively a first preset operation, a second preset operation and a third preset operation. Step 031 (in case the first spatial parameter is obtained, perform a preset operation), which includes:
executing a first preset operation under the condition that the first preset operation is determined not to be executed;
executing a second preset operation under the condition that the first preset operation and the second preset operation are determined to be executed and not executed;
and executing a third preset operation under the condition that the second preset operation is determined to be executed and the third preset operation is not executed.
The test method according to the embodiment of the present invention can be implemented by the test system 100 according to the embodiment of the present invention. Specifically, referring to fig. 2, the test system 100 is configured to: executing a first preset operation under the condition that the first preset operation is determined not to be executed; executing a second preset operation under the condition that the first preset operation and the second preset operation are determined to be executed and not executed; and executing a third preset operation when the second preset operation is determined to be executed and the third preset operation is not executed.
Therefore, the test result can be more comprehensive.
In certain embodiments, the testing method comprises:
determining that the preset operation has been performed in a case where any one of the first preset operation, the second preset operation, and the third preset operation has been performed;
and after the second space parameters are obtained, initializing the target space under the condition that the current condition of not meeting the first test condition is determined, and recreating the object to occupy the target space so as to execute the test process.
The test method according to the embodiment of the present invention may be implemented by the test system 100 according to the embodiment of the present invention. Specifically, referring to fig. 2, the test system 100 is used for: determining that the preset operation has been performed in a case where any one of the first preset operation, the second preset operation, and the third preset operation has been performed; and after the second space parameter is obtained, initializing the target space under the condition that the current first test condition is not met, and recreating the object to occupy the target space to execute the test process.
Therefore, the test result can be more comprehensive.
Specifically, referring to fig. 4, in the embodiment shown in fig. 4, the first preset operation may be to select again an application instance for creating a preset object, the second preset operation may be to deactivate the Java card, and the third preset operation may be to power down and up the Java card. The first spatial parameter may be denoted as Space1 and the second spatial parameter may be denoted as Space2.
After the first spatial parameter is obtained, it is determined whether to execute a first preset operation to determine whether to reselect the application instance of the preset object, and after determining that the application instance of the preset object has been reselected, it is determined that the preset operation has been executed currently and a second spatial parameter is obtained. After the second space parameter is obtained, whether the first test condition is met currently or not can be judged, after the first test condition is not met, it can be determined that the garbage recycling capacity of the Java card in a test environment formed by the currently executed preset operation is poor, the Java card needs to be tested in test environments formed by other preset operations, so that the target space can be initialized, the occupation of the preset object in the target space is repeated, the first space parameter is obtained again, and a second test process is carried out.
When the second test flow is performed, because the first preset operation is performed in the first test flow, it is determined whether the second preset operation is performed to determine whether to deactivate the Java card, and other flows in the first test flow are repeated subsequently, so that a third test flow is performed. When the third test flow is performed, whether a third preset operation is executed or not is judged to determine whether the Java card is subjected to power-down processing or not, and other flows in the previous two test flows are repeated in the following process until the first test condition is met.
On the basis, as three testing processes are required to be carried out to respectively execute the first preset operation, the second preset operation and the third preset operation, the testing result of the Java card can be conveniently obtained in the testing environment respectively corresponding to the first preset operation, the second preset operation and the third preset operation, so that the garbage recycling capability of the Java card can be comprehensively evaluated, and the testing result is objective and comprehensive as much as possible.
Referring to fig. 4, in some embodiments, the first test condition includes at least one of:
the second spatial parameter is greater than the first spatial parameter; the target space is in a readable and writable state; all preset operations have been performed.
Therefore, the effect of deep testing of the Java card can be ensured.
Specifically, in fig. 4, after the second spatial parameter is obtained, it is determined whether the second spatial parameter is greater than the first spatial parameter, and the fact that the second spatial parameter is greater than the first spatial parameter may indicate that the Java card may recycle the garbage data in the target space. In fig. 4, the space corresponding to the second space parameter may be accessed again, and it is determined whether the accessed space is available, where the accessed space is available, which may indicate that the accessed space is available in a readable and writable state, and after the Java card recovers the garbage data, the Java card may not limit the target space or damage the target space. In fig. 4, it can be determined whether all the preset operations have been executed, so as to ensure that the garbage collection capability of the Java card has been tested through different testing environments. On the basis, the test on the Java card can be made to have a deep enough effect.
In certain embodiments, step 06 (determining the test result from the first spatial parameter and the second spatial parameter) comprises:
determining that the Java card has a garbage recycling function under the condition that the second space parameter is larger than the first space parameter;
determining that the Java card has a garbage recovery function and has the maximum garbage recovery rate under the condition that the second space parameter is larger than the first space parameter and is equal to the available space parameter, wherein the available space parameter is the total space amount of the target space;
and determining that the Java card does not have the garbage collection function under the condition that the second space parameter is equal to the first space parameter.
The test method according to the embodiment of the present invention may be implemented by the test system 100 according to the embodiment of the present invention. Specifically, referring to fig. 2, the test system 100 is configured to: determining that the Java card has a garbage recycling function under the condition that the second space parameter is larger than the first space parameter; determining that the Java card has a garbage recovery function and has the maximum garbage recovery rate under the condition that the second space parameter is larger than the first space parameter and is equal to the available space parameter, wherein the available space parameter is the total space amount of the target space; and determining that the Java card does not have the garbage collection function under the condition that the second space parameter is equal to the first space parameter.
Therefore, the evaluation result of the garbage collection capability of the Java card can be refined according to the test result.
Specifically, when the second spatial parameter is greater than the first spatial parameter, it indicates that the Java card can clear null reference data in the target space after executing the preset operation, and thus it can be determined that the Java card has a garbage collection function.
And under the condition that the second space parameter is greater than the first space parameter and the second space parameter is equal to the available space parameter, the second space parameter indicates that the Java card can completely clear the null reference data in the target space after executing the preset operation, so that the Java card can be determined to have a garbage recovery function, and the garbage recovery function reaches the maximum (namely 100%). And if the second space parameter is equal to the first space parameter, the Java card cannot clear the null reference data in the target space after executing the preset operation, so that the Java card is determined not to have a garbage collection function.
In addition, referring to fig. 4, in one embodiment, after the initialization process is performed on the target space, the total space amount of the target space may be obtained and determined as the available space parameter.
Referring to fig. 5, in some embodiments, step 01 (creating a preset object to occupy a target space, where the target space is at least a part of a storage space of a Java card) includes:
011: continuously creating a plurality of preset objects until the target space is completely occupied, wherein the space occupied by each preset object is less than the preset amount;
step 02 (obtaining a first spatial parameter), which includes:
022: before executing recovery operation, determining the space amount which is not occupied by a preset object in a target space as a first space parameter for obtaining;
step 03 (after completing the occupation of the target space, executing the test procedure to recover the preset object), including:
032: after the target space is completely occupied, performing recovery operation on all preset objects;
step 04 (obtaining a second spatial parameter), including:
042: and after the recycling operation is finished, determining the space amount which is not occupied by the preset object in the target space as a second space parameter for obtaining.
The test method according to the embodiment of the present invention may be implemented by the test system 100 according to the embodiment of the present invention. Specifically, referring to fig. 2, the test system 100 is used for: continuously creating a plurality of preset objects until the target space is completely occupied, wherein the space occupied by each preset object is less than the preset amount; before executing recovery operation, determining the space amount which is not occupied by a preset object in a target space as a first space parameter for obtaining; after the target space is completely occupied, performing recovery operation on all preset objects; and after the recycling operation is finished, determining the space amount which is not occupied by the preset object in the target space as a second space parameter for obtaining.
Therefore, the garbage recycling effect of the Java card can be conveniently tested.
The space amount occupied by each preset object is smaller than the preset amount, so that the preset objects can occupy smaller space, a sufficient number of preset objects can be created in the target space, a limit test environment with the target space occupied as much as possible is formed, and the recovery capacity of the Java card surface to a large number of small garbage spaces which are large in quantity and trivial can be tested.
In addition, the reclamation operation is performed on a preset object. And the execution of the recovery operation recovers the preset object, so that the space amount of the target space is changed before and after the recovery operation is executed, and the garbage recovery effect of the Java card is tested according to the change of the space amount of the target space.
In certain embodiments, step 06 (determining test results from the first spatial parameter and the second spatial parameter) comprises:
determining that the Java card has a garbage recycling function under the condition that the difference value between the second space parameter and the first space parameter is positive and equal to the space amount occupied by all preset objects;
and under the condition that the difference value between the second space parameter and the first space parameter is smaller than the space amount occupied by all the preset objects, determining that the Java card does not have a garbage recycling function.
The test method according to the embodiment of the present invention may be implemented by the test system 100 according to the embodiment of the present invention. Specifically, referring to fig. 2, the test system 100 is used for: determining that the Java card has a garbage recycling function under the condition that the difference value between the second space parameter and the first space parameter is positive and equal to the space amount occupied by all preset objects; and under the condition that the difference value between the second space parameter and the first space parameter is smaller than the space amount occupied by all the preset objects, determining that the Java card does not have a garbage recycling function.
Therefore, the garbage collection capability of the Java card under the limit condition can be evaluated.
Specifically, the garbage collection capability of the Java card can be evaluated by the following formula:
P re =(S2-S1)/S0
wherein, P re For the recovery rate of the Java card, S1 is a first space parameter, S2 is a second space parameter, and S0 is the amount of space occupied by all preset objects in the target space.
At P re And when the difference value is 100%, the difference value between the second space parameter and the first space parameter is positive and equal to the space amount occupied by all preset objects, and the fact that the Java card can completely recycle all the preset objects can be determined, and the Java card has a garbage recycling function. At P re If the difference value is not 100%, it indicates that the difference value between the second space parameter and the first space parameter is smaller than the space amount occupied by all the preset objects, and it is determined that the Java card cannot completely recycle all the preset objects, and the Java card does not have a garbage recycling function.
Referring to FIG. 6, in some embodiments, a plurality of physical memory pages form a target space. The test method comprises the following steps:
051: after the recovery operation is finished, continuously creating a plurality of preset objects again until the target space is completely occupied again;
052: under the condition that the space amount occupied by the plurality of initially created preset objects is equal to the space amount occupied by the plurality of newly created preset objects, continuously creating the plurality of preset objects in the target space at intervals till the target space is completely occupied for the third time, wherein the space amount between every two adjacent preset objects is smaller than the maximum space amount of the physical storage page;
053: after the recovery operation is completed again, a plurality of preset objects are continuously created at intervals until the target space is completely occupied for the fourth time, and the space amount between every two adjacent preset objects is smaller than the maximum space amount of the physical storage page;
054: determining the space amount which is not occupied by the preset object in the target space as a new first space parameter under the condition that the target space is completely occupied for the third time;
055: after the recycling operation is completed again, determining the space amount which is not occupied by the preset object in the target space as a new second space parameter;
step 06 (determining the test result according to the first spatial parameter and the second spatial parameter), comprising:
061: and determining a test result according to the new first space parameter and the new second space parameter.
The test method according to the embodiment of the present invention can be implemented by the test system 100 according to the embodiment of the present invention. Specifically, referring to fig. 2, the test system 100 is used for: after the recovery operation is finished, continuously creating a plurality of preset objects again until the target space is completely occupied again; under the condition that the space amount occupied by the plurality of initially created preset objects is equal to the space amount occupied by the plurality of newly created preset objects, continuously creating the plurality of preset objects in the target space at intervals till the target space is completely occupied for the third time, wherein the space amount between every two adjacent preset objects is smaller than the maximum space amount of the physical storage page; after the recycling operation is completed again, a plurality of preset objects are continuously established at intervals until the target space is completely occupied for the fourth time, and the space amount between every two adjacent preset objects is smaller than the maximum space amount of the physical storage page; determining the space amount which is not occupied by the preset object in the target space as a new first space parameter under the condition that the target space is completely occupied for the third time; after the recycling operation is completed again, determining the space amount which is not occupied by the preset object in the target space as a new second space parameter; and determining a test result according to the new first space parameter and the new second space parameter.
Therefore, the test strength of the Java card can be improved.
Specifically, referring to fig. 7, in the embodiment shown in fig. 7, the operation flows of creating the preset object for the first time, performing the recycling operation on the preset object created for the first time, and creating the preset object for the second time may be represented in a first manner. After the first mode is completed, the space amount occupied by the plurality of re-created preset objects (corresponding to the first object total amount) and the space amount occupied by the plurality of initially created preset objects (corresponding to the first garbage total amount) are compared.
Under the condition that the first object total amount is not equal to the first garbage total amount, the situation indicates that the Java card cannot completely recycle all preset objects currently, and a garbage recycling mechanism in the Java card has problems and further does not have garbage recycling capability, so that the test can be stopped; in case the first object amount is equal to the first garbage amount, it means that the Java card currently has all the preset objects recycled completely, and thus enters further testing.
Specifically, in the case of confirming that the first manner has been executed, the amount of space of the interval may be preset, and then when a plurality of preset objects are created for the third time, two adjacent preset objects are made to form an interval with the amount of space of the interval and occupy the target space. Referring to fig. 8, the target space is formed as a plurality of adjacent physical storage pages, and the preset object is stored in the physical storage pages as corresponding array data, so that the preset object occupies the target space. In fig. 8, a preset object is denoted by i, a space of an interval is denoted by d, and a physical memory page is denoted by p. One of them is predetermine the object and can occupy the initial position of first physical storage page earlier, the subsequent other positions of first physical storage page then can form spaced space volume, another predetermines the object and then can occupy the initial position of second physical storage page earlier, the subsequent other positions of second physical storage page then can form spaced space volume, so on and so on, finally can form a large amount of rubbish spaces that have great interval in the target space, thereby can make the Java card retrieve a large amount of mutual spaced rubbish spaces in the target space, thereby improve the test intensity to the Java card. In one embodiment, the amount of space of the interval may be reduced by 1 byte for the total amount of space of the physical memory page.
On the basis, after the plurality of preset objects are created for the third time, the recycling operation is executed again, the new first space parameter is determined before the recycling operation is completed again, and the new second space parameter is determined after the recycling operation is completed again.
In some embodiments, after the recycling operation is completed again, the plurality of preset objects are created again at intervals to occupy the target space for the fourth time, and the amount of space occupied by the plurality of preset objects created again at intervals (corresponding to the second total amount of objects) is compared with the amount of space occupied by the plurality of preset objects created at intervals (corresponding to the second total amount of garbage) to form a comprehensive test result.
In certain embodiments, step 06 (determining test results from the first spatial parameter and the second spatial parameter) comprises:
determining that the Java card has a garbage recycling function under the condition that the difference value between the new second space parameter and the new first space parameter is positive and equal to the space amount occupied by all preset objects;
and under the condition that the difference value between the new second space parameter and the new first space parameter is smaller than the space amount occupied by all preset objects, determining that the Java card has a garbage recovery function, and the garbage recovery rate is smaller than a preset value.
The test method according to the embodiment of the present invention may be implemented by the test system 100 according to the embodiment of the present invention. Specifically, referring to fig. 2, the test system 100 is configured to: determining that the Java card has a garbage recycling function under the condition that the difference value between the new second space parameter and the new first space parameter is positive and equal to the space amount occupied by all preset objects; and under the condition that the difference value of the new second space parameter and the new first space parameter is smaller than the space amount occupied by all the preset objects, determining that the Java card has a garbage recovery function, and the garbage recovery rate is smaller than a preset value.
Therefore, the garbage collection capability of the Java card under the limit condition can be evaluated.
Specifically, the garbage collection capability of the Java card can be evaluated by the following formula:
P re '=(S2'-S1')/S0
wherein, P re The ' is the recovery rate obtained by the Java card in a mode of creating the preset objects at intervals, S1' is a new first space parameter, S2' is a new second space parameter, and S0 is the amount of space occupied by all the preset objects in the target space.
Determining the recovery rate P of the Java card according to the original first space parameter and the original second space parameter re Is 100%, anddetermining the recovery rate P of the Java card according to the new first space parameter and the new second space parameter re The case of' 100% indicates that the Java card not only has good garbage collection capability, but also can achieve extremely high garbage collection rate under different limit conditions. Determining the recovery rate P of the Java card according to the original first space parameter and the original second space parameter re ' 100%, and determining the recovery rate P of the Java card according to the new first space parameter and the new second space parameter re When the' is not 100%, it means that the Java card has a good garbage collection capability, but has a certain disadvantage in that it affects the garbage collection rate in different limit cases.
In addition, the above embodiment evaluates the Java card mainly according to the garbage collection effect, and in the test method of the present invention, the Java card can be tested and evaluated deeply enough through other aspects.
In particular, for the Java card, after data update, the updated content needs to be protected. For some Java cards, the whole physical storage page where the updated content is located may be backed up, or other data between the updated contents located in different areas may also be backed up, so that a large amount of data is written across pages, which causes a problem of insufficient space in a backup area, and affects the transaction protection capability of the Java card.
Referring to FIG. 9, FIG. 9 illustrates an embodiment of evaluating a Java card based on the effectiveness of transaction protection. Specifically, in fig. 9, the byte size α of the maximum space that can be occupied by the physical memory page is determined, and the initial value of β is set to 1 byte. And then, continuously creating preset objects with the byte size of alpha of array data in all physical storage pages in the target space until the preset objects completely occupy the target space, and recording the number of the preset objects as N. Before the transaction is created, the number N of preset objects which need to be operated on the transaction is set as N, and then the transaction is created. In the transaction, the preset object to be operated in the target space is updated to change the content of the last beta bytes of the array data in the preset object to be operated, and then the transaction is submitted for verification.
In the verification process, whether a numerical value N of a preset object needing to be operated by a transaction is currently N is judged, if yes, whether the transaction is successfully executed is judged, after the transaction is successfully executed, beta is increased by 1 byte in a mode of 'beta = beta + 1', and the transaction is re-executed, and after the transaction is not successfully executed, whether beta is currently 1 byte is judged; if not, judging whether the transaction is successfully executed, directly stopping verification and recording current parameters (the number n of preset objects needing to be operated by the current transaction and the current beta) in the current verification process after the transaction is successfully executed, and reducing the number of the preset objects needing to be operated by the transaction by 1 and re-executing the transaction in a mode of 'n = n-1' after the transaction is determined to be unsuccessfully executed.
On the basis, in the verification process of determining whether β is currently 1 byte, if yes, the number of preset objects that the transaction needs to operate is reduced by 1 in a manner of "n = n-1" and the transaction is re-executed, if not, a parameter k with an initial value of 1 is set, and the operation content of the transaction is updated to: and updating the content of the last beta bytes in the array data for the first k preset objects and updating the content of the last (beta-1) bytes in the array data for the last (N-k) preset objects in all the preset objects needing to be operated.
After the update of the operation content of the transaction is completed, whether the transaction is successfully executed is judged, if yes, the parameter k is increased by 1 in a mode of 'k = k + 1' and the transaction is re-executed, and if not, the verification is directly stopped and the current parameters (the number n of preset objects needing to be operated by the current transaction, the current beta and the current k) in the current verification process are recorded. When the transaction execution after the operation content is updated fails, it indicates that the kth of all the preset objects affects the execution of the transaction and causes the transaction execution to fail, so that the current k may be determined as the sequence number of the currently failed preset object in all the preset objects.
After the corresponding parameters have been recorded, the test results can then be determined. Wherein, when the value N of the preset objects required to be operated by the transaction is determined to be equal to the number N of the preset objects according to the returned parameter record, the result of the following formula is further determined:
G=(k-1)*β+(n-(k-1))*(β+1)
in case that it is determined that G is equal to γ, it means that the transaction protection mechanism of the Java card is not affected by the distribution of the protection data at all. In the case that it is determined that G is smaller than γ, it indicates that the transaction protection mechanism of the Java card is influenced by the data distribution to some extent, and the degree of influence depends on the difference between G and γ, and the smaller the difference is, the smaller the degree of influence by the data distribution is. Where γ is the maximum data size that the target space can support.
Under the condition that the numerical value N of the preset objects required to be operated by the transaction is determined to be smaller than the number N of the preset objects according to the returned parameter record, it indicates that the capability of the Java card in the aspect of transaction protection processing is low, the data distribution situation will have a great influence on a transaction protection mechanism of the Java card, and the result of the following formula can be further confirmed:
F=n*α
if F is equal to γ, it indicates that the transaction protection mechanism of the Java card does not process the discrete distribution of data, but protects the spatial region between the discrete data together, so that the transaction protection capability of the Java card is restricted. In the case where F is confirmed to be smaller than γ, it means that the transaction protection mechanism of the Java card is severely affected by the distribution of discrete data and has poor capability in the transaction protection processing.
Referring to fig. 2, a test system 100 for a Java card according to an embodiment of the present invention includes a memory 110 and a processor 120. The memory 110 stores a computer program, and the processor 120 implements the steps of the test method according to any of the above embodiments when executing the computer program.
For example, in the case of a computer program being executed, the following steps may be implemented:
01: creating a preset object to occupy a target space, wherein the target space is at least part of a storage space of the Java card;
02: acquiring a first space parameter, wherein the first space parameter is an available space amount in a target space before a test process is executed;
03: after the occupation of the target space is finished, executing a test process to recover a preset object;
04: acquiring a second space parameter, wherein the second space parameter is the available space amount in the target space after the test process is completed;
06: and determining a test result according to the first space parameter and the second space parameter.
The test system 100 creates a test environment by occupying space in the Java card, and obtains a test result according to a change of a space parameter of a corresponding target space before and after executing a test flow, thereby determining the garbage collection capability of the Java card according to the test result, and further evaluating the technical competitiveness of the Java card.
A computer-readable storage medium of an embodiment of the present invention has a computer program stored thereon, and when the computer program is executed by the processor 120, the computer program implements the steps of the test method of any one of the above embodiments.
For example, in the case of a computer program being executed, the following steps may be implemented:
01: creating a preset object to occupy a target space, wherein the target space is at least part of a storage space of the Java card;
02: acquiring a first space parameter, wherein the first space parameter is an available space amount in a target space before a test process is executed;
03: after the target space is occupied, executing a test process to recover a preset object;
04: acquiring a second space parameter, wherein the second space parameter is the available space amount in the target space after the test process is completed;
06: and determining a test result according to the first space parameter and the second space parameter.
The computer readable storage medium creates a test environment by occupying space in the Java card, and obtains a test result according to the change of space parameters of a corresponding target space before and after the test process is executed, so that the garbage recovery capability of the Java card is determined according to the test result, and the technical competitiveness of the Java card can be evaluated.
The computer-readable storage medium may be provided in the test system 100, or may be provided in another terminal, and the test system 100 may communicate with the other terminal to obtain the corresponding program.
It is understood that the computer-readable storage medium may include: any entity or device capable of carrying a computer program, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), software distribution medium, and the like. The computer program includes computer program code. The computer program code may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording medium, U.S. disk, removable hard disk, magnetic diskette, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), and software distribution medium.
In some embodiments of the present invention, the test system 100 may be a single-chip microcomputer chip, which integrates a processor, a memory, a communication module, and the like. The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps in the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
The logic and/or steps represented in the flowcharts or otherwise described herein, such as an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processing module-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", may explicitly or implicitly include one or more of the described features. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise.
While embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

Claims (24)

1. A test method for a Java card is characterized by comprising the following steps:
creating a preset object to occupy a target space, wherein the target space is at least a partial area of a storage space of the Java card;
acquiring a first space parameter, wherein the first space parameter is an available space amount in the target space before a test process is executed;
after the target space is occupied, executing the test flow to recover the preset object;
acquiring a second space parameter, wherein the second space parameter is the available space amount in the target space after the test process is completed;
and determining a test result according to the first space parameter and the second space parameter.
2. The testing method of claim 1, wherein obtaining the first spatial parameter comprises:
before executing a preset operation, determining a space amount which is not occupied by the preset object in the target space as the first space parameter for obtaining;
after the occupation of the target space is completed, executing the test flow to recover the preset object, including:
executing the preset operation under the condition of acquiring the first space parameter;
obtaining a second spatial parameter, comprising:
after the preset operation is completed, determining the space amount not occupied by the preset object in the target space as the second space parameter for obtaining.
3. The testing method of claim 2, wherein the predetermined operation comprises at least one of:
selecting the application instance for creating the preset object again;
deactivating the Java card;
and performing power-on and power-off processing on the Java card.
4. The method according to claim 2, wherein the predetermined operations include three predetermined operations, which are a first predetermined operation, a second predetermined operation and a third predetermined operation,
under the condition that the first space parameter is obtained, executing the preset operation, wherein the preset operation comprises the following steps:
executing the first preset operation under the condition that the first preset operation is determined not to be executed;
executing the second preset operation under the condition that the first preset operation is determined to be executed and the second preset operation is not executed;
and executing the third preset operation under the condition that the second preset operation is determined to be executed and the third preset operation is not executed.
5. The testing method of claim 4, wherein the testing method comprises:
determining that the preset operation has been performed in a case where any one of the first preset operation, the second preset operation, and the third preset operation has been performed;
and initializing the target space after the second space parameter is acquired and under the condition that the second space parameter does not meet the first test condition currently, and recreating an object to occupy the target space to execute the test process.
6. The test method of claim 5, wherein the first test condition comprises at least one of:
the second spatial parameter is greater than the first spatial parameter;
the target space is in a readable and writable state;
all of the preset operations have been performed.
7. The method of claim 2, wherein determining a test result based on the first spatial parameter and the second spatial parameter comprises:
determining that the Java card has a garbage recycling function under the condition that the second space parameter is larger than the first space parameter;
determining that the Java card has a garbage recovery function and has the maximum garbage recovery rate under the condition that the second spatial parameter is larger than the first spatial parameter and is equal to an available spatial parameter, wherein the available spatial parameter is the total spatial amount of the target space;
and determining that the Java card does not have a garbage collection function under the condition that the second space parameter is equal to the first space parameter.
8. The testing method of claim 1, wherein creating a preset object to occupy a target space comprises:
continuously creating a plurality of preset objects until the target space is completely occupied, wherein the space occupied by each preset object is less than a preset amount;
acquiring a first spatial parameter, comprising:
determining the space amount which is not occupied by the preset object in the target space as the first space parameter for obtaining before executing the recycling operation;
after the occupation of the target space is completed, executing the test process to recover the preset object, including:
after the target space is completely occupied, executing the recovery operation on all the preset objects;
obtaining a second spatial parameter, comprising:
after the recycling operation is completed, determining the space amount not occupied by the preset object in the target space as the second space parameter for obtaining.
9. The method of claim 8, wherein determining a test result based on the first spatial parameter and the second spatial parameter comprises:
determining that the Java card has a garbage recycling function under the condition that the difference value between the second spatial parameter and the first spatial parameter is positive and equal to the space amount occupied by all the preset objects;
and under the condition that the difference value between the second space parameter and the first space parameter is smaller than the space amount occupied by all the preset objects, determining that the Java card does not have a garbage recycling function.
10. The method of testing of claim 8, wherein a plurality of physical memory pages form the target space, the method comprising:
after the recovery operation is finished, continuously creating a plurality of preset objects again until the target space is completely occupied again;
under the condition that the space occupied by the plurality of preset objects which are created for the first time is equal to the space occupied by the plurality of preset objects which are created again, the plurality of preset objects are created in the target space at intervals continuously until the target space is completely occupied for the third time, and the space between two adjacent preset objects is smaller than the maximum space of the physical storage page;
after the recycling operation is completed again, a plurality of preset objects are continuously created at intervals until the target space is completely occupied for the fourth time, and the space amount between every two adjacent preset objects is smaller than the maximum space amount of the physical storage page;
determining the space amount which is not occupied by the preset object in the target space as a new first space parameter under the condition that the target space is completely occupied for the third time;
after the recycling operation is completed again, determining the space amount which is not occupied by the preset object in the target space as a new second space parameter;
determining a test result according to the first spatial parameter and the second spatial parameter, including:
and determining the test result according to the new first space parameter and the new second space parameter.
11. The method of claim 10, wherein determining a test result based on the first spatial parameter and the second spatial parameter comprises:
determining that the Java card has a garbage recycling function under the condition that the difference value between the new second spatial parameter and the new first spatial parameter is positive and equal to the space amount occupied by all the preset objects;
and under the condition that the difference value between the new second spatial parameter and the new first spatial parameter is smaller than the space amount occupied by all the preset objects, determining that the Java card has a garbage recovery function, and the garbage recovery rate is smaller than a preset value.
12. A test system for a Java card, the test system configured to:
creating a preset object to occupy a target space, wherein the target space is at least a partial area of a storage space of the Java card;
acquiring a first space parameter, wherein the first space parameter is an available space amount in the target space before a test process is executed;
after the target space is occupied, executing the test flow to recover the preset object;
acquiring a second space parameter, wherein the second space parameter is the available space amount in the target space after the test process is completed;
and determining a test result according to the first space parameter and the second space parameter.
13. The test system of claim 12, wherein the test system is configured to:
determining the space amount which is not occupied by the preset object in the target space as the first space parameter for obtaining before executing preset operation;
executing the preset operation under the condition of acquiring the first space parameter;
after the preset operation is completed, determining the space amount not occupied by the preset object in the target space as the second space parameter for obtaining.
14. The test system of claim 13, wherein the preset operation comprises at least one of:
selecting the application instance for creating the preset object again;
deactivating the Java card;
and performing power-off processing on the Java card.
15. The test system of claim 13, wherein the predetermined operations comprise three predetermined operations, the three predetermined operations being a first predetermined operation, a second predetermined operation, and a third predetermined operation, the test system being configured to:
executing the first preset operation under the condition that the first preset operation is determined not to be executed;
executing the second preset operation under the condition that the first preset operation is determined to be executed and the second preset operation is not executed;
and executing the third preset operation under the condition that the second preset operation is determined to be executed and the third preset operation is not executed.
16. The test system of claim 15, wherein the test system is configured to:
determining that the preset operation has been performed in a case where any one of the first preset operation, the second preset operation, and the third preset operation has been performed;
and initializing the target space after the second space parameter is acquired and under the condition that the second space parameter does not meet the first test condition currently, and recreating an object to occupy the target space to execute the test process.
17. The test system of claim 16, wherein the first test condition comprises at least one of:
the second spatial parameter is greater than the first spatial parameter;
the target space is in a readable and writable state;
all of the preset operations have been performed.
18. The test system of claim 13, wherein the test system is configured to:
determining that the Java card has a garbage recycling function under the condition that the second space parameter is larger than the first space parameter;
determining that the Java card has a garbage recovery function and has the maximum garbage recovery rate under the condition that the second spatial parameter is greater than the first spatial parameter and is equal to an available spatial parameter, wherein the available spatial parameter is the total spatial amount of the target space;
and determining that the Java card does not have a garbage collection function under the condition that the second space parameter is equal to the first space parameter.
19. The test system of claim 12, wherein the test system is configured to:
continuously creating a plurality of preset objects until the target space is completely occupied, wherein the space occupied by each preset object is less than a preset amount;
determining the space amount which is not occupied by the preset object in the target space as the first space parameter for obtaining before executing the recycling operation;
after the target space is completely occupied, executing the recovery operation on all the preset objects;
after the recycling operation is completed, determining the space amount in the target space not occupied by the preset object as the second space parameter for acquisition.
20. The test system of claim 19, wherein the test system is configured to:
determining that the Java card has a garbage recycling function under the condition that the difference value between the second space parameter and the first space parameter is positive and equal to the space amount occupied by all the preset objects;
and determining that the Java card does not have a garbage collection function under the condition that the difference value between the second space parameter and the first space parameter is smaller than the space amount occupied by all the preset objects.
21. The test system of claim 19, wherein a plurality of physical memory pages form the target space, the test system to:
after the recovery operation is finished, continuously creating a plurality of preset objects again until the target space is completely occupied again;
under the condition that the space amount occupied by the plurality of initially created preset objects is equal to the space amount occupied by the plurality of newly created preset objects, continuously creating the plurality of preset objects in the target space at intervals until the target space is completely occupied for the third time, wherein the space amount between every two adjacent preset objects is smaller than the maximum space amount of the physical storage page;
after the recycling operation is completed again, a plurality of preset objects are continuously created at intervals until the target space is completely occupied for the fourth time, and the space amount between every two adjacent preset objects is smaller than the maximum space amount of the physical storage page;
determining the space amount which is not occupied by the preset object in the target space as a new first space parameter under the condition that the target space is completely occupied for the third time;
after the recycling operation is completed again, determining the space amount which is not occupied by the preset object in the target space as a new second space parameter;
and determining the test result according to the new first space parameter and the new second space parameter.
22. The test system of claim 21, wherein the test system is configured to:
determining that the Java card has a garbage recycling function under the condition that the difference value between the new second spatial parameter and the new first spatial parameter is positive and equal to the space amount occupied by all the preset objects;
and under the condition that the difference value between the new second spatial parameter and the new first spatial parameter is smaller than the space amount occupied by all the preset objects, determining that the Java card has a garbage recovery function, and the garbage recovery rate is smaller than a preset value.
23. A test system for a Java card comprising a memory storing a computer program and a processor implementing the steps of the test method of any one of claims 1 to 11 when the computer program is executed by the processor.
24. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the testing method according to any one of claims 1 to 11.
CN202210978784.XA 2022-08-16 2022-08-16 Test method, test system, and computer-readable storage medium Active CN115048256B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210978784.XA CN115048256B (en) 2022-08-16 2022-08-16 Test method, test system, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210978784.XA CN115048256B (en) 2022-08-16 2022-08-16 Test method, test system, and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN115048256A CN115048256A (en) 2022-09-13
CN115048256B true CN115048256B (en) 2022-11-29

Family

ID=83168119

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210978784.XA Active CN115048256B (en) 2022-08-16 2022-08-16 Test method, test system, and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN115048256B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103778067A (en) * 2014-02-11 2014-05-07 珠海市金邦达保密卡有限公司 Object processing method and device of Java card and Java card
CN109739779A (en) * 2019-01-07 2019-05-10 金邦达有限公司 A kind of method, computer installation and computer readable storage medium obtaining free memory in java card
CN110569188A (en) * 2019-08-14 2019-12-13 平安普惠企业管理有限公司 method and device for automatically switching test environment, computer equipment and storage medium
EP4020297A1 (en) * 2020-12-23 2022-06-29 Idemia Identity & Security France Method for managing a volatile memory and java card device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103778067A (en) * 2014-02-11 2014-05-07 珠海市金邦达保密卡有限公司 Object processing method and device of Java card and Java card
CN109739779A (en) * 2019-01-07 2019-05-10 金邦达有限公司 A kind of method, computer installation and computer readable storage medium obtaining free memory in java card
CN110569188A (en) * 2019-08-14 2019-12-13 平安普惠企业管理有限公司 method and device for automatically switching test environment, computer equipment and storage medium
EP4020297A1 (en) * 2020-12-23 2022-06-29 Idemia Identity & Security France Method for managing a volatile memory and java card device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Java卡关键技术的研究及实现;李彦超等;《计算机应用》;20060310(第03期);全文 *
Java卡平台测试策略;周斌;《中国集成电路》;20130705(第07期);全文 *

Also Published As

Publication number Publication date
CN115048256A (en) 2022-09-13

Similar Documents

Publication Publication Date Title
KR100873943B1 (en) System and method of reading non-volatile computer memory
US7418436B2 (en) Information processing apparatus, memory management apparatus, memory management method, and information processing method
US7240178B2 (en) Non-volatile memory and non-volatile memory data rewriting method
US9542431B2 (en) Cyclic commit transaction protocol
CN104077197B (en) System recovery method, device, solid state hard disc and electronic equipment
CN109508148B (en) Metadata reconstruction method and device and computer readable storage medium
CN110286853B (en) Data writing method and device and computer readable storage medium
CN109656779A (en) Internal memory monitoring method, device, terminal and storage medium
CN113744064B (en) Method and apparatus for performing transactions in block link points
CN111785315B (en) Method, system, storage medium and terminal for reducing erasing interference and erasing time
CN101546287A (en) Code modification method and code modification equipment
CN105824730A (en) Method and device for diagnosing and repairing hardware
CN107516546B (en) Online detection device and method for random access memory
CN115048256B (en) Test method, test system, and computer-readable storage medium
CN116954906A (en) Node capacity expansion and contraction method, system, terminal and medium in graph database cluster
CN115858172A (en) Processor instruction execution statistical method and device and processor system
CN113568581B (en) Multi-application resource recovery method and system for embedded equipment
CN111813748B (en) File system mounting method and device, electronic equipment and storage medium
CN116149963A (en) Method for detecting memory leakage of Linux kernel
JP2003036209A (en) Nonvolatile memory and data rewriting method thereof
CN111785316B (en) Method, system, storage medium and terminal for overcoming erasure interference
CN112908390B (en) Data storage method, device, electronic equipment and storage medium
CN110471626B (en) Nor Flash management layer and method applied to Java Card
CN110874273B (en) Data processing method and device
CN106021124A (en) Data storage method and data storage system

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
GR01 Patent grant
GR01 Patent grant