Summary: When inspecting silent introduced issues, we found that an introduced issue is about a complexity increase of a block that is only created in the current diff. Based on the trace view, we find out that this is caused by infer mistakingly consider another block that exists in the previous diff as the same block that is newly created in the current diff. This diff adds a test case that reproduces this case, and this will be fixed in the next diff. facebook Trace view: https://www.internalfb.com/intern/traceview/?id=109896337 Reviewed By: ezgicicek Differential Revision: D23681550 fbshipit-source-id: 78341268bmaster
parent
bc4b1882dc
commit
8a844ab67f
@ -0,0 +1,26 @@
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
# E2E test for differential of costs
|
||||
|
||||
TESTS_DIR = ../..
|
||||
SOURCES = src/DiffBlock.m.current src/DiffBlock.m.previous
|
||||
CLANG_OPTIONS = -c $(OBJC_CLANG_OPTIONS)
|
||||
include $(TESTS_DIR)/differential.make
|
||||
include $(TESTS_DIR)/objc.make
|
||||
INFERPRINT_ISSUES_FIELDS = \
|
||||
"bug_type,bucket,file,procedure,line_offset,bug_trace"
|
||||
|
||||
$(CURRENT_REPORT) $(PREVIOUS_REPORT): $(OBJC_DEPS)
|
||||
|
||||
$(CURRENT_REPORT):
|
||||
$(QUIET)$(COPY) src/DiffBlock.m.current src/DiffBlock.m
|
||||
$(QUIET)$(call silent_on_success,Testing Cost Differential: current,\
|
||||
$(INFER_BIN) --enable-issue-type INFINITE_EXECUTION_TIME --cost-only -o $(CURRENT_DIR) -- clang $(CLANG_OPTIONS) src/*.m)
|
||||
|
||||
$(PREVIOUS_REPORT):
|
||||
$(QUIET)$(COPY) src/DiffBlock.m.previous src/DiffBlock.m
|
||||
$(QUIET)$(call silent_on_success,Testing Cost Differential: previous,\
|
||||
$(INFER_BIN) --debug --enable-issue-type INFINITE_EXECUTION_TIME --cost-only -o $(PREVIOUS_DIR) -- clang $(CLANG_OPTIONS) src/*.m)
|
@ -0,0 +1 @@
|
||||
{"top":{"current":0,"previous":0},"unreachable":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[{"degree":0,"current":20,"previous":15},{"degree":100,"current":4,"previous":1}]}
|
@ -0,0 +1 @@
|
||||
EXECUTION_TIME_COMPLEXITY_INCREASE, no_bucket, src/DiffBlock.m, objc_blockHandler.create_block_here:array:call:_2, 0, [Previous Cost of objc_blockHandler.func_linear_1 is 22 (degree is 0),Updated Cost of objc_blockHandler.create_block_here:array:call:_2 is 5 + 5 ⋅ array->elements.length + 4 ⋅ (array->elements.length + 1) (degree is 1),{array->elements.length + 1},Loop]
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface CallBlocks : NSObject
|
||||
|
||||
- (void)take_two_blocks:(NSInteger*)n
|
||||
block1:(void (^)(NSInteger*))block1
|
||||
block2:(void (^)(NSInteger*))block2;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CallBlocks
|
||||
|
||||
- (id)init {
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)take_two_blocks:(NSInteger*)n
|
||||
block1:(void (^)(NSInteger*))block1
|
||||
block2:(void (^)(NSInteger*))block2 {
|
||||
block1(n);
|
||||
block2(n);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface Handler : NSObject
|
||||
@end
|
||||
|
||||
@implementation Handler
|
||||
|
||||
- (void (^)(NSString*))func_linear {
|
||||
return ^(NSString* str) {
|
||||
NSLog(@"Report error : %@ \n", str);
|
||||
};
|
||||
}
|
||||
|
||||
- (void)func_linear:(NSArray*)array {
|
||||
for (id value in array) {
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
int main() { return 0; }
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface CallBlocks : NSObject
|
||||
|
||||
- (void)take_two_blocks:(NSInteger*)n
|
||||
block1:(void (^)(NSInteger*))block1
|
||||
block2:(void (^)(NSInteger*))block2;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CallBlocks
|
||||
|
||||
- (id)init {
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)take_two_blocks:(NSInteger*)n
|
||||
block1:(void (^)(NSInteger*))block1
|
||||
block2:(void (^)(NSInteger*))block2 {
|
||||
block1(n);
|
||||
block2(n);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface Handler : NSObject
|
||||
@end
|
||||
|
||||
@implementation Handler
|
||||
|
||||
- (void (^)(NSString*))func_linear {
|
||||
return ^(NSString* str) {
|
||||
NSLog(@"Report error : %@ \n", str);
|
||||
};
|
||||
}
|
||||
|
||||
- (void)func_linear:(NSArray*)array {
|
||||
for (id value in array) {
|
||||
}
|
||||
}
|
||||
|
||||
- (void)create_block_here:(NSInteger*)n
|
||||
array:(NSArray*)array
|
||||
call:(CallBlocks*)call {
|
||||
[call take_two_blocks:n
|
||||
block1:^(NSInteger* n) {
|
||||
for (id value in array) {
|
||||
n += [value integerValue];
|
||||
}
|
||||
}
|
||||
block2:^(NSInteger* n) {
|
||||
NSLog(@"Report error");
|
||||
}];
|
||||
}
|
||||
@end
|
||||
|
||||
int main() { return 0; }
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface CallBlocks : NSObject
|
||||
|
||||
- (void)take_two_blocks:(NSInteger*)n
|
||||
block1:(void (^)(NSInteger*))block1
|
||||
block2:(void (^)(NSInteger*))block2;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CallBlocks
|
||||
|
||||
- (id)init {
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)take_two_blocks:(NSInteger*)n
|
||||
block1:(void (^)(NSInteger*))block1
|
||||
block2:(void (^)(NSInteger*))block2 {
|
||||
block1(n);
|
||||
block2(n);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface Handler : NSObject
|
||||
@end
|
||||
|
||||
@implementation Handler
|
||||
|
||||
- (void (^)(NSString*))func_linear {
|
||||
return ^(NSString* str) {
|
||||
NSLog(@"Report error : %@ \n", str);
|
||||
};
|
||||
}
|
||||
|
||||
- (void)func_linear:(NSArray*)array {
|
||||
for (id value in array) {
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
int main() { return 0; }
|
Loading…
Reference in new issue