1. Field of the Invention
This invention relates to the field of data processing systems. More particularly, this invention relates to techniques of automatically generating test program instructions for testing a data processing system.
2. Background of the Invention
As data processing systems increase in complexity, there is an increasing need for rapid and thorough testing of such data processing systems. One known technique is to execute test programs upon such data processing systems to check that the results produced match those expected. A difference between the expected and the actual results indicates a design or manufacturing defect. In order to thoroughly test data processing systems with their high levels of complexity it is important to try to place the data processing system into as broad a range or functional states as possible in order to more reliably identify problems which may occur only in a small number of functional states of the system. In order to generate the large test programs required to comprehensively test data processing systems, it has been proposed to write computer programs that will generate test programs. However, the computer programs for generating test programs are in themselves large and complex and represent a considerable investment in time, effort and skill.
Viewed from one aspect the present invention provides a method of automatically generating test program instructions for a data processing apparatus from an architectural definition of at least one instruction set of said data processing apparatus, said method comprising:
(i) parsing said architectural definition to identify within said at least one instruction set a set of distinct program instructions independent of their operand values;
(ii) associating with respective distinct program instructions operand defining data specifying ranges of required operand values;
(iii) forming instruction-generating program code using respective associated operand defining-data and distinct program instructions read from said set of distinct program instructions; and
(iv) executing said instruction-generating program code to generate said test program instructions.
The present technique serves to enable the automatic generation of test programs using instruction-generating program code which is itself automatically generated. At the base of the system is an architectural definition of the data processing apparatus under test. This architectural definition can be parsed rigorously and comprehensively to extract a set of distinct program instructions which may be executed as instructions within one of the instruction sets of the data processing apparatus. These distinct instructions are then associated with data characterising their operand variables. This complete collection of distinct instruction characterising information which has been automatically generated can then be used to automatically form instruction-generating program code, which in turn may be used to form program instructions for testing the data processing apparatus. The comprehensive and rigorous nature of the manner in which the instruction-generating program code is formed serves to form a collection of instruction-generating program code enabling a broad range of test programs to be written exploring a wide range of functional states of the data processing apparatus.
Whilst the instruction-generating program code may take a variety of forms and operate in a variety of different ways, it is desirable to provide: an instruction constructor for constructing a test instruction using at least partially user specified operand values or random (quasi-random) operand values; a mutator function which is able to quasi-randomly alter test program instructions that have already been formed (this is highly useful in the context of using genetic algorithms to vary the test instructions and test programs to improve the range of their test coverage); and an instruction encoder able to produce binary executable forms of the instructions for target data processing apparatus embodiments.
The architectural definition of the data processing apparatus may be formed in a variety of different ways, such as a flat file representation of different possible instructions and states. However, a preferred form of representation is hierarchical, such as a tree format.
The architectural definition may also inherently provide or be annotated to specify functional points within the operation of the data processing apparatus with these being suitable to be parsed to identify a set of combinations of functional points representing reachable states during execution of real programs. In this way, it is possible to avoid testing unreachable functional states of the system as this would be a waste of testing effort and could produce erroneous results.
Viewed from another aspect the present invention provides apparatus for processing data operable to automatically generate test program instructions for a data processing apparatus from an architectural definition of at least one instruction set of said data processing apparatus, said apparatus comprising logic operable to perform the steps of:
(i) parsing said architectural definition to identify within said at least one instruction set a set of distinct program instructions independent of their operand values;
(ii) associating with respective distinct program instructions operand defining data specifying ranges of required operand values;
(iii) forming instruction-generating program code using respective associated operand defining data and distinct program instructions read from said set of distinct program instructions; and
(iv) executing said instruction-generating program code to generate said test program instructions.
Viewed from a further aspect the present invention provides a computer program product bearing a computer program for controlling a computer to perform a method of automatically generating test program instructions for a data processing apparatus from an architectural definition of at least one instruction set of said data processing apparatus, said method comprising:
(i) parsing said architectural definition to identify within said at least one instruction set a-set of distinct program instructions independent of their operand values;
(ii) associating with respective distinct program instructions operand defining data specifying ranges of required operand values;
(iii) forming instruction-generating program code using respective associated operand defining data and distinct program instructions read from said set of distinct program instructions; and
(iv) executing said instruction-generating program code to generate said test program instructions.
The above, and other objects, features and advantages of this invention will be apparent from the following detailed description of illustrative embodiments which is to be read in connection with the accompanying drawings.
Whilst it will be appreciated that effort is required from skilled engineers to form the architectural definition, this architectural definition is capable of considerable re-use as it will likely be un-altered, or only slightly altered, in different implementation and evolve gradually with time. It is common for many specific implementations of data processing apparatus which will require separately testing and have differing micro-architectures targeted at different applications to nevertheless share a common instruction set of architectural definition at the level illustrated in
The instruction-generating code produced may implement an instructor constructor function, an instruction mutator function or an instruction encoder function. The instruction constructor forms a new specific instance of a test program instruction using at least partially specified operand variables and/or random operand variables in accordance with settings applied to that constructor, such as via a weighting or template file, which has been user defined. A mutator function is also formed as one of the types of instruction generating code and serves to take as an input an already existing test instruction an mutate/alter this in accordance with predetermined (e.g. user specified) rules and degrees of freedom to form a mutated test instruction. This mutation mechanism is useful when the test program instructions are being processed by genetic algorithms seeking to form sequences of test program instructions which exercise the target data processing apparatus under test to adopt a wide range of functional states. The encoder function serves form a binary executable form of a test program instruction, such as a 32-bit instruction word in the case of an ARM instruction.
Step 8 executes a program which reads the data defining each distinct program instruction and its associated operand defining data in turn and for each of those elements automatically generates code to serve as a constructor, mutator and encoder for that element. As an example, in the case of the ARM instruction set there may be in the order of one thousand possible distinct program instructions identified by the parsing of the architectural definition of the ARM instruction set and constructor, mutator and encoder functions are automatically generated for each of those distinct program instruction types. The Thumb instruction set would typically have many fewer distinct program instruction types since it is a shorter 16-bit instruction set. The Jazelle instruction set is shorter still since it is primarily populated with the relatively few Java opcode types.
Step 10 serves to read user specified weighting and template files in respect of the generation of test program instructions required by a particular user. Step 12 then executes the appropriate constructor/mutator functions followed by the encoder functions to form specific. test program instructions, such as illustrated in
Step 16 illustrates the reading of embedded hints/comments within the architectural definition of
The above described techniques for constructing, mutating and encoding test program instructions can be employed by genetic algorithms to form candidate test programs for evaluation. These candidate test programs may be subject to instruction set simulator execution to determine the functional points reached by such execution. The set of functional points so reached may be compared with the set of functional points identified in step 18 of
Although illustrative embodiments of the invention have been described in detail herein with reference to the accompanying drawings, it is to be understood that the invention is not limited to those precise embodiments, and that various changes and modifications can be effected therein by one skilled in the art without departing from the scope and spirit of the invention as defined by the appended claims.