Actions
Bug #7463
closedCorrect processing of block structures and code in the root of pre, post and run methods
Start date:
08/12/2016
Due date:
% Done:
100%
Estimated time:
Detected in build:
svn
Platform:
Published in build:
2.3.46
Description
Currently, block sections and code placed outside of blocks (so-called external or global) are not handled correctly. The incorrect behavior includes unexpected exceptions, undesired split of code into parts processed separately, and wrong order of processing.
Here are basic requirements for the correct behavior:
- A block-like construct must not split global code into parts being processed separately, if the block is not run.
- If a block saved into a variable is run, global code before the point of call gets processed.
- Since it is not allowed to run blocks in the
pre
andpost
methods, program-level prologue and epilogue are always processed as a whole.
Here is in example with comments:
class BlockGlobalCodeTemplate < MiniMipsBaseTemplate
def pre
super
# A: part of program prologue
add s0, s0, s0
# B: sequence block saved in an object-level variable
@z = sequence {
sub t1, t2, t3
sub t3, t4, t5
}
# C: part of program prologue, must be processed with A as a whole
sub s1, s2, s3
# X: Prologue to be added to all test cases produced by block constructs
prologue {
pseudo '// Global prologue starts'
pseudo '// Global prologue ends'
}
# Y: Epilogue to be added to all test cases produced by block constructs
epilogue {
pseudo '// Global epilogue starts'
pseudo '// Global epilogue ends'
}
end
def run
# D: external code for linking test cases
nop
nop
# E: sequence block saved in a local variable
x = sequence {
add t1, t2, t3
add t3, t4, t5
}
# F: external code for linking test cases, must be processed as a whole with D
nop
nop
# Processing: first - D and F as a whole, then - E.
x.run
# G: external code for linking test cases
nop
nop
# H: sequence block saved in a local variable (is not processed)
y = sequence {
add t1, t2, t3
add t3, t4, t5
}
# I: external code for linking test cases, must be processed as a whole with G
nop
nop
# Processing: first - G and I as a whole, then - B.
@z.run
end
end
The expected order of processing is the following:
- A and B as a whole
- D and F as a whole
- E (wrapped with X and Y)
- G and I as a whole
- B (wrapped with X and Y)
H is not processed (reported as a warning).
Updated by Andrei Tatarnikov over 8 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Done - r6952.
Note: global prologue and epilogue are added only to sequences produced by blocks defined after these prologue and epilogue.
Updated by Andrei Tatarnikov over 8 years ago
- Status changed from Resolved to Closed
- Published in build set to 2.3.46
Actions