# Patent

## Title
Framework for a software error inject tool

## Abstract

Provided are techniques for receiving an error inject script that describes one or more error inject scenarios that define under which conditions at least one error inject is to be executed and compiling the error inject script to output an error inject data structure. While executing code that includes the error inject, an indication that an event has been triggered is received, conditions defined in the one or more error inject scenarios are evaluated using the error inject data structure, and, for each of the conditions that evaluates to true, one or more actions defined in the error inject script for the condition are performed.

## Background
BACKGROUND
1. Field
Embodiments of the invention relate to a framework for a software error inject tool.
2. Description of the Related Art
For a complex and highly resilient computerized system (e.g., one in which a majority of the functions are implemented by computer programs), it may be difficult to create conditions to naturally exercise certain code paths, such as error code paths. This creates challenges for software development and quality assurance.
A common conventional approach is to implement error inject code (including test scenario code and error injects) embedded within normal code (i.e., code that is compiled and executed). Error inject code may be described as one or more computer programs that add erroneous behavior to the normal program when they are executed. This is done to test possible error conditions. Then, depending on how safe the implementation is (i.e., how easily the error inject code could be incorrectly executed as part of the normal code, and, when the error inject code is executed by mistake, how large the damage is to the computerized system), runtime switches or conditional compiles are used to enable the error inject code. An error inject may be described as execution of the error inject code or other method that can cause the computerized system to exhibit erroneous behavior. Runtime switches may be described as inputs to the computer program to cause the computer program to execute in different paths. Conditional compiles may be described as compile time switches that cause a compiled program to execute in different paths. So, the cost of repeating and/or running a series of different error injects may be high, especially for a large computerized system. This is because it may take some time to recompile and restart such a large computerized system.
Also, for a complex error inject that involves multiple error inject points, the current conventional approach tends to make the error inject code so unique that it becomes hard to re-use the error inject code.
Also, when error inject code is embedded in normal code to do the error injects, when a different error inject or different condition is needed, the embedded error inject code needs to be modified and recompiled. This makes it more difficult to iterate through different test scenarios in the test process.
Thus, there is a need for a framework for a software error inject tool.
BRIEF SUMMARY
Provided are a method, computer program product, and system for receiving an error inject script that describes one or more error inject scenarios that define under which conditions at least one error inject is to be executed and compiling the error inject script to output an error inject data structure. While executing code that includes the error inject, an indication that an event has been triggered is received, conditions defined in the one or more error inject scenarios are evaluated using the error inject data structure, and, for each of the conditions that evaluates to true, one or more actions defined in the error inject script for the condition are performed.



BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS
Referring now to the drawings in which like reference numbers represent corresponding parts throughout:
FIG. 1 illustrates a system architecture in accordance with certain embodiments.
FIG. 2 illustrates further details of code in accordance with certain embodiments.
FIG. 3 illustrates a table with sample syntax for a declaration in accordance with certain embodiments.
FIG. 4 illustrates a sample declaration in accordance with certain embodiments.
FIG. 5 illustrates sample conditions in accordance with certain embodiments.
FIG. 6 illustrates a sample table of actions in accordance with certain embodiments.
FIG. 7 illustrates a sample scenario to verify that a warmstart finished in eight seconds in accordance with certain embodiments
FIG. 8 illustrates a sample format of a data structure in accordance with certain embodiments. FIG. 8 is formed by the sequence of figures FIG. 8A, FIG. 8B, FIG. 8C, FIG. 8D, and FIG. 8E.
FIG. 9 illustrates a sample data structure in accordance with certain embodiments.
FIG. 10 illustrates logic performed by an error inject compiler in accordance with certain embodiments.
FIG. 11 illustrates logic to trigger an event in accordance with certain embodiments.
FIG. 12 illustrates logic performed by an error inject interpreter in accordance with certain embodiments.
FIG. 13 illustrates a computer architecture that may be used in accordance with certain embodiments.



DETAILED DESCRIPTION
In the following description, reference is made to the accompanying drawings which form a part hereof and which illustrate several embodiments of the invention. It is understood that other embodiments may be utilized and structural and operational changes may be made without departing from the scope of the invention.
FIG. 1 illustrates a system architecture in accordance with certain embodiments. A computing device 100 is coupled to a storage controller 140 via a communication path 190. The communication path 190 may comprise any type of communication path, such as, for example, a peer-to-peer network, spoke and hub network, Storage Area Network (SAN), a Local Area Network (LAN), Wide Area Network (WAN), the Internet, an Intranet, etc.
With embodiments, an error inject tool may be said to consist of a user mode that includes an error inject compiler 110 and an error inject process that includes an error inject interpreter 170. In the user mode, the error inject compiler 110 (e.g., a user mode program) takes the error inject script 120 as input and compiles the error inject script 120 to produce an error inject data structure 130 that can be processed by the error inject interpreter 170. The error inject interpreter 170 may also be referred to as an embedded interpreter.
A device read/write interface 142 reads the error inject data structure 130 at the computing device 100 and copies the error inject data structure 130 to the storage controller 140. In certain embodiments, the read/write interface 142 is part of the storage controller 140.
The error inject interpreter 170 runs under the storage controller 140. The error inject interpreter 170 uses the error inject data structure 130, which is the output of the error inject compiler 110, and one or more events 160 to determine when to inject particular errors (i.e., when to execute one or more error injects 180). The error injects 180 include common (pre-defined) error injects 182 and non-common (i.e., customized or embedded) error injects 184. In certain embodiments, non-common error injects 184 may be described as being customized by a programmer.
The storage controller 140 includes code 150 and executable code 156. FIG. 2 illustrates further details of code 150, 156 in accordance with certain embodiments. The code 150 may be said to include code paths 152 and error injects 180. The code paths 152 include event macros 154. An event macro 154 may be described as a statement in the code path 152. The code 150 is compiled to create the executable code 156, which is executed to test the erroneous behavior. The executable code 156 includes code paths 152′, which include event macros 154′, and error injects 180′. In certain embodiments, the executable code 156 may be said to include the error inject interpreter 170, common error injects 182, and non-common error injects 184.
Thus, embodiments provide a framework for adding software error inject code to code 150. Code 150 may be described as “normal” code or code that was not written to include such error inject code in a manner that avoids recompilation and restarting of the executable code 156. With embodiments, the error inject scenarios 124 and common error injects 182 (e.g., warmstart and failover) are separated from the inject locations and non-common error injects 184. A warmstart process may be described as a self correcting process in which there is resumption of operation of the storage controller 140, following a problem-generated shutdown, in which the code 150 running on the storage controller 140 can resume at the point at which it was at when the shutdown occurred and data is not lost. A failover process may be described as one in which processing is switched from the storage controller 140 to another storage controller (not shown in FIG. 1).
Also, the inject locations and, if needed, the non-common error injects 184 are coded in to the code 150, and these code segments of inject locations are not executed without driving the error inject scenarios 124. That is, the non-common error injects 184 are executed when an event 160 occurs and the error inject interpreter 170 determines which, if any, of the non-common error injects 184 are to be executed.
The error inject scenarios 124 and conditions under which error injects 180 are to be executed are specified in the error inject scripts 120 using an error inject specification language. When the error inject data structure 130 (i.e., the compiled error inject script 120) is loaded into the storage controller 140, the storage controller 140 activates the events 160 and controls the error injects 180 as described by the error inject script 120.
With embodiments, the framework for the error inject tool provides a convenient environment for users to specify an error inject scenario 124 of error injects 180. That is, the error inject scenario 124 describes under what conditions both common error injects 182 and non-common error injects 184 should be executed. The common error inject 182 behavior is defined by the error inject interpreter 170, while the non-common error inject 184 behavior is defined by programmers. In certain embodiments, the error inject tool may be said to include the error inject compiler 110 and the error inject interpreter 170. The error inject scenario 124 is described by an error inject script 120 that describes one or more error injects 180. For each error inject 180, the error inject script 120 allows users to describe when and under what conditions to inject particular errors into the code 150.
Thus, embodiments describe a software error inject tool for a storage controller 140 and specification language understood by the storage controller 140. In certain embodiments, the storage controller 140 is a multi-processor, multi-threaded system with self-healing capability through warmstart process. To make sure that the storage controller 140 can perform all recovery functions correctly, embodiments enable injecting errors at all possible system states.
The error inject script 120 consists of two parts: one or more declarations 122 and one or more error inject scenarios 124, which are described using an error inject specification language.
With embodiments, the declaration 122 is used to declare and define programming elements that will be used in the error inject script 120 for error injects. With embodiments, the programming elements include events, counters, states, constants, and timers. As an example, states may be defined for cluster status Initial Microcode Load (IML), warmstart, operational (i.e., running in normal state), and shutdown. With embodiments, the declarations 122 come before other non-declaration statements in the scrip 120. With embodiments, the error inject scenario 124 is used to define one or more conditions and their associated error inject actions. In certain embodiments, the specification language is an event driven language (i.e., is not a procedural language), and the order of the statements do not represent the execution order.
FIG. 3 illustrates a table 300 with sample syntax for a declaration 122 in accordance with certain embodiments. The declaration 122 is used to define programming elements. The initial value of each programming element may also be set as part of the declaration 122. In table 300, the keywords are: EVENT, COUNTER, STATE, CONSTANT, TIMER, and TIMER RESOLUTION.
In certain embodiments, symbols may have alphanumeric and ‘_’ characters, except for the first character, which is not a number. In certain embodiments, the statements end with a ‘;’ character. In certain embodiments, the statements in square brackets ([ ]) are optional. In certain embodiments, the symbols are in one name space.
In certain embodiments, the values are positive numbers ranging from 0 to 0xffffffff, and hexadecimal (hex) numbers are indicated by the leading ‘0x’. In certain embodiments, the values may be expressed by constant symbols once they are defined. In certain embodiments, comments are started with a ‘#’ character, and the comments extend to the end of the line.
FIG. 4 illustrates a sample declaration 400 in accordance with certain embodiments. In the declaration 400, the EVENT is a WarmstartPhase0, the STATE is Machine, and the TIMER is WS_Timer.
In certain embodiments, the error inject scenario 124 is defined by one or more condition-action pair statements. The syntax for an error inject scenario 124 is a statement having: (conditions) {actions}. Each time that an event 160 occurs (e.g., an armed event macro 154 is invoked) or a timer update occurs, the conditions are evaluated by the error inject interpreter 170. A statement with a true condition will have its associated actions carried out. The actions may change states or counters that cause more conditions to become true, and this will trigger more actions to be performed. In certain embodiments, however, an action is executed at most once for each event or timer update.
In certain embodiments, events and timers are two external sources that cause the conditions to change. In certain embodiments, there are two techniques to specify event conditions. In a first technique, an event condition is specified by an event symbol in a predicate without any comparison operators. The event symbol is evaluated to true if the event 160 is armed and the event macro 154 is invoked.
In a second technique, the event condition is specified with the event symbol with comparison operators in a predicate. The predicate is evaluated to true when the event 160 is armed, the event macro 154 is invoked, and the event data as the value of the event symbol makes the predicate true. With embodiments, INIT (i.e., initialization) is a predefined condition that is TRUE when the error inject script 120 is loaded, and INIT is FALSE other times.
FIG. 5 illustrates sample conditions 500 in accordance with certain embodiments. The first condition, (WarmstartPhase0), is an example of use of the first technique. The second condition, (WarmstartPhase0>=55), is an example of use of the second technique.
Actions 128 are operations that can be performed when an associated condition 126 is evaluated to TRUE. FIG. 6 illustrates a sample table 600 of actions in accordance with certain embodiments.
FIG. 7 illustrates a sample scenario 700 to verify that a warmstart finished in eight seconds in accordance with certain embodiments. In scenario 700, two EVENTS are defined: start_warmstart and end_warmstart. In the scenario 700, the events are assigned with identifier (ID) values of 0x123 and 0x124, respectively. One timer is defined with the symbol ws_timer. At load time, both events are armed. Upon triggering of the start_warmstart event, the start_warmstart event is disarmed, and the ws_timer is set to have resolution of 1 second and to expire in 8 seconds. Upon triggering of the ws_timer (i.e. end_warmstart does not happen within 8 second), the timer is disabled, the end_warmstart event is disarmed, and a message of “Warmstart did not finished in 8 seconds” is issued to indicate that the test failed. Upon triggering the end_warmstart event, the timer is disabled, the end_warmstart event is disarmed, and a message of “Warmstart finished within 8 seconds” is issued to indicate that the test completed successfully.
The data structure is 130 produced by error inject compiler 110 and serves as input to the error inject interpreter 170. In certain embodiments, the error inject data structure 130 is in a form that can be executed directly by the error inject interpreter 170.
The declaration 122 is used to declare and define programming elements that are used in the error inject script 120 for error injects. Data elements in the error inject data structure 130 represent (i.e., correspond to) the programming elements that have been translated to the error inject data structure 130. Thus, the error inject data structure 130 contain multiple data elements.
In certain embodiments, the first part of the error inject data structure 130 is an array of data elements, and each data element takes up two 32 bit words, with the layout being different depending on the type of the data element. FIG. 8 illustrates a sample format 800, 802, 804, 806, 808 of the error inject data structure 130 in accordance with certain embodiments. FIG. 8 is formed by the sequence of figures FIG. 8A, FIG. 8B, FIG. 8C, FIG. 8D, and FIG. 8E.
In FIG. 8A, the format of a first data element 810 includes a first node, a timer resolution, a total number of elements, an index of the first action group, and a number of action groups. In FIG. 8A, the format of an action group 812 includes a type, an active flag, an index to the predicate tree or leaf, and an index to the action list or leaf. In FIG. 8A, the format of a predicate tree element 814 includes a type, a logical operation, an index of the left branch or zero, and an index of the right branch or zero.
In FIG. 8B, the format of a predicate tree leaf element 816 includes a type, a comparison operation, an index of an operand (as the first operand), and immediate data for comparison. In FIG. 8B, the format of a predicate tree leaf element for an event ID 818 includes a type, a comparison operator, and immediate data for comparison (as the second operand). In FIG. 8B, the format of a predicate tree leaf element for event data 820 includes a type, a comparison operator, and immediate data form comparison (as the second operand). In FIG. 8B, the format of a predicate tree leaf element for a timer 822 includes a type, a comparison operator, and an index of the timer (as the first operand). In FIG. 8B, the format of a predicate tree leaf element for init 824 includes a type.
In FIG. 8C, the format of an action list node 826 includes a type, an action code, an index of the next action or zero, and action data. Example action codes 828 are also illustrated in FIG. 8C.
In FIG. 8D, the format of a counter action node 830 includes a type, an operation, an index of the next action or zero, action data, and an index of the counter. In FIG. 8D, the format of an action node for counter, state, and timer assignment 832 includes a type, an index of the next action or zero, assignment data, and an index of the operand. In FIG. 8D, the format of an action node for counter, state, and timer assignment (long format) 834 includes a type, an index of the next action or zero, an index of the operand, and assignment data. In FIG. 8D, the format of an action node for a message 836 includes a type, an index of the next action or zero, and a byte offset to null terminated message data.
In FIG. 8E, the format of a timer node 838 includes a type and a timer value. In FIG. 8E, the format of a state and counter node 840 includes a type and a value. In FIG. 8E, the format of an action node for disable timer 842 includes a type, an index of the next action or zero, and an index of the operand.
FIG. 9 illustrates a sample data structure 900 in accordance with certain embodiments. In this example, the error inject compiler 110 compiles the error inject script including scenario 600 and outputs data structure 900. As an example, the data structure 900 includes a first node 902, a time resolution (10 seconds) 904, a number of elements 906, an index of a first action group 908, a number of action groups (4) 910, a timer node 912, an unitialized timer value 914, a predicate init node 916, an action list node 918, an action code (1=arm) 920, an index of a next action node (3) 922, action data (event=0x124) 924, a predicate node (event ID) 926, a comparison (1: equal to, where the value “1” has been encoded to represent “equal to”) 928, event ID (event=0x123), and a message (e.g., “Warmstart did not finish in 8 seconds.”) 932.
In certain embodiments, the events 160 (e.g., program events) are storage controller events and serve as input to the error inject interpreter 170. In certain embodiments, there are two types of events 160: code path events 162 and time events 164.
A code path event 162 represents a particular code path 152. The code path events 162 are generated or triggered by event macros 154, which are included in the code paths. A code path event 162 is identified by an event identifier (ID). Even though the storage controller 140 may generate more than one code path event 162 at a same time, those code path events 162 are processed in serial by the error inject interpreter 170.
When invoked, an event macro 154 does not necessarily generate a code path event 162. The code path event 162 is generated when the code path event 162 is armed by the error inject script 120. The error inject script 120 can also disarm a code path event 162 when the code path event 162 is no longer of interest to the error inject scenario 120. In certain embodiments, by default, right after an error inject script 120 is loaded, all code path events 162 are not armed.
Code path events 162 can also carry data. The data is specified as a parameter for the event macro 154. The event data can be used by the error inject error inject script 120 data structure 130 to fine tune the conditions.
Time events 164 are related to the progress of time (e.g., relative to some event, such as a code path event). Relative timers may be used by the error inject script to generate time events 164. Unlike code path events 162, multiple time events 164 may happen with or without the code path event 162.
Time events 164 do not need to be armed. A time event 164 is enabled when the time event 164 is initialized. The time event 164 can be initialized when the time event 164 is declared (i.e., initialized as part of the load). Time events 164 can also be disabled.
The error inject script 120 may be described as specifying the behavior of an error inject test. After being compiled, the error inject script 120 is converted into the error inject data structure 130 that is understood by the error inject interpreter 170. So, at runtime (i.e., when the executable code 156 is executing), after the data structure 130 is loaded, the user mode (i.e., blocks 100-130 of FIG. 1) is not involved.
The error injects 180 include both common error injects 182 and non-common error injects 184. The common error injects 182 are executed by the error inject interpreter 170. The embedded error injects 184 are executed when thread control is returned from the event macro 154 to the executing code.
The event macro 154 may be defined as:

OS_ERRORINJECT(EventId,data)

The event macro 154 defines a code path event 162 that can serve as a trigger to the error inject interpreter 170. In certain embodiments, the event macro 154 returns an integer value. For example, when the code path event 162 is disarmed, the event macro 154 returns zero (“0”); otherwise, when the code path event 162 is triggered, the event macro 154 returns a value as specified by the error inject script 120 or zero if not specified. The returned value can be used to decide which, if any, embedded associated error injects 180 are to be carried out.
The error inject script 120 may also define error injects with conditions on the triggered events and other conditions based on timers, states, and counters. When the conditions are met, the corresponding error injects on the error inject script 120 will be carried out before the embedded associated operations in the code 150. In certain embodiments, the event macro 154 returns zero (“0”) when the event is triggered but there is no condition met.
The following is an example event macro 154:














if (OS_ERRORINJECT(OS_WARMSTART_PHASE0, 1)) { 



 /* error inject operation */



 ...



}









In the OS_ERRORINJECT event macro 154, the EventId is an enumeration that may be shared. In certain embodiments, components allocate enumeration in a chunk of 32 at a time, and the value should be contiguous from zero (“0”) and up. Enumeration may be described as consisting of a set of named integer constants as described in the “C” programming language. In certain embodiments, the first 32 events are reserved for the lab debug purpose, and any one can use them as temporary events.
In certain embodiments, the error inject interpreter 170 reserves an indicator array (e.g., a bit array), one indicator for each event 160, to keep track of the arm state of the events 160. The corresponding indicator is on if the event 160 is armed. When the event macro 154 is invoked, the error inject interpreter 170 checks each indicator in this indicator array, and, if an indicator is set to “on”, the error inject interpreter 170 analyzes the condition associated with that indicator.
The error inject interpreter 170 maintains relative timers to allow conditions to be set based on the time. In certain embodiments, a timer returns a TRUE condition on a predicate when the timer is expired; otherwise, the timer returns FALSE condition. In certain embodiments, the resolution of the timer defaults to 10 seconds, however, a different resolution may be specified. In certain embodiments, the resolution is not less than one second. In certain embodiments, a timer Task Control Block (TCB) may be used to schedule the timer update process with the specified frequency. A TCB may be described as an internal timer service on the storage controller 140.
FIG. 10 illustrates logic performed by the error inject compiler 110 in accordance with certain embodiments. Control begins in block 1000 with the error inject compiler 110 retrieving an error inject script 120 that includes one or more declarations 122 and one or more error inject scenarios 124 that define under which conditions an error inject 180 (e.g., a common error inject 182 and/or a non-common error inject 184) is to be executed. In block 1002, the error inject compiler 110 compiles the error inject script 120. In block 1004, the error inject compiler 110 outputs the error inject data structure 130.
In certain embodiments, the error inject script 120 human-readable, while the error inject data structure 130 is consumed by the storage controller 140. That is, the data structure 130 is in a form that us usable by a computer.
FIG. 11 illustrates logic to trigger an event in accordance with certain embodiments. Control begins in block 1100 with the storage controller 140 executing the executable code 156 that includes at least one error inject 180 (e.g., at least one common error inject 182 and/or non-common error inject 184). During execution, if an event macro 154′ is reached (block 1102), processing continues to block 1104, otherwise, processing continues to block 1106. In block 1104, the event macro 154′ generates a code path event 162. In block 1106, if a timer has completed (e.g., counted down to zero), then processing continues to block 1108, otherwise, processing loops back to block 1100 to continue executing the executable code 156. In block 1108, a time event 164 is generated.
FIG. 12 illustrates logic performed by the error inject interpreter 170 in accordance with certain embodiments. Control begins in block 1200 with the error inject interpreter 170 receiving an indication that an event 160 has been triggered (e.g., a code path event 162 or a time event 164). For example, when the executable code 156 is executing, and an event macro 154 in a code path 152 is reached, the event macro 154 notifies the error inject interpreter 170 of a code path event 162. As another example, if a timer counts down to zero, the error inject interpreter 170 receives an indication of such a time event 164.
In block 1202, the error inject interpreter 170 evaluates conditions 126 defined in the error inject scenarios 124 of the error inject script 120 using the error inject data structure 130. In block 1204, the error inject interpreter 170, for each of the conditions 126 that evaluates to TRUE, performs actions 128 defined in the error inject scenario 124 for that condition 126.
Thus, without driving the error inject scenarios 124, the code segments for inject locations and non-common injects 184 are executed. That is, the non-common error inject code 184 will not be accidentally executed because an event needs to trigger the execution. Also, there is no need to conditional compile the code segments for inject locations and non-common error injects 184 out. That is, because events 160 trigger execution of the non-common error injects 184, there is no need to remove the non-common error injects 184 and recompile the code 150. The error inject scenarios 124 and the common error injects 182 may be described by an error inject script 120 using the error inject specification language described herein. The error inject script 120 may be compiled and loaded to the storage controller 140 without recompiling and without restarting the storage controller 140.
Additional Embodiment Details
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or computer program product. Accordingly, aspects of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, micro-code, etc.) or an embodiment combining software and hardware aspects that may all generally be referred to herein as a “circuit,” “module” or “system.” Furthermore, aspects of the present invention may take the form of a computer program product embodied in one or more computer readable medium(s) having computer readable program code embodied thereon.
Any combination of one or more computer readable medium(s) may be utilized. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, solid state memory, magnetic tape or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter error inject scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider).
Aspects of the present invention are described below with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer readable medium that can direct a computer, other programmable data processing apparatus, or other devices to function in a particular manner, such that the instructions stored in the computer readable medium produce an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
The code implementing the described operations may further be implemented in hardware logic or circuitry (e.g., an integrated circuit chip, Programmable Gate Array (PGA), Application Specific Integrated Circuit (ASIC), etc.
FIG. 13 illustrates a computer architecture 1300 that may be used in accordance with certain embodiments. Computing device 100 and/or storage controller 140 may implement computer architecture 1300. The computer architecture 1300 is suitable for storing and/or executing program code and includes at least one processor 1302 coupled directly or indirectly to memory elements 1304 through a system bus 1320. The memory elements 1304 may include local memory employed during actual execution of the program code, bulk storage, and cache memories which provide temporary storage of at least some program code in order to reduce the number of times code must be retrieved from bulk storage during execution. The memory elements 1304 include an operating system 1305 and one or more computer programs 1306.
Input/Output (I/O) devices 1312, 1314 (including but not limited to keyboards, displays, pointing devices, etc.) may be coupled to the system either directly or through intervening I/O controllers 1310.
Network adapters 1308 may also be coupled to the system to enable the data processing system to become coupled to other data processing systems or remote printers or storage devices through intervening private or public networks. Modems, cable modem and Ethernet cards are just a few of the currently available types of network adapters 1308.
The computer architecture 1300 may be coupled to storage 1316 (e.g., a non-volatile storage area, such as magnetic disk drives, optical disk drives, a tape drive, etc.). The storage 1316 may comprise an internal storage device or an attached or network accessible storage. Computer programs 1306 in storage 1316 may be loaded into the memory elements 1304 and executed by a processor 1302 in a manner known in the art.
The computer architecture 1300 may include fewer components than illustrated, additional components not illustrated herein, or some combination of the components illustrated and additional components. The computer architecture 1300 may comprise any computing device known in the art, such as a mainframe, server, personal computer, workstation, laptop, handheld computer, telephony device, network appliance, virtualization device, storage controller, etc.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the singular forms “a”, “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
The corresponding structures, materials, acts, and equivalents of all means or step plus function elements in the claims below are intended to include any structure, material, or act for performing the function in combination with other claimed elements as specifically claimed. The description of embodiments of the present invention has been presented for purposes of illustration and description, but is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the invention. The embodiments were chosen and described in order to best explain the principles of the invention and the practical application, and to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.
The foregoing description of embodiments of the invention has been presented for the purposes of illustration and description. It is not intended to be exhaustive or to limit the embodiments to the precise form disclosed. Many modifications and variations are possible in light of the above teaching. It is intended that the scope of the embodiments be limited not by this detailed description, but rather by the claims appended hereto. The above specification, examples and data provide a complete description of the manufacture and use of the composition of the embodiments. Since many embodiments may be made without departing from the spirit and scope of the embodiments, the embodiments reside in the claims hereinafter appended or any subsequently-filed claims, and their equivalents.

## Claims

1. A system, comprising: a processor; and storage coupled to the processor, wherein the storage stores a computer program, and
wherein the processor is configured to execute the computer program to perform operations, wherein the operations comprise:
receiving an error inject script that includes a declaration that describes one or more events and an error inject scenario that describes conditions under which error injects are to be executed and associated one or more error inject actions, wherein the error injects comprise a common error inject and a non-common error inject, wherein the common error inject is a predefined error inject, and wherein the non-common error inject is a customized error inject;
compiling the error inject script to output an error inject data structure that includes data elements corresponding to the one or more events and that includes the conditions and the associated one or more error inject actions; and while executing code that includes the error injects,
in response to an event from the one or more events being triggered, evaluating the conditions in the error inject data structure associated with the event; and
for a condition from the conditions that evaluates to true, performing the associated one or more error inject actions defined in the error inject script for the condition, wherein at least one of the error inject actions changes one of a state and a counter that causes another condition from the conditions to evaluate to true, and wherein the associated one or more error inject actions defined in the error inject script for the another condition are performed.

2. The system of claim 1, wherein the event that is triggered comprises a code path event and wherein the operations further comprise:
reaching an event macro while executing code, wherein the event macro is a statement in the code that generates the code path event.

3. The system of claim 1, wherein the event that is triggered comprises a time event.

4. The system of claim 1, wherein the declaration defines programming elements that include one or more events, the counter, the state, a constant, and a timer.

5. The system of claim 1, wherein, when the error inject data structure is loaded into a storage controller, the storage controller activates the one or more events.

6. A computer program product comprising a non-transitory computer readable storage medium including a computer readable program, wherein the computer readable program when executed by a processor on a computer causes the computer to:
receive an error inject script that includes a declaration that describes one or more events and an error inject scenario that describes conditions under which error injects are to be executed and associated one or more error inject actions, wherein the error injects comprise a common error inject and a non-common error inject, wherein the common error inject is a pre-defined error inject, and wherein the non-common error inject is a customized error inject;
compile the error inject script to output an error inject data structure that includes data elements corresponding to the one or more events and that includes the conditions and the associated one or more error inject actions; and
while executing code that includes the error injects, in response to an event from the one or more events being triggered, evaluate the conditions in the error inject data structure associated with the event; and
for a condition from the conditions that evaluates to true, perform the associated one or more error inject actions defined in the error inject script for the condition, wherein at least one of the error inject actions changes one of a state and a counter that causes another condition from the conditions to evaluate to true, and wherein the associated one or more error inject actions defined in the error inject script for the another condition are performed.

7. The computer program product of claim 6, wherein the event that is triggered comprises a code path event and wherein the computer readable program when executed by the processor on the computer causes the computer to:
reach an event macro while executing code, wherein the event macro is a statement in the code that generates the code path event.

8. The computer program product of claim 6, wherein the event that is triggered comprises a time event.

9. The computer program product of claim 6, wherein the declaration defines programming elements that include the one or more events, the counter, the state, a constant, and a timer.

10. The computer program product of claim 6, wherein, when the error inject data structure is loaded into a storage controller, the storage controller activates the one or more events.